[R] how to put \ in a string?

2010-04-23 Thread weix1

I have string as follows:"v:\work\gene" 
however, i can not write this as character string in R
what i did is:
path<- as.character("v:\work\gene")

but it seems that \ is eliminated:
Warning messages:
1: '\w' is an unrecognized escape in a character string 
2: '\g' is an unrecognized escape in a character string 
3: unrecognized escapes removed from "v:\work\gene" 
> path
[1] "v:workgene"

how can i keep the \ in string.

thanks

-- 
View this message in context: 
http://r.789695.n4.nabble.com/how-to-put-in-a-string-tp2062483p2062483.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] how to parse out fitting statistics and write them into a data frame?

2010-04-29 Thread weix1

hello, everyone: 
I am conducting t test between drug and control for about 50,000 gene using
the following syntax (treatment is factor): 

result<- lapply(split(data, data$gene),function(x) lm(value~treatment,x) 
  
however, the result is a list and i do not know whether more model fitting
statistics (like p value of t test) is included in "result" or not. If i
print the first element of resut i got the followings: 

> result[1] 
$`1007_s_at` 

Call: 
lm(formula = logvalue ~ treatment, data = x) 

Coefficients: 
 (Intercept)  treatmentveh   
  8.94030.3232   

> summary(result[1]) 
  Length Class Mode 
1007_s_at 13 lmlist 
> 

So my question is whether more fitting statistics (other than coefficient
estimation, like p value) are included in the "result". If yes, how can I
parse them into a data frame so that i can output those statistics into a
.csv file that can be shared with my clients. If not, how can I modify the
code so that more stat can be computed and stored? 
any constructive suggestions are welcome. 

-- 
View this message in context: 
http://r.789695.n4.nabble.com/how-to-parse-out-fitting-statistics-and-write-them-into-a-data-frame-tp2075707p2075707.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] strange error msg from lapply and lm()

2010-05-03 Thread weix1

plus, it took long time to complete this analysis for only 24 records!
Although I get the error msg, the result seems to be correct.


-- 
View this message in context: 
http://r.789695.n4.nabble.com/strange-error-msg-from-lapply-and-lm-tp2124042p2124050.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] strange error msg from lapply and lm()

2010-05-03 Thread weix1

I am conducting a very simple t test for two genes using lapply (i try to
avoid loop since i will have thousands of genes later on). however, I got
strange error msg like the followings. It looks that R is complaining my
factor has only one level, which is not the case (I check many times).

> result<- lapply(split(all,all$CHIPEXP_NAME),function(x)
> lm(logvalue~treatment,x))
Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") : 
  contrasts can be applied only to factors with 2 or more levels


can anyone help me to dissect this problem?

thanks in advance.


-- 
View this message in context: 
http://r.789695.n4.nabble.com/strange-error-msg-from-lapply-and-lm-tp2124042p2124042.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to generate a random data from a empirical distribition

2010-07-27 Thread weix1

Dennis:
points well taken. It seems to be important to investigate the nature of
distribution. I might be too naive to assume a "emiprical probability
distribution" will be simply calculated from a clound of data points...
-- 
View this message in context: 
http://r.789695.n4.nabble.com/how-to-generate-a-random-data-from-a-empirical-distribition-tp2302716p2304321.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.