Entering edit mode
2.1 years ago
priya.bmg
▴
60
Hello
I am trying to load the trait data for WGCNA analysis. I followed the steps given in section 1c of this link https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/FemaleLiver-01-dataInput.pdf.
I have a problem in loading the traitdata. Has anyone come across this error
I have 492 rows as samples
traitData = read.csv("F:\\gene_priortization\\wgcnafiles\\trait.csv")
allTraits = traitData[c(1:2)] ## select the first two columns. First column has 492 sample names and second column is coded 1 or 2
dim(allTraits)
names(allTraits)
Samples = rownames(df1_edit_cg); ##df1_edit_cg is the expression data
traitRows = match(Samples, allTraits$ArrayName); ##I get a list with 492 integers
datTraits = allTraits[traitRows, -1]; ## Here I get the second column from all traits coded as 1 or 2
rownames(datTraits) = allTraits[traitRows, 1];
Error in `rownames<-`(`*tmp*`, value = c("X8.pcw_amygdaloid.complex", :
attempt to set 'rownames' on an object with no dimensions
datTraits
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[57] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[113] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[169] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[225] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[281] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[337] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[393] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[449] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
Thanks
Please provide an example of
datTraits
, it is likely impossible to help without seeing datahead(datTraits)
I have given an example of datTrait in the question above
Well
datTraits
is a vector, it is not a dataframe. If you want to give names to a vector you neednames(datTraits)= ...
Thank you