[R] how to handle a longitudinal data

2007-01-27 Thread gallon li
i have a data set with repeated measures on same people, structure like below: id x1 x2 ... 001 10 20 ... 001 8 45 ... 001 4 2 ... 002 002 ... 002 002 003 ... what is the easist way to show how many observations for each subject id? [[alternative HTML version

Re: [R] how to handle a longitudinal data

2007-01-27 Thread Chuck Cleland
gallon li wrote: i have a data set with repeated measures on same people, structure like below: id x1 x2 ... 001 10 20 ... 001 8 45 ... 001 4 2 ... 002 002 ... 002 002 003 ... what is the easist way to show how many observations for each subject id? If

[R] Fwd: how to handle a longitudinal data

2007-01-27 Thread gallon li
actually there are too many subjects. is there a way that i can make a table such that it can tell me the frequency of number of observations? Like 3 4 5 30 40 60 which means there are 30 subjects which each has 3 obs., 40 which each has 4 obs. On 1/27/07, Chuck Cleland

Re: [R] Package for phylogenetic tree analyses

2007-01-27 Thread Ramon Diaz-Uriarte
Dear Lalitha, On 1/26/07, lalitha viswanath [EMAIL PROTECTED] wrote: Hi I am looking for a package that 1. reads in a phylogenetic tree in NEXUS format 2. given two members/nodes on the tree, can return the distance between the two using the tree. I came across the following packages on

[R] unequal number of observations for longitudinal data

2007-01-27 Thread gallon li
i have a large longitudinal data set. The number of observations for each subject is not the same across the sample. The largest number of a subject is 5 and the smallest number is 1. now i want to make each subject to have the same number of observations by filling zero, e.g., my original sample

Re: [R] unequal number of observations for longitudinal data

2007-01-27 Thread Chuck Cleland
gallon li wrote: i have a large longitudinal data set. The number of observations for each subject is not the same across the sample. The largest number of a subject is 5 and the smallest number is 1. now i want to make each subject to have the same number of observations by filling zero,

Re: [R] unequal number of observations for longitudinal data

2007-01-27 Thread Gabor Grothendieck
merge.zoo in the zoo package has an n-way merge supporting zero fill: library(zoo) DF - data.frame(id = c(1, 1, 1, 2, 2, 2, 2, 2, 3, 3), x = c(10, 30, 20, 10, 20, 40, 80, 70, 20, 40)) as.data.frame(do.call(merge, c(lapply(unstack(DF, x ~ id), zoo), fill = 0))) # last line can alternately be f

Re: [R] unequal number of observations for longitudinal data

2007-01-27 Thread gallon li
Two questions: 1. How do I replace NA with 0? 2. How can I sort the observations by their id instead of by time? (actually i can see what you produced is automatically sorted by id; but in my case, the output data is sorted by time) On 1/27/07, Chuck Cleland [EMAIL PROTECTED] wrote: gallon li

Re: [R] unequal number of observations for longitudinal data

2007-01-27 Thread Chuck Cleland
gallon li wrote: Two questions: 1. How do I replace NA with 0? df.long2$x - replace(df.long2$x, is.na(df.long2$x), 0) ?replace 2. How can I sort the observations by their id instead of by time? (actually i can see what you produced is automatically sorted by id; but in my case, the

Re: [R] unequal number of observations for longitudinal data

2007-01-27 Thread gallon li
what if i want to order within each id by their time? is there such an option? (right now some observation at time 100 were placed before 50 b/c R treated 1 first) On 1/27/07, Chuck Cleland [EMAIL PROTECTED] wrote: gallon li wrote: Two questions: 1. How do I replace NA with 0?

[R] Does inverse function exist

2007-01-27 Thread phwang2000
Hi, I wrote a simple derivative program (ftest=deriv(y~x^2, c(x), function(x){} )) I put (ftest=deriv(y~x^2, c(x), function(x){} ))(1) which return 2 which is correct. however, if I want the output to be 0 and hopefully a new inverse function can take in output (2) and return x=1. Can this

[R] when i compile 2.4.1 in linux ,i got the message

2007-01-27 Thread xiaopeng hu
configure: error: --with-readline=yes (default) and headers/libs are not available then i cannot make. why? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] CGIwithR and visible output of 'invisible(capture.output(library(...)))'

2007-01-27 Thread Leo Gürtler
Eric schrieb: library(R2HTML, verbose = FALSE) Dear Eric, thanks - I tried that, but that does not work for me. And it does not depend whether R2HTML is loaded via script/ batch job (- webserver, cgi) or directly within R. The same happens (of course) by using require(R2HTML, quietly=TRUE)

Re: [R] Does inverse function exist

2007-01-27 Thread Prof Brian Ripley
Inverting a linear function is easy, and more generally functions need not be invertible. But uniroot() is very helpful in finding an inverse of a monotonic function, and the idea is used in some of the qx functions. On Fri, 26 Jan 2007, [EMAIL PROTECTED] wrote: Hi, I wrote a simple

Re: [R] CGIwithR and visible output of 'invisible(capture.output(library(...)))'

2007-01-27 Thread Prof Brian Ripley
This is done by .onLoad, so your settings are irrelevant. We have no information here on your platform, version of R, R2HTML or anything else. But almost certainly the problem is the command given by getOption(unzip), which looks like an unzip clone not respecting the -q flag. Try using the

Re: [R] Fwd: how to handle a longitudinal data

2007-01-27 Thread Douglas Bates
On 1/27/07, gallon li [EMAIL PROTECTED] wrote: actually there are too many subjects. is there a way that i can make a table such that it can tell me the frequency of number of observations? Like 3 4 5 30 40 60 which means there are 30 subjects which each has 3 obs., 40

[R] Unbalanced design help

2007-01-27 Thread Michael Kubovy
Dear r-helpers, I am looking at a designed experiment in which one predictor variable has 5 levels (0, ..., 4) and the other has 6 levels (1.1, ..., 1.6), with 33 observations per cell. This design was given to 13 subjects. 0 1 2 3 4 1.1 32 33 0 0 0 1.2 33 33 33 0 0

[R] Canging the type of point points sizein plots..

2007-01-27 Thread vinod gullu
I want to plot variation of more than one variable in single plot with different point types and points sizes . Can someone help me to do that, Thanks in advance. vinod Now that's room service! Choose from

Re: [R] Canging the type of point points sizein plots..

2007-01-27 Thread talepanda
try: plot(1:10,pch=1:10,cex=1:10) pch specifies the types and cex specifies the sizes of symbols. On 1/28/07, vinod gullu [EMAIL PROTECTED] wrote: I want to plot variation of more than one variable in single plot with different point types and points sizes . Can someone help me to do that,

Re: [R] Canging the type of point points sizein plots..

2007-01-27 Thread Dimitris Rizopoulos
try this x1 - rnorm(10); y1 - rnorm(10) x2 - rnorm(10); y2 - rnorm(10) x3 - rnorm(10); y3 - rnorm(10) # plot(range(x1, x2, x3), range(y1, y2, y3), type = n) points(x1, y1, pch = 1, cex = 1, col = 1) points(x2, y2, pch = 2, cex = 2, col = 2) points(x3, y3, pch = 3, cex = 3, col =

[R] Conditional Selection of Columns for Tables

2007-01-27 Thread Mark Hempelmann
Dear Wizards - Thank you so much for your help. That was exactly what I was looking for. Now, I have been working on conditional selection of columns in a data frame. My goal is to calculate the total revenue per sales representative per status in a table. I have come to a complete

Re: [R] Conditional Selection of Columns for Tables

2007-01-27 Thread Gabor Grothendieck
Try these: aggregate(DF[4], DF[c(3,5)], sum) xtabs(revenue ~ status + name, DF) library(doBy) summaryBy(revenue ~ status + name, data = DF, FUN = sum) On 1/27/07, Mark Hempelmann [EMAIL PROTECTED] wrote: Dear Wizards - Thank you so much for your help. That was exactly what I was

[R] gsub regexp question

2007-01-27 Thread Phillimore, Albert
Dear R Users, I am trying to users gsub to remove multiple cases of square brackets and their different contents in a character string. A sample of such a string is shown below. However, I am having great difficulty understanding regexp syntax. Any help is greatly appreciated. Ally tree

Re: [R] CGIwithR and visible output of 'invisible(capture.output(library(...)))'

2007-01-27 Thread Leo Gürtler
Prof Brian Ripley schrieb: Dear Prof Ripley, thanks for your information, in my first email I mentioned that I use Version 2.3.1 (2006-06-01) on ubuntu edgy. Sorry for leaving out the version-no. 1.1.2.3-13ubuntu2, together with R2HTML 1.58, installed directly from R via 'install.packages()'.

Re: [R] gsub regexp question

2007-01-27 Thread Charilaos Skiadas
On Jan 27, 2007, at 3:41 PM, Phillimore, Albert wrote: Dear R Users, I am trying to users gsub to remove multiple cases of square brackets and their different contents in a character string. A sample of such a string is shown below. However, I am having great difficulty understanding

Re: [R] CGIwithR and visible output of 'invisible(capture.output(library(...)))'

2007-01-27 Thread Prof Brian Ripley
I would not try uninstalling anything. The binary used is set via getOption(unzip), and that in turn is set at R configure time and recorded in R_HOME/etc/Renviron. I have R_UNZIPCMD=${R_UNZIPCMD-'/usr/bin/unzip'} there. So you can alter that or set the environment variable in some other

Re: [R] CGIwithR and visible output of 'invisible(capture.output(library(...)))'

2007-01-27 Thread Dirk Eddelbuettel
On 27 January 2007 at 22:12, Leo Gürtler wrote: | Prof Brian Ripley schrieb: | | Dear Prof Ripley, | | thanks for your information, in my first email I mentioned that I use | Version 2.3.1 (2006-06-01) on ubuntu edgy. Sorry for leaving out the | version-no. 1.1.2.3-13ubuntu2, together with

Re: [R] %*% in Matrix objects

2007-01-27 Thread Jose Quesada
Hi Martin, Thanks for your detailed answer. x - Matrix(1:12, 3,4, sparse = TRUE) I hope that you are aware of the fact that it's not efficient at all to store a dense matrix (it has *no* 0 entry) as a sparse one.. and your posting is indeed an incentive for the Matrix developers to improve that

[R] Adding lines to xYplot

2007-01-27 Thread Michael Kubovy
I am using xYplot to plot data and CIs. How do I add several lines to the figure? _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall

[R] Problems terminating RGui on Windows

2007-01-27 Thread jim holtman
I am running R2.4.1 under Windows. version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 4.1 year 2006 month 12 day18 svn rev40228 language

[R] Biostrings

2007-01-27 Thread qing
Dear All, I am a beginner in learning the package of Biostrings currently and for practice doing an example. library(Biostrings); dnaAlph-new(BioPatternAlphabet,DNAAlphabet(),c(N=AGCT, + B=CGT,D=AGT,H=ACT,K=GT,M=AC,R=AG,S=CG, + V=ACG,W=AT,Y=CT)); Error in getClass(Class, where =

Re: [R] Adding lines to xYplot

2007-01-27 Thread Bernd Weiss
Am 27 Jan 2007 um 20:13 hat Michael Kubovy geschrieben: To: r-help@stat.math.ethz.ch list r- [EMAIL PROTECTED] From: Michael Kubovy [EMAIL PROTECTED] Date sent: Sat, 27 Jan 2007 20:13:15 -0500 Subject:[R] Adding lines to xYplot

[R] ratio optimization with quadratic form

2007-01-27 Thread Patrick Wang
Hi, All I have a function f(y) = (x'Ax + 2yx'a_i+y^2*a_ii)/(x'Bx + 2yx'b_i+y^2*b_ii), where A and B are known square matrix, a_i are the ith row of matrix A, a_ii are the ith row/column element of matrix A. what can I do to find a y to minize/maximize the ratio? Do optimize function? can I do