2021年4月28日星期三

how to merge two lists in inside a data frame?

I have a function that accepts a datatable:

create.p <- function(data_F){           p.ad <- lapply(strsplit(data_F, " "), function(x) p.adjust(as.numeric(x)))      data_F<- lapply(strsplit(data_F, " "), function(x) as.numeric(x))      rez <- paste(data_F,p.ad)      return(rez)    }  

p.ad-traverses the entire data frame, translates to num, and calculates p. adjust.

data_F-passes through the entire data frame, translates to num.

rez-combining these two lists.

My problem is that the lists don't want to merge. How do I fix this?

I suspect it's the structure

$ rez    : chr  "c(1,0.06,0.07) c(1.00 0.18 0.18)"  

What I expect:

paste(data_F,p.ad)  #"1,0-1.00"  #"0.06-0.18"  #"0.07-0.18"  

But when I merge, nothing changes

https://stackoverflow.com/questions/67310260/how-to-merge-two-lists-in-inside-a-data-frame April 29, 2021 at 10:31AM

没有评论:

发表评论