Re: [R] Need Help .RData in Mac OS X, Please

2010-09-05 Thread Chunhao
Hi David, This rm .RData works perfectly. Many Many Thanks Chunhao -- View this message in context: http://r.789695.n4.nabble.com/Need-Help-RData-in-Mac-OS-X-Please-tp2527456p2527674.html Sent from the R help mailing list archive at Nabble.com. __ R

[R] Need Help .RData in Mac OS X, Please

2010-09-05 Thread Chunhao
Hi R Users, I was accidentally save R file when I quit R program. I try to delete but I am not sure the R saved file was successfuly delete or not. Now everyt time when I open the R, it always appears [R.app GUI 1.34 (5589) i386-apple-darwin9.8.0] [Workspace restored from /Users/ctu/.RData] I h

[R] Use 2 "ifelse" to sort data

2010-02-22 Thread Chunhao
Dear R users, I have a question how to use 2 "ifelse" to sort my data. Such as from 11 to 20 assign to A; 6 to 10 assign to B, and the rest of them assign to C a<-1:20 tt<-ifelse(a>10, "A",no=ifelse( 5< a <=10, "B", "C")) Many Thank

[R] Compare two repeated measures mixed models

2009-12-17 Thread Chunhao
Hi R users, I have a statistical question. If I have two repeated measures models such as, m1, y=u+a+time+a:time+e m2, y=u+b+time+b:time+e How can I compare these two models (such as which one is the better predictor, a or b)? Many Thanks In Advance. Chunhao -- View this message in context

[R] What did I do wrong? Bootstrap with glm

2009-10-01 Thread Chunhao Tu
Hi R users, I just play with a small data set (from SAS) by using the boot with glm. But I don't know what I did wrong. Would someone please give me a hint? > require(boot) > carc<-read.table(file="C:\\Documents and > Settings\\admin\\Desktop\\drug.txt",header=T) > carc n cc car age 1 500

[R] Something wrong with my function Please Help

2009-09-29 Thread Chunhao Tu
Hi R users, I try to build a function to compute odds ratio and relative risk however something wrong. I stuck for many hours but I really don't know how to solve it. Would someone please give me a hint? > OR.RR<-function(x){ + x <- as.matrix(any(dim(x)==2)) + OR<-(x[1,1]*x[2,2])/(x[1

[R] The code behind the function

2009-09-09 Thread Chunhao Tu
Hi R users, I have a question. How can I see the code behind the function. For example, > boxplot function (x, ...) UseMethod("boxplot") I really would like to see how people code this. Could someone please show me how to see the code behind the function? Many Thanks Tu -- View this message

[R] strange results in summary and IQR functions

2009-09-08 Thread Chunhao Tu
Dear R users, Something is strange in summary and IQR. Suppose, I have a data set and I would like to find the Q1, Q2, Q3 and IQR. x<-c(2,4,11,12,13,15,31,31,37,47) > summary(x) Min. 1st Qu. MedianMean 3rd Qu.Max. 2.00 11.25 14.00 20.30 31.00 47.00 > IQR(x) [1] 19.75

[R] Help LSD multiple comparison test

2009-06-23 Thread Chunhao Tu
Hi R users, I know this is a old question but I did not see any clear answer. Is there any way or package to perform LSD test in R such as H0: A=B. H0, A=C and H0 B=C. Thank you in advance Tu -- View this message in context: http://www.nabble.com/Help-LSD-multiple-comparison-test-tp24178161p24

[R] Please Help pairwise.t.test!!

2009-06-11 Thread Chunhao Tu
Bonferroni test? If yes, Could you give me a hint? Thank you so much Chunhao -- View this message in context: http://www.nabble.com/Please-Help-pairwise.t.test%21%21-tp23992763p23992763.html Sent from the R help mailing list archive at Nabble.com. __ R-help

Re: [R] Error setting rowname if rowname currently NULL

2009-03-02 Thread Chunhao Tu
Hi, At the 1st step, you only assign a name for the 1st row. However, fred has 4 rows which mean you need to assign 4 rownames for these 4 rows. At the 2nd step, you only "CHANGE" the 1st rowname from 1 to APPLE If I am wrong please correct me. Thanks -Original Message- From: r-help-

[R] Help How to use a loop to do pair comparison

2009-02-23 Thread Chunhao Tu
+ result} > result [,1] [1,] "Small" [2,] "Small" [3,] NA I want to compare (1 vs. 2), (1 vs. 3), (2 vs.3) I know I miss something but I just can not get it work. Could anyone give me a hint? Appreciate, Chunhao [[alternative HTML ver

Re: [R] 3 curves / 1 plot

2008-10-02 Thread Chunhao Tu
(three calls to plot() erase the two first datasets). > Thank you very much. > Hi Michel, > Have you check ?plot. You could plot 1st data set then plot (2nd data set, > lty="b", add=TRUE) and then plot (3rd data set, lty="b", add=TRUE) then > you could ge

Re: [R] Bug or feature with finding a list element?

2008-10-01 Thread Chunhao Tu
Hi, I have tried this with R-2.7.2 then I got > alist[['goodbye']] NULL > alist[['hi']] NULL > alist[['hello']] [1] 10 The results make sense to me thus you might want to update your R version. chunhao B Fox wrote: > > This seems odd. When I tr

Re: [R] lapply where each list object has multiple parts

2008-10-01 Thread Chunhao Tu
Hi Eric, > data<-list(x1 <- c(0,1,2,3),x2 <- c(7,8),x3 <- c(2,6,6,8), x4 <- c(4,8)) > lapply(X=data, mean) [[1]] [1] 1.5 [[2]] [1] 7.5 [[3]] [1] 5.5 [[4]] [1] 6 Hope it helps Chunhao eric lee-8 wrote: > > Hi. I have a list where each object in the list has