Hello! I am not able to load my "ColData" (which contains information about my samples) on r and I am not sure why. I was able to load my "CountData" though.
> countData <- as.matrix(read.csv(file.choose(), row.names = "gene_id"))
> colData <- read.table(file.choose(),header=TRUE, row.names = "gene_id")
Error in data[[rowvar]] : attempt to select less than one element in get1index.
I tried to do the following also but it said Population is not found when it is actually there:
> colData <- read.table(file.choose(),header=TRUE, row.names = gene_id,Stage,Sex,Isolate,Population,Stage_Sex)
Error in match.arg(numerals) : object 'Population' not found
This is how some of the first lines in my CountData look like using TextWrangler (I could not copy the whole thing here because I have about 30 samples:
gene_id,Alsk_10-5_B150f_Gam_1,Alsk_10-5_B150f_Gam_2,Alsk_10-5_B150f_Gam_3
MSTRG.20438,160107,112757,141604,219222,98860,221610,104534,108994,117852,123897,162138
MSTRG.19848,1401,1286,1533,972,538,941,1514,1317,1642,603,764,758,1155,930,1269,1000
This is how the some of the first lines in my ColData look like using TextWrangler:
gene_id,Stage,Sex,Isolate,Population,Stage_Sex
Alsk_10.5_B150f_Gam_1,Gametophore,Female,Alsk_B150f,Alaska,Gametophore_Female
Alsk_10.5_B150f_Gam_2,Gametophore,Female,Alsk_B150f,Alaska,Gametophore_Female
Thank you Kevin!
I tried changing my file from a .csv file to a .txt file and that worked! I was able to upload my data and obtain:
I was wondering if you have an idea as in why the .txt format worked vs. the .csv ?
read.table()
is the base function here, with default of sep="", i.e., whitespace (tabs, spaces, etc).read.csv()
is a wrapper ofread.table()
and has sep=",".For further information, type
?read.table
from within RFor reading in larger data, you may consider
fread()
from data.table package.