I need to create 24 variables with their corresponding data frames for 24 chromosomes and I feel that writing 24 similar lines is not efficient. Still can't figure out how to write the correct for-loop to solve this.
Here is what I've tried:
for (i in c(1:22,'X','Y')){
Chr[i] <- merge(split[['chr[i]']],split2[['chr[i]']],by='Gene_Name')
}
or
for (i in c(1:22,'X','Y')){
Chri <- merge(split[['chri']],split2[['chri']],by='Gene_Name')
}
Can anyone help me correct my code to generate data frames/variables Chr1, Chr2,...ChrY?
Here is the snapshot of part of the data frame I hope to get.