Closed Nick-Poulton closed 4 years ago
I think this may be the way this displayed in R. Could you provide a short code example?
Hi Tom,
Thanks so much for your response and sorry for my delay. I've provided my code below and a screenshot of what my table looks like. I re-imported the file using "read.table" and ran everything again with the following command (which I was using before) and it gave out 6 values this time, instead of 4. I'm not sure what was happening earlier but it seems to be working now.
samplemeans <-c(mean(geneExpression[,1]),mean(geneExpression[,2]),mean(geneExpression[,3]),mean(geneExpression[,4]),mean(geneExpression[,5]),mean(geneExpression[,6]))
For the exercise reagarding "Reading and writing data in R" I had some trouble with the way the data was arranged.
I imported "GeneExpression.txt" and it looked similar to the example in the exercise, the difference is that I had 4 columns reading (Sample_1.hi, Sample_2.hi, Sample_3.hi, Sample_4.low) on top and 2 columns below (Sample_5.low, Sample_1.low). When I tried to take the mean specifying each of the 6 columns, it gave 4 values as an output.
I ended up with the right answer by using the colMeans function, but do you know why it was only giving me 4 mean values? Was it interpreting the stacked columns as a single column?
Thanks in advance!