[BioC] Problem creating a contrast matrix

Jim MacDonald jmacdon at med.umich.edu
Wed Jul 4 16:49:09 CEST 2007


Hi Sergei,

You can't start a variable name with a number in R, so you can either 
change to something like day.025, or you can construct your contrasts 
matrix by hand, using something like

contrast <- 
matrix(c(-1,0,0,1,0,0,0,-1,0,0,0,1,0,0,-1,0,0,0,0,1,0,-1,0,0,0,0,0,0,1), 
ncol=4, dimnames=list(colnames(design), paste(colnames(design)[c(4:7)], 
colnames(design)[1]))

I often construct the contrasts matrix by hand as it gives you more 
control over the dimnames attribute.

Best,

Jim

BTW, you only need to send a question once. Sending it thrice may well 
result in no response ;-D
Siarhei Manakou wrote:
> Hello, 
>
> Im a first year PhD student in Sanger institute - just started working with bioconductor and encoutered problem while building a contrast matrix. I first made  the desing matrix:
>
>   
>> design<-model.matrix(~-1 + pData(eset)$days)
>> colnames(design)<-levels(pData(eset)$days)
>> colnames(design)
>>     
> [1] "025days" "12days"  "16days"  "1days"   "2days"   "4days"   "8days"
>
>
> Then attempted to make a contrast matrix:
>
>   
>> contr_matrix<-makeContrasts(1days-025days, 2days-025days, 4days-025days, 8days-025days, 12days-025days, 16days-025days, levels=design)
>>     
>
> but it produces the following error message:
>
> Error: syntax error, unexpected SYMBOL, expecting ',' in "contr_matrix<-makeContrasts(1days"
>
> I would be very grateful if somebody could point out what the problem could be. I am using R-2.5.0 under Linux.
>
> Thanks a lot!
> Sergei
>
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor



**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.



More information about the Bioconductor mailing list