[R] sin(pi)?

2007-09-03 Thread Nguyen Dinh Nguyen
Dear all, I found something strange when calculating sin of pi value sin(pi) [1] 1.224606e-16 pi [1] 3.141593 sin(3.141593) [1] -3.464102e-07 Any help and comment should be appreciated. Regards Nguyen Nguyen Dinh Nguyen Garvan Institute of Medical Research

[R] Simulation of logistic equation

2007-08-21 Thread Nguyen Dinh Nguyen
. Any help is highly appreciated. Regard, Nguyen Nguyen Dinh Nguyen Bone and Mineral Research Program Garvan Institute of Medical Research St Vincent's Hospital 384 Victoria Street, Darlinghurst Sydney, NSW 2010 Australia Tel; 61-2-9295 8274 Fax: 61-2

[R] Legend on graph

2007-08-13 Thread Nguyen Dinh Nguyen
Hi Akki, Then you may need to increase y-axis scale by ylim=c(min,max) Cheers Nguyen On 8/12/07, akki [EMAIL PROTECTED] wrote: Hi, I have a problem when I want to put a legend on the graph. I do: legend(topright, names(o), cex=0.9, col=plot_colors,lty=1:5, bty=n) but the legend is writen

[R] Subject: transform excel data into graph

2007-07-09 Thread Nguyen Dinh Nguyen
Is this you want? library(gplots) n -(0.465,0.422,0.45,0.59,0.543,0.498,0.44,0.35,0.64,0.5,0.473,0.134,0.543,0. 11,0.32) graph - matrix(n, nrow=5, ncol=3) colnames(graph) - c(Nick, John, Peter) rownames(graph) - c(Lesson1,Lesson2,Lesson3, Lesson4,Lesson5) g - barplot2(graph, beside = TRUE,

[R] Incidence estimated from Kaplan-Meier

2007-07-05 Thread Nguyen Dinh Nguyen
Nguyen Dinh Nguyen, Bone and Mineral Research Program Garvan Institute of Medical Research St Vincent's Hospital 384 Victoria Street, Darlinghurst Sydney, NSW 2010 Australia Tel; 61-2-9295 8274 Fax: 61-2-9295 8241 E-mail: [EMAIL PROTECTED] [[alternative HTML version deleted

[R] draw two plots on a single panel

2007-05-09 Thread Nguyen Dinh Nguyen
Hi Pat, Certainly you can But you need to provide more details, will advise closely In general, first you plot the “frame” without plotting like this plot(range(data1$x1,data2$x2), range(data1$y1,data2$y2), type=’n’) # means just plotting a frame with xaxis ranges from x1-x2 and y from y1-y2,

[R] Deming regression

2007-04-05 Thread Nguyen Dinh Nguyen
Dear R helpers, I would like to know whether there is any package in R for Deming regression? Many thanks Nguyen __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Generate a serie of new vars that correlate with existing var

2007-04-03 Thread Nguyen Dinh Nguyen
Dear Greg, Thanks million! As good as it gets :) All the best Nguyen -Original Message- From: Greg Snow [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 04, 2007 1:46 AM To: Nguyen Dinh Nguyen; r-help@stat.math.ethz.ch Subject: RE: [R] Generate a serie of new vars that correlate

Re: [R] Create a new var reflecting the order of subjects in existing var

2007-04-02 Thread Nguyen Dinh Nguyen
Dear R users, Followings are summary the solutions for my question. All the way to Roma! But vote #1 for Jim, the simplest solution. Thank you all of you for yours quick response Regards Nguyen # I have a data set sth like this: set.seed(123);dat - data.frame(ID= c(rep(1,2),rep(2,3),

[R] Generate a serie of new vars that correlate with existing var

2007-04-01 Thread Nguyen Dinh Nguyen
Dear R helpers, I have a var (let call X1) with approximately Normal distribution (say, mean=15, SD=5). I want to generate a series of additional vars X2, X3, X4…such that the correlation between X2 and X1 is o.4, X3 and X1 is 0.5, X4 and X1 is 0.6 and so on with the condition all variables X2,

[R] Create a new var reflecting the order of subjects in existing var

2007-04-01 Thread Nguyen Dinh Nguyen
Dear R helpers I have a data set sth like this: set.seed(123);dat - data.frame(ID= c(rep(1,2),rep(2,3), rep(3,3), rep(4,4), rep(5,5)), var1 =rnorm(17, 35,2), var2=runif(17,0,1)) dat ID var1 var2 1 1 33.87905 0.02461368 2 1 34.53965 0.47779597 3

Re: [R] Create a new var reflecting the order of subjects in existingvar

2007-04-01 Thread Nguyen Dinh Nguyen
Dear Christos, Works beautifully Many thanks Nguyen -Original Message- From: Christos Hatzis [mailto:[EMAIL PROTECTED] Sent: Monday, April 02, 2007 12:11 PM To: 'Nguyen Dinh Nguyen'; r-help@stat.math.ethz.ch Subject: RE: [R] Create a new var reflecting the order of subjects

[R] abline within data range

2007-03-20 Thread Nguyen Dinh Nguyen
Dear R helpers, I would like to have abline, for a lm model for example, lying within data range. Do you know how to get it? Thank in advance Nguyen D Nguyen #CODE x- rnorm(200, 35,5) y- rnorm(200, 0.87,0.12) plot(y~x, xlim=c(0,50), pch=17, bty=l) abline(lm(y~x)) # I would like abline is

Re: [R] abline within data range

2007-03-20 Thread Nguyen Dinh Nguyen
/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Nguyen Dinh Nguyen [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Tuesday, March 20, 2007 12:32 PM Subject: [R] abline within data range Dear R helpers, I would like to have abline, for a lm

Re: [R] abline within data range

2007-03-20 Thread Nguyen Dinh Nguyen
Dear all Rhelpers, Thank you all for quick and helpful response. Question: How to get the abline lying within the data range? Suggested solutions: ## 1- base graphics (suggested by Dimitris and Uwe) x- rnorm(200, 35,5) y- rnorm(200, 0.87,0.12) plot(y~x, xlim=c(0,55), pch=17, bty=l) lmObj -

[R] Highlight overlapping area between two curves

2007-03-12 Thread Nguyen Dinh Nguyen
Dear R helpers, I have a graph as following; I would like to highlight the overlapping area between the two curves. Do you know how to do this? Thank you in advance for your help. Nguyen ###START x1 - rnorm(1, 0.70,0.12) x2 - rnorm(1, 0.90,0.12) d1 - density(x1) d2 - density(x2)

Re: [R] How to plot two graphs on one single plot?

2007-02-24 Thread Nguyen Dinh Nguyen
Hi Yun, try this. x1 - rnorm(1, 0.5,0.4018) x2 - rnorm(1, 0.01919,0.3969) d1 - density(x1) d2 - density(x2) plot(range(d1$x,d2$x), range(d1$y, d2$y), type = n, xlab = X, ylab = Y ) lines(d1, col = blue,lwd=2) lines(d2, col = red,lwd=2) Cheers Nguyen -Original Message-

[R] Competing risk nomogram

2006-11-06 Thread Nguyen Dinh Nguyen
Dear R Users, Do you have a sample code for developing a nomogram with competing-risks? Any help is appreciated. Kind regards, ND Nguyen __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

[R] Update new version

2006-08-31 Thread Nguyen Dinh Nguyen
Dear R helpers, I would like to update R 2.2.1 to the latest version, How can I do it without loosing all my installed packages? Many thanks Nguyen __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the