Question: Passing contrasts as a vector gives an error
0
gravatar for Agaz Hussain Wani
4.3 years ago by
India
Agaz Hussain Wani260 wrote:

I have some issue while passing contrast argument as a vector. I create a vector

contrasts <- c("TT-C,D-C,DT-C,D-TT,DT-TT,DT-D")

after removing double quotes from the above vector by

noquote(contrasts)

I pass it to

contrast.matrix <- makeContrasts(contrasts,levels=design)

to construct a contrast matrix, which gives an error:

Error in cm[, j] <- ej :
  number of items to replace is not a multiple of replacement length

If i use

contrast.matrix <- makeContrasts(TT-C,D-C,DT-C,D-TT,DT-TT,DT-D,levels=design)

it works nicely. May i know what is going wrong. Thanks

ADD COMMENTlink modified 4.3 years ago by Gordon Smyth38k • written 4.3 years ago by Agaz Hussain Wani260
Answer: Passing contrasts as a vector gives an error
1
gravatar for Gordon Smyth
4.3 years ago by
Gordon Smyth38k
Walter and Eliza Hall Institute of Medical Research, Melbourne, Australia
Gordon Smyth38k wrote:

Look at ?makeContrasts and read the code example. The last two lines show you exactly how to do what you want.

ADD COMMENTlink modified 4.3 years ago • written 4.3 years ago by Gordon Smyth38k

Thanks , was not aware of the strength of "=" :)

ADD REPLYlink written 4.3 years ago by Agaz Hussain Wani260
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 142 users visited in the last hour