Splitting A Dataframe In R
Hi,
I have a dataframe which I would like to split into 10 rows with 5 columns each and create several dataframes in the end all with the same dimension and maybe store it as a list.
df <- data.frame(matrix(rnorm(2000), nrow=10))
I tried using
split(df, sample(rep(1:2000, 50)))
but its not correct.
The rows are the genes and the columns are the genotypes and how to apply the cor( ) to each dataframe in the list and again store it as a list?
Any help would be appreciated.
• 198 views
•
link
0 answers
No answers yet.
Log in to answer this question.
This seems to be more of an R question, rather than a bioinformatics question. You should try http://stackoverflow.com/questions/tagged/r instead.
Please clarify your goal, from your example there are 10 Genes and 200 SNPs. What are you trying to do?