This is a test version of Biostars. For the public version, visit https://www.biostars.org.
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.

r

Please clarify your goal, from your example there are 10 Genes and 200 SNPs. What are you trying to do?

0 answers

No answers yet.

Log in to answer this question.