I have a function that takes a string as an argument. z <- p.str('0.002 0.003 0.555')
p.str <- function(mystr){ p.ad <- p.adjust(as.numeric(strsplit(mystr, " "))) # mystr<- as.numeric(strsplit(mystr, " ")) # rez <- paste(mystr,p.ad,collapse='\n') # return(rez) } z <- data.table(z)
p.ad
- calculates adjusted values
mystr
- string as we write it and translate it numeric
then I write to data.table.
I get an error: 'list' object cannot be coerced to type 'double'
what I expect:
| z | |--------------| | 0.002 0.006 | | 0.003 0.006 | | 0.555 0.555 |
https://stackoverflow.com/questions/67327681/a-function-that-accepts-a-string April 30, 2021 at 11:05AM
没有评论:
发表评论