[R] replace() help

2009-05-13 Thread Crosby, Jacy R
Can anyone see what I'm doing wrong here (highlighted below)? This is driving me crazy... probably a ')' or something equally moronic... genw1[,1] A2 A3 A5 A7 A9 A00010 A00012 A00013 A00014 A00015 A00017 A00018 A00019 A00021 A00023 A00024 CC CC CC CC CC

[R] Looking for a quick way to combine rows in a matrix

2009-05-11 Thread Crosby, Jacy R
I'm working with genotype data in a frequency table: a=matrix(1:16, nrow=4) rownames(a)=c(AA,AT,TA,TT) a [,1] [,2] [,3] [,4] AA159 13 AT26 10 14 TA37 11 15 TT48 12 16 'AT' and 'TA' are essentially the same, and I'd like to combine (add) the

[R] Deleting rows that contain certain characters...or deleting ANOVA factors

2009-04-22 Thread Crosby, Jacy R
I'm hoping there's an easier way to do this... I have a large matrix which looks like this (data=REG, rownames are the Pat1, Pat2,...): L1 L2 L3 Phen1 Phen2 Phen3 Pat1AA TT A? 143 143 143 Pat2AT ?A AT 256 256 NA

[R] Deleting rows or cols that do not meet cut off

2009-04-21 Thread Crosby, Jacy R
How can I delete both rows and columns that do not meet a particular cut off value. Example: d - rbind(c(0,1,6,4), + c(2,5, 7,5), + c(3,6,1,6), + c(4,4,4,4)) f - as.matrix(d) f [,1] [,2] [,3] [,4] [1,]0164 [2,]257

[R] Pulling data into a model

2009-04-07 Thread Crosby, Jacy R
I'm creating an ANOVA model. Is there a way to pull in consecutive columns of variables for the test? Example: aov1-aov(y~x1+x2+REG[,2:num], data=REG) I'm not looking for interaction effects, I just want to create a model for the first few columns of variables (exact number and names will

[R] Hopefully a simple question

2009-03-25 Thread Crosby, Jacy R
What am I missing here? Both of my column headers in the 'FREQ' table are found in the 'genotype'; however, they aren't being recognized. colnames(FREQ) [1] X17362526 X17362627 colnames(genotype) [1] X17362311 X17362316 X17362346 X17362420 X17362421 X17362422 X17362435 X17362438 X17362459