0

There is a code written in R 2.15 and it works fine but when we copy to another PC with R 3.6 it errors I'm not familiar with R syntax so please tell me that what does every part do and why this error occurs Thanks

f <- function(x) mlv(x, method = "discrete")$M[1]

$ operator is invalid for atomic vectors

UseR10085
  • 7,120
  • 3
  • 24
  • 54
  • 1
    Can you make sure the question contains more information such as where the `mlv` function comes from, the input object that throws the error? See [here](https://stackoverflow.com/q/5963269/3277821) for details. – sboysel Oct 13 '19 at 04:19
  • 1
    Read the manual page for function `mlv` to find out what it does. You did not tell us where to find the function. It is not part of base R so you must have loaded it from a package with the `library` function. It is possible that the return value for function has been changed since R version 2.15 because it now returns a vector (atomic) not a list or data frame so the `$M[1]` part is no longer valid. – dcarlson Oct 13 '19 at 04:21
  • Thanks a lot for your help. it was a part of huge code and I didn't have access to rest of code. But I'll see the doc and try to send the function output. Thanks again – Ali Asghar Pourostad Oct 13 '19 at 12:50

0 Answers0