[R] help
Please, is there any R-list about survival package ? Thanks Mauricio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] mca id numbers
Is it possible to make disappear the id numbers from scatter.dudi (mc analysis) ? a - as.factor(c(1, 2, 3, 2, 1)) b - as.factor(c(3, 2, 3, 1, 1)) x - as.factor(c(1, 2, 2, 1, 3)) y - as.factor(c(2, 2, 3, 1, 1)) dat - data.frame(a=a, b=b,x=x,y=y) summary(dat) dat require(ade4) dat.acm - dudi.acm(dat, scann = FALSE, nf = 2) scatter.dudi(dat.acm) Thank you very much ! Mauricio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] factors and mca
Hi ! Wonder if I have this code below: a - c(1, 2, 3, 2, 1) b - c(3, 2, 3, 1, 1) d -as.factor(a) e -as.factor(b) table(d,e) is.factor(a) is.factor(b) is.factor(d) is.factor(e) de - factor(c(d,e)) is.factor(de) require(MASS) mca(de) I'd like to perform a correspondence analysis, but I can't understand why the message error after mca. Aren't those (d and e) factors as is.factors shows ? Erro em mca(de) : all variables must be factors I'm running R 2.3.0 under windows XP Thank you ! Mauricio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] sample matrix
Please, I´d like to store this sample matrix as a new object. How can I do this ? pulse - c(67, 67, 68, 68, 68, 69, 69, 69, 69, 69, 70, 70, 70, 70, 71, 71, 72, 72, 73, 74) m - NULL x - 0 for (i in 1:5) { x - sample(pulse,3) m - mean(x) cat(x,m,\n) } Thanks, Mauricio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] sample matrix as a new object
Please, I´d like to store this sample matrix as a new object. How can I do this ? pulse - c(67, 67, 68, 68, 68, 69, 69, 69, 69, 69, 70, 70, 70, 70, 71, 71, 72, 72, 73, 74) m - NULL x - 0 for (i in 1:5) { x - sample(pulse,3) m - mean(x) cat(x,m,\n) } Thanks, Mauricio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] correct rate
Hi everone ! I know its not a epidemiologic or statistic list, but since I´m using R to solve related problems ... here it goes: This is a code to solve the rate problem, but the real question is: what´s the correct way to calculate the period rate (3 years period put together) The third option is quite different (middle period). Any suggestions ? Thanks Mauricio, Brazil # Example from Field epidemiology basics computer lab 1 # annual period rates (1989, 1990, 1991) years - 1989:1991 deaths - c(125, 130, 131) pop - c(361975, 361401, 366613) # rates and rates per 10.000 per year rates - deaths/pop ratesf - round(rates*1,digits=2) rates ratesf # to calculate the period rate we have 3 possibilities: # 1) sum of deaths by sum of populations: rates89_91_1 - sum(deaths)/sum(pop) rates89_91f_1 - round(rates89_91_1*1,digits=2) rates89_91_1 rates89_91f_1 # 2) mean rates: rates89_91_2 - (rates[1]+rates[2]+rates[3])/3 rates89_91f_2 - round(rates89_91_2*1,digits=2) rates89_91_2 rates89_91f_2 # 3) sum of deahts by middle population (1990): rates89_91_3 - (deaths[1]+deaths[2]+deaths[3])/pop[2] rates89_91f_3 - round(rates89_91_3*1,digits=2) rates89_91_3 rates89_91f_3 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] npmc package
Hi Does anyone know where is the package: npmc (Nonparametric Multiple Comparisons). I found the reference on R Site Search, but not the package itself on CRAN as suggested. Thanks Mauricio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] npmc package
So, is there another package to substitute those functions described on ORPHANED npmc package ? Regards, Mauricio Brazil Uwe Ligges escreveu: Carlos Mauricio Cardeal Mendes wrote: Hi Does anyone know where is the package: npmc (Nonparametric Multiple Comparisons). I found the reference on R Site Search, but not the package itself on CRAN as suggested. The packages is ORPHANED and removed from the CRAN main repository. You can get older versions from the archives, though: your-CRAN-mirror/src/contrib/Archive/N/npmc_1.0-1.tar.gz Uwe Ligges Thanks Mauricio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] if() command
Ok Petr, I run your suggestion and I got this message: age-sample(seq(10,50,10), 20, replace=T) if (age =10) {group - 1} else if (age 10 age = 20) {group - 2} else {group - 3} Warning message: the condition has length 1 and only the first element will be used in: if (age = 10) { What does it means ? And when I look to the database I have no new classification ! Could you help please ? Mauricio Petr Pikal escreveu: Hallo On 13 Sep 2005 at 10:29, Carlos Maurício Cardeal Mende wrote: Hi everyone ! Could you please help me with this problem ? I´ve trying to write a code that assign to a variable the content from another, but all I´ve got is a message error. For example: if (age =10) {group == 1} else if (age 10 age = 20) {group == 2} else {group == 3} if you put your statement on one line it works (at least it does not give you syntax error) but the result is hardly what you really expect age-sample(seq(10,50,10), 20, replace=T) if (age =10) {group - 1} else if (age 10 age = 20) {group - 2} else {group - 3} if (age =10) {group == 1} else if (age 10 age = 20) {group == 2} else {group == 3} Maybe you want something like group-as.numeric(cut(age,c(0,10,20,100))) but it is only guess HTH Petr Syntax error Or if (age =10) {group == 1} else (age 10 age = 20) {group == 2} else {group == 3} Syntax error I know that is possible to find the solution by ifelse command or even recode command, but I´d like to use this way, because I can add another variable as a new condition and I believe to expand the possibilites. Thanks, Mauricio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.10.21/96 - Release Date: 10/9/2005 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] if() command
Hello reid ! About your third explanation, could you please write the complete code including that option: a loop ? Forgiveme, I'm trying to learn R and my mind is full of other statistical program syntax. And I'd like very very much to improve my knowledge using R and maybe contribute to someone, someday, somehow. Thanks, again Mauricio Huntsinger, Reid escreveu: First, == is logical comparison, so if you want to create a variable based on both age and group you can do that. However, it looks like you want to define the variable group, so you want to use - or = for that. Second, if you're typing this at a command prompt, you need to make sure you tell R you're not finished when it looks like you could be. There are several ways to do this. One is to put everything inside braces; another is to deliberately leave lines incomplete, like if (age = 10) { group - 1 } else { if (age = 20) { group - 2 } else group - 3 } Third, this will work for a vector of length 1. If you want to take a vector age and produce a corresponding vector group, you'll need to put this in a loop, or use lapply, or some iteration. Fourth, you can also write the above as group - if (age = 10) 1 else if (age = 20) 2 else 3 that is, if() returns a value you can assign. Finally, besides ifelse you can use cut for this particular task. Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Carlos Maurício Cardeal Mendes Sent: Tuesday, September 13, 2005 9:29 AM To: r-help@stat.math.ethz.ch Subject: [R] if() command Hi everyone ! Could you please help me with this problem ? I´ve trying to write a code that assign to a variable the content from another, but all I´ve got is a message error. For example: if (age =10) {group == 1} else if (age 10 age = 20) {group == 2} else {group == 3} Syntax error Or if (age =10) {group == 1} else (age 10 age = 20) {group == 2} else {group == 3} Syntax error I know that is possible to find the solution by ifelse command or even recode command, but I´d like to use this way, because I can add another variable as a new condition and I believe to expand the possibilites. Thanks, Mauricio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Notice: This e-mail message, together with any attachments...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Proportions again
Hello. I asked before and it was great, cause as a beginner I learned a lot. But, if I have this in R (1 and 2 are codes for sex): sex-c(1,2,2,1,1,2,2,2) sex [1] 1 2 2 1 1 2 2 2 I´d like to obtain the proportion according to sex.So I type: prop.table(sex) [1] 0.07692308 0.15384615 0.15384615 0.07692308 0.07692308 0.15384615 0.15384615 [8] 0.15384615 The result is OK, but I expected to see a simple frequency table or something like that: 1 0.375 2 0.625 1.0 How can I get this ? Thank you very much [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html