That code will not work. get() and assign() are troublesome for a
variety of reasons. E.g.,
* adding made-up names to the current environment is dangerous. They
may clobber fixed names in the environment. You may be confused about
what the current environment is (especially when refactoring co
It's a great method, but there is a memory problem, DFS would occupy a large
memory. So from this point of view, i prefer the loop.
>> for (i in 1 : nrow(unique)){
>> tmp=get(past0("DF",i))[1,]
>> assign(paste0("df",i),tmp)
>> dfi=dfi[,1:3]
>> names(dfi)=names(tmp[c(1,4,5)])
>> dfi=rbind(dfi,tm
> I was able to create 102 distinct dataframes (DFs1, DFs2, DFs3, etc) using
> the assign() in a loop.
The first step to making things easier to do is to put those data.frames
into a list. I'll call it DFS and your data.frames will now be DFs[[1]],
DFs[[2]], ..., DFs[[length(DFs)]].
DFs <- la
Dear all,
I was able to create 102 distinct dataframes (DFs1, DFs2, DFs3, etc) using
the assign() in a loop.
Now, I would like to perform the following transformation for each one of
these dataframes:
df1=DFs1[1,]
df1=df1[,1:3]
names(df1)=names(DFs1[c(1,4,5)])
df1=rbind(df1,DFs1[c(1,4,5)])
names
4 matches
Mail list logo