r - for columnX of each element in listA <- corresponding element in listB -
I have two lists, one of which is data. Frame and data as the character vector of the same length. The frame is. I want to swap / overwrite Is there an example to do You can use List: Solution: Result: x1 list
ls.df for the corresponding character vector in
Ls.v . Basically the
df $ X1 & lt; - v , but it seems very easy for each item in the lists, but I can not get around it
#dummy data df1 & lt; - Data.frame (rbid (c (1, 'a'), c (2, 'b'), c (3, 'c'), c (4, 'd'), c (5, 'e' ), C (6, 'F')) DF 2 & LT; - Data. RBID (C (1, 'A'), C (2, 'B'), C (3, 'C')) DF3 and LT. - Data. Frame (RBID (C (4, 'D'), C (5, 'E'), C (6, 'F')) LSDF & Lt; - List (DF1, DF2, DF3) v1 & lt; - c ('a', 'b', 'c' 'd', 'e', 'f') v2 & lt; -c ('a', 'b', 'c') v3 and lt; -c ('d', 'e', 'f') ls V & lt; - List (v1, v2, v3)
apply-like way to do this? Any indication will be highly appreciated, thanks!
mapply .
ls.df & lt; - List (df1, df2, df3) ls.v & lt; - List (v1, v2, v3)
mapply ("[[[<- & lt; -", ls.df, value = ls .v, MoreArgs = list (1L), SIMPLIFY = FALSE)
[[1]] X1 X2AAAA2 BB3C4DD5EEFF [2]] X1x2 1A2BB3CC [[3]] X1x2 1DD2EFF < / Code>
Comments
Post a Comment