creating for loops using R, where each row form a dataframe does to different datafames
Budget: $10 – $30 CAD
Hi I am quite new to R and I am trying to create a loop where each row from a dataframe goes a specific location in different dataframes. I have been stuck doing this for days and I would appreciate any help!
My dataframe:
list_files\<- c("0,4,5,7,5,7,2,5,8,9,10,12,15,7,62,5,46,7,8,1,3,5,7,8,3,1,3,7")
Target dataframe:
df_fa
df_md
df_awf
df_daxon
df_de_axial
df_de_radial
df_de_tort
Manually, I am trying to each row from list_files to go to a specific location in each of those dataframes above
### e.g. copy rows 1:7 from list_files to \[2,1\] for every dataframe
df_fa[2,1]<-list_file[1,]
df_md[2,1]<-list_file[2,]
df_awf[2,1]<-list_file[3,]
df_daxon[2,1]<-list_file[4,]
df_de_axial[2,1]<-list_file[5,]
df_de_radial[2,1]<-list_file[6,]
df_de_tort[2,1]<-list_file[7,]
e.g. copy rows 8:14 from list_files to \[2,2\] for every dataframe
df_fa[2,2]<-list_file[8,]
df_md[2,2]<-list_file[9,]
df_awf[2,2]<-list_file[10,]
df_daxon[2,2]<-list_file[11,]
df_de_axial[2,2]<-list_file[12,]
df_de_radial[2,2]<-list_file[13,]
df_de_tort[2,2]<-list_file[14,]
e.g. copy rows 15:21 from list_files to \[2,3\] for every dataframe .
df_fa[2,3]<-list_file[15,]
df_md[2,3]<-list_file[16,]
df_awf[2,3]<-list_file[17,]
df_daxon[2,3]<-list_file[18,]
df_de_axial[2,3]<-list_file[19,]
df_de_radial[2,3]<-list_file[20,]
df_de_tort[2,3]<-list_file[21,]
e.g. copy rows 22:28 from list_files to \[2,4\] for every dataframe
df_fa[2,4]\<-list_file[22,]
df_md[2,4]<-list_file[23,]
df_awf[2,4]<-list_file[24,]
df_daxon[2,4]<-list_file[25,]
df_de_axial[2,4]<-list_file[26,]
df_de_radial[2,4]<-list_file[27,]
df_de_tort[2,4]<-list_file[28,]
I have manually tried to code, but that would be very labor intensive if I want to repeat the process to several dataframes
My dataframe:
list_files\<- c("0,4,5,7,5,7,2,5,8,9,10,12,15,7,62,5,46,7,8,1,3,5,7,8,3,1,3,7")
Target dataframe:
df_fa
df_md
df_awf
df_daxon
df_de_axial
df_de_radial
df_de_tort
Manually, I am trying to each row from list_files to go to a specific location in each of those dataframes above
### e.g. copy rows 1:7 from list_files to \[2,1\] for every dataframe
df_fa[2,1]<-list_file[1,]
df_md[2,1]<-list_file[2,]
df_awf[2,1]<-list_file[3,]
df_daxon[2,1]<-list_file[4,]
df_de_axial[2,1]<-list_file[5,]
df_de_radial[2,1]<-list_file[6,]
df_de_tort[2,1]<-list_file[7,]
e.g. copy rows 8:14 from list_files to \[2,2\] for every dataframe
df_fa[2,2]<-list_file[8,]
df_md[2,2]<-list_file[9,]
df_awf[2,2]<-list_file[10,]
df_daxon[2,2]<-list_file[11,]
df_de_axial[2,2]<-list_file[12,]
df_de_radial[2,2]<-list_file[13,]
df_de_tort[2,2]<-list_file[14,]
e.g. copy rows 15:21 from list_files to \[2,3\] for every dataframe .
df_fa[2,3]<-list_file[15,]
df_md[2,3]<-list_file[16,]
df_awf[2,3]<-list_file[17,]
df_daxon[2,3]<-list_file[18,]
df_de_axial[2,3]<-list_file[19,]
df_de_radial[2,3]<-list_file[20,]
df_de_tort[2,3]<-list_file[21,]
e.g. copy rows 22:28 from list_files to \[2,4\] for every dataframe
df_fa[2,4]\<-list_file[22,]
df_md[2,4]<-list_file[23,]
df_awf[2,4]<-list_file[24,]
df_daxon[2,4]<-list_file[25,]
df_de_axial[2,4]<-list_file[26,]
df_de_radial[2,4]<-list_file[27,]
df_de_tort[2,4]<-list_file[28,]
I have manually tried to code, but that would be very labor intensive if I want to repeat the process to several dataframes