I tried using the advice given in Put multiple data frames into list (smart way) but continue getting the following error:
argument "nm" is missing, with no default
I'm not sure why this is the case. I tried searching the error but couldn't find anything on it (Create a list with named values by applying a function to each row of a data frame shows this error in a comment but didn't explain it).
I have the following data.frames (data doesn't matter only name here):
#create data.frames
p1sfdf1=data.frame(a=(1:10),b=(2:11),c=(3:12))
p2sfdf1=data.frame(a=(1:10),b=(2:11),c=(3:12))
p1sfdf2=data.frame(a=(1:10),b=(2:11),c=(3:12))
p2sfdf2=data.frame(a=(1:10),b=(2:11),c=(3:12))
p1sfdf3=data.frame(a=(1:10),b=(2:11),c=(3:12))
p2sfdf3=data.frame(a=(1:10),b=(2:11),c=(3:12))
p1sfdf4=data.frame(a=(1:10),b=(2:11),c=(3:12))
#note no p2sfdf4 here
p1sfdf5=data.frame(a=(1:10),b=(2:11),c=(3:12))
p2sfdf5=data.frame(a=(1:10),b=(2:11),c=(3:12))
#combine data.frames into a list of data.frames
l.sf=setNames(lapply(ls(pattern="p[1-2]+"),function(x) get(x)))
I would like to group the data.frames into a list of data.frames. I tried to group based off of the pattern "p" and then either 1 or 2 but I wasn't sure how to demonstrate that in the pattern. I'm guessing that's where my error comes from, but I'm not sure how to fix it.