Computing the Tukey median

I am trying to compute the data depth of two variables with the following function:

library(depth)
x <- data.frame(data$`math score`, data$`reading score`)


depth(1000, x, method = "Tukey", approx = FALSE, eps = 1e-8, ndir = 1000)

the first variable after depth is u which stands for Numerical vector whose depth is to be calculated. Dimension has to be the same as that of the observations. I have 1000 observations however I get the following error message:

Error in depth(1000, x, method = "Tukey", approx = FALSE, eps = 1e-08,  : 
  Dimension mismatch between the data and the point u.

Does someone know how to solve this issue? Thank you in advance!



Read more here: https://stackoverflow.com/questions/64958721/computing-the-tukey-median

Content Attribution

This content was originally published by Chiara at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: