r - For look to create smaller data frames -


i need create data frame base in search of bigger data frame

big data frame:

 4 lw1001            na    na       <na>       na         test   5 lw1001            na    na       <na>       na         test        .        .     6 lw1002            na    na       <na>       na         test   7 lw1002            na    na       <na>       na         test   8 lw1002            na    na       <na>       na         test   9 lw1003            na    na       <na>       na         test 

i want data frame below:

 4 lw1001            na    na       <na>       na         test   5 lw1001            na    na       <na>       na         test   6 lw1001            na    na       <na>       na         test    7 lw1001            na    na       <na>       na         test   8 lw1001            na    na       <na>       na         test   9 lw1001            na    na       <na>       na         test   for(i in moduleswithmarks) {     <- modulemarks[modulemarks$module==i,]  } 

i'm trying above, have ideas on ? loop wrong or there better way?

subset 2nd column, loop works, but, not create data frame. whats happening getting last rows same column in table called i. .....

so processing in loop not creating tables programatically..... i'm getting lwxxxx (end data frame) , called i should getting lw1001 dataframe, lw1002 dataframe unique values in 2nd column.

i'm not sure undestand if do, want subset second column:

 df2 = df[df[,2]=="lw1001",] 

to loop each you'd like:

   for(i in unique(df[,2])){assign(i,  df[df[,2]==i,])} 

you don't have loop though, split


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -