search for: simpledata

Displaying 4 results from an estimated 4 matches for "simpledata".

Did you mean: sampledata
2008 Jun 07
2
Predicting a single observatio using LME
When I use a model fit with LME, I get an error if I try to use "predict" with a dataset consisting of a single line. For example, using this data: > simpledata Y t D ID 1 -1.464740870 1 0 1 2 1.222911373 2 0 1 3 -0.605996798 3 0 1 4 0.155692707 4 0 1 5 3.849619772 1 0 2 6 4.289213902 2 0 2 7 2.369407737 3 0 2 8 2.249052533 4 0 2 9 0.920044316 1 0 3 10 2.003262622 2 0 3 11 0.003833438 3 0 3 12 1.578300927 4 0 3...
2008 May 07
1
Automatically generating new column names (and columns)
...flect this) like: Y X1 X2 X3 X4 X1^2 X2^2 X3^2 X4^2 I believe I can compute the values correctly with the code below, but I am unable to generate the column names. (This is a short example, in reality I have many more columns and more complicated names) for(i in 2:5) { name=get(paste(names(simpleData)[i],"^2", sep="")) simpleData<- transform(simpleData, name=(simpleData[,i]^2)) } print(simpleData) Any suggestions/hints .. I've searched the FAQ and web (this is how I came across the get() function) but no luck so far. Thanks, Esmail
2012 May 21
1
Complex text parsing task
...ding. #### Simple coding #### KRASpatient <- c("001-001", "001-002", "001-003", "001-004", "001-005", "001-006", "001-007") KRAStested <- c(2,3,2,2,2,3,3) KRASwild <- c(1,0,2,0,3,1,3) KRASmutant <- c(4,2,2,3,1,2,2) simpleData <- data.frame(KRASpatient, KRAStested, KRASwild, KRASmutant) simpleData Here, KRAStested is calculated by summing all references to "KRAS" for each patient. Wild is calculated by summing all references to "wild type", "wild", and "negative" that come wit...
2008 Jun 06
6
Subsetting to unique values
I want to take the first row of each unique ID value from a data frame. For instance > ddTable <- data.frame(Id=c(1,1,2,2),name=c("Paul","Joe","Bob","Larry")) I want a dataset that is Id Name 1 Paul 2 Bob > unique(ddTable) Will give me all 4 rows, and > unique(ddTable$Id) Will give me c(1,2), but not accompanied by the name column.