Re: [R] Reading fixed column format

2006-09-13 Thread Gabor Grothendieck
I know you would prefer a 100% R solution but using the unix cut command (a Windows version is available in tools.zip at: http://www.murdoch-sutherland.com/Rtools/ ) is really easy. Maybe if you preprocessed it with that you could then use read.fwf. For example, look how easy it was to cut this

Re: [R] Reading fixed column format

2006-09-13 Thread Anupam Tyagi
Gabor Grothendieck ggrothendieck at gmail.com writes: C:\bincut -c2-3,6-8 a.dat 23678 23678 23678 Thanks. I think this will work. How do I redirect the output to a file on windows? Is there simple way to convert the cut command to a script on windows, because the entire command may not fit

Re: [R] Reading fixed column format

2006-09-13 Thread Anupam Tyagi
Barry Rowlingson B.Rowlingson at lancaster.ac.uk writes: None of these seem to read non-coniguous variables from columns; or may be I am missing something. read.fwf is not meant for large files according to a post in the archives. Thanks for the pointers. I have read the R data input and

[R] Of fixed column format (and more fixed mindsets)

2006-09-13 Thread arin basu
Message: 107 Date: Tue, 12 Sep 2006 05:25:09 -0400 From: Michael Kubovy [EMAIL PROTECTED] Subject: Re: [R] Reading fixed column format To: Anupam Tyagi [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=US-ASCII; delsp=yes;

Re: [R] Gnuplot epslatex format also in R?

2006-09-13 Thread Anupam Tyagi
Prof Brian Ripley ripley at stats.ox.ac.uk writes: R has an xfig driver, and AFAIK you can do this from xfig. Is there an xfig port for Windows, without cygwin? If so, I will be thankful for a pointer to the where it can be downloaded from. I have been looking for it for some time. Anupam.

[R] Transformation of a data frame

2006-09-13 Thread Des Callaghan
Dear R-helpers, Apologies in advance for this (probably) simple question. I've searched the R Archive and can't seem to find a solution to my problem. I have a data frame of vegetation quadrat data with the following format: Q S C 1 A 5 1 B 10 1 C 50 1 D 10 2 A 20 2 E 10 2 C 40 3 D 5 3 F 1 3

[R] Power analysis for repeated measures ANCOVA

2006-09-13 Thread Steve Su
Dear All, I wonder if anyone has written a code for power analysis with repeated measures ANCOVA? I am aware of the following reference: Frison L and Pocock SJ: Repeated Measures in Clinical Trials: analysis using mean summary statistics and its implications for design in Statistics in

[R] functions and strings

2006-09-13 Thread Robin Hankin
Hi If string - xyz f - function(x){1 + sin(cos(x)) + exp(x^2)} How do I manipulate string and f() to give the string 1 + sin(cos(xyz)) + exp(xyz^2) ? -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743

Re: [R] Transformation of a data frame

2006-09-13 Thread Dimitris Rizopoulos
one approach is to use reshape(), e.g., # suppose that 'dat' is your data.frame, then res - reshape(dat, direction = wide, idvar = Q, timevar = S) res[is.na(res)] - 0 res I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health

Re: [R] functions and strings

2006-09-13 Thread Romain Francois
Robin Hankin wrote: Hi If string - xyz f - function(x){1 + sin(cos(x)) + exp(x^2)} How do I manipulate string and f() to give the string 1 + sin(cos(xyz)) + exp(xyz^2) ? Hi, Here what i'll do : f - function(x){ sprintf(1 + sin(cos(%s)) + exp(%s^2), x, x) } Cheers, Romai --

Re: [R] functions and strings

2006-09-13 Thread Dimitris Rizopoulos
one approach could be the following strng - gsub(x, xyz, deparse(body(f))[2]) sub('^[[:space:]]+', '', strng) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven,

Re: [R] functions and strings

2006-09-13 Thread Robin Hankin
Hi Dmitris thanks for this but it's not quite right: f - function(x){sin(x)+exp(x)} strng - gsub(x, xyz, deparse(body(f))[2]) sub('^[[:space:]]+', '', strng) [1] sin(xyz) + exyzp(xyz) and I would want sin(xyz) + exp(xyz) On 13 Sep 2006, at 08:45, Dimitris Rizopoulos wrote: strng

Re: [R] wireplot margins and additional z-axis

2006-09-13 Thread Klaus Nordhausen
Dear Deepayan, sorry for not being clear - but my problem has nothing to do with the aspect. If I create the eps the following way library(lattice) plot.vol- wireframe(volcano, aspect = c(1,1.5), scales=list(arrows=F),zlab=list(Z-axis,rot=90)) postscript(example_plot_3.eps,

Re: [R] functions and strings

2006-09-13 Thread Dimitris Rizopoulos
yes you're right, maybe this is better f - function(x){sin(x)+exp(x)} strng - gsub((x), (xyz), deparse(body(f))[2], fixed = TRUE) sub('^[[:space:]]+', '', strng) [1] sin(xyz) + exp(xyz) Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health

[R] forcing levelplot to use relative cuts (ie cuts for each panel)

2006-09-13 Thread Mike Townsley
Dear guRus, I'm having trouble producing a levelplot with relative cuts for each panel (my data has large differences in scales, so I want to use quantiles for each panel). My attempts to change the 'at' argument in panel.levelplot function have not met with success. Below is a toy example.

Re: [R] Retrieving value computed in inner function call

2006-09-13 Thread Pablo Lewinger
Though not obvious at first the posting you pointed me too is very helpful indeed. Thanks a lot Gabor. Juan Pablo At 08:48 PM 9/12/2006 -0400, Gabor Grothendieck wrote: Check out: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/83547.html On 9/12/06, Juan Pablo Lewinger [EMAIL PROTECTED]

Re: [R] functions and strings

2006-09-13 Thread Robin Hankin
Hi Dmitris, Thierry, I'm getting there but it's still not quite right if f() includes something like x^2: f - function(x){exp(x^2)} gsub((x), (xyz), deparse(body(f))[2], fixed = TRUE) [1] x^2 [I don't care about the spaces] also, I can't quite see how to implement Thierry's

[R] R Matlab for Particle Tracking

2006-09-13 Thread Lorenzo Isella
Dear All, A question a bit outside statistics. In my group, a lot of people use Matlab for simple simulations of stochastic processes describing convection/diffusion problems (as long as the numerics does not get too expensive and one has to resort to C or Fortran). Leaving aside the theory, it

Re: [R] formatting data to be analysed using multinomial logistic regression (nnet)

2006-09-13 Thread sun
bump. would like to know the answer too. I am about using nnet--multinom to estimate a multinomial logit model, but are not sure if this function handles categorical data input. Thanks for any help. - Original Message - From: Bob Green [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch

[R] unexpected result in glm (family=poisson) for data with an only zero response in one factor

2006-09-13 Thread Antonin Ferry
Dear members, here is my trouble: My data consists of counts of trapped insects in different attractive traps. I usually use GLMs with a poisson error distribution to find out the differences between my traitments (and to look at other factor effects). But for some dataset where one traitment

Re: [R] functions and strings

2006-09-13 Thread Robin Hankin
Hello everyone I know it looks like I'm making heavy weather of this, but I don't think I communicated my problem properly. I really appreciate you guys' help here. I am writing a wrapper for a mathematical library to which I want to send character strings that it can execute, and then pass the

Re: [R] Test internet presence

2006-09-13 Thread mel
Gregor Gorjanc a écrit : If I summarize the thread there is (currently) no way to test for internet presence with a general approach. what about try(readLines(...)) ? (at least it works fine on Windows.) __ R-help@stat.math.ethz.ch mailing list

Re: [R] functions and strings

2006-09-13 Thread Rich FitzJohn
Hi, Perhaps try this (based on 'bquote'): rewrite.expression - function(expr, to, dep) { f - function(expr) { if ( length(expr) == 1 ) if ( expr == as.name(dep) ) as.name(to) else expr else as.call(lapply(expr, f)) } f(expr) } rewrite -

Re: [R] Gnuplot epslatex format also in R?

2006-09-13 Thread Paul Smith
On 9/12/06, Anupam Tyagi [EMAIL PROTECTED] wrote: R has an xfig driver, and AFAIK you can do this from xfig. Is there an xfig port for Windows, without cygwin? If so, I will be thankful for a pointer to the where it can be downloaded from. I have been looking for it for some time.

[R] R-question

2006-09-13 Thread Thorsten Muehge
Hello Colleagues, I programmed in SAS for 3 years and would like to switch to a not so costly software product. Hence I started to evaluate R, and my first test look promising. However I have some question: 1. Is it possible to query R files by SQL internally on data frames (not on a

[R] R CMD INSTALL with debugging

2006-09-13 Thread Patrick Connolly
I've run into a problem with lazy loading on a Linux system when trying to install the Matrix package (version 0.995-16) which didn't happen with version 0.995-2. The problem is not with a x86_64 system: it's a 32 bit machine, the exact description I don't have right now (R-2.3.1). The message

Re: [R] R-question

2006-09-13 Thread Jim Lemon
Thorsten Muehge wrote: Hello Colleagues, I programmed in SAS for 3 years and would like to switch to a not so costly software product. Hence I started to evaluate R, and my first test look promising. However I have some question: 1. Is it possible to query R files by SQL internally

Re: [R] functions and strings

2006-09-13 Thread Robin Hankin
Rich that is swet and does exactly what I want. Thank you very much. best wishes rksh On 13 Sep 2006, at 10:54, Rich FitzJohn wrote: Hi, Perhaps try this (based on 'bquote'): rewrite.expression - function(expr, to, dep) { f - function(expr) { if ( length(expr) == 1

Re: [R] Conservative ANOVA tables in lmer

2006-09-13 Thread Manuel Morales
On Wed, 2006-09-13 at 08:04 +1000, Andrew Robinson wrote: On Tue, September 12, 2006 7:34 am, Manuel Morales wrote: On Mon, 2006-09-11 at 11:43 -0500, Douglas Bates wrote: Having made that offer I think I will now withdraw it. Peter's example has convinced me that this is the wrong thing

Re: [R] Reading fixed column format

2006-09-13 Thread Duncan Murdoch
Anupam Tyagi wrote: Barry Rowlingson B.Rowlingson at lancaster.ac.uk writes: None of these seem to read non-coniguous variables from columns; or may be I am missing something. read.fwf is not meant for large files according to a post in the archives. Thanks for the pointers. I have read

Re: [R] Reading fixed column format

2006-09-13 Thread Barry Rowlingson
Anupam Tyagi wrote: There are 356,112 records, and 326 variables. It has a fixed record length of 1283 positions, therefore cut -b can not be used. Okay, thats 'large' enough to be awkward... It would be good to have a facility in R which defines the meta-data: labelling and structure of

Re: [R] Reading fixed column format

2006-09-13 Thread Barry Rowlingson
Barry Rowlingson wrote: If I had a spare day... Or if I'd just read Duncan's message about negative widths in read.fwf. Anyway, I've learnt about readLines() and seek() and reading zip files now, so I can read _anything_ Barry __

Re: [R] functions and strings

2006-09-13 Thread Peter Dalgaard
Robin Hankin [EMAIL PROTECTED] writes: Rich that is swet and does exactly what I want. Thank you very much. I just wonder whatever substitute() did to get ignored like that? substitute(1 + sin(cos(x)) + exp(x^2), list(x=quote(xyz))) 1 + sin(cos(xyz)) + exp(xyz^2)

Re: [R] unexpected result in glm (family=poisson) for data with an only zero response in one factor

2006-09-13 Thread vito muggeo
Dear Antonin, It is a statistical problem: the well-known monotone likelihood. In this case ML estimate does not exist (or equals infinity) and Wald approximations (ob which SE are based) does not hold. However LRT is valid and provides reliable results. As far as I know, the only software

Re: [R] Transformation of a data frame

2006-09-13 Thread hadley wickham
one approach is to use reshape(), e.g., # suppose that 'dat' is your data.frame, then res - reshape(dat, direction = wide, idvar = Q, timevar = S) res[is.na(res)] - 0 res You can also use the reshape package: library(reshape) datm - melt(dat, id=1:2) cast(datm, Q ~ S) See the introduction

[R] unexpected result in glm (family=poisson) for data with an only zero response in one factor

2006-09-13 Thread John Maindonald
The Wald statistics that are returned as z value can be a very rough approximation. The standard error is radically different, on a logarithmic scale, between log(mu) = -20.30 [the best glm() managed in approximating -infinity] and log(mu) + log(a) = -0.29. It is actually worse than

Re: [R] R-question

2006-09-13 Thread Anupam Tyagi
Thorsten Muehge MUEHGE at de.ibm.com writes: 1. Is it possible to query R files by SQL internally on data frames (not on a database) and how is the syntax (I have the RODBC package installed). It is possible to do similar things conceptually in R as in SQL---at least the basic SQL queries (I

[R] unexpected result in glm (family=poisson) for data with an only zero response in one factor

2006-09-13 Thread John Maindonald
PS. In part, the problem is with the use of the log link, arising because the limit of log(mu), as mu goes to 0, is minus infinity. This is not an appropriate scale on which to represent a fitted value that is zero. The estimated SE for a fitted value of zero should be 0. You will get

Re: [R] Reading fixed column format

2006-09-13 Thread Anupam Tyagi
Barry Rowlingson B.Rowlingson at lancaster.ac.uk writes: Or if I'd just read Duncan's message about negative widths in read.fwf. Anyway, I've learnt about readLines() and seek() and reading zip files now, so I can read _anything_ Thanks to everyone who answered my query. I have a

Re: [R] wireplot margins and additional z-axis

2006-09-13 Thread Richard M. Heiberger
Klaus Nordhausen: The plot is still not in the left bottom corner of the file. There is a lot of space below the outer box line. If I include this eps in latex it will also include this space and if I put for example the figure caption below it I have this huge gap between actual graph

[R] install R on Sun Blade 2000

2006-09-13 Thread David Hajage
Hello useRs, I would like to install R 2.3.1 on a computer : Sun Blade 2000. Is there a precompiled version of R for this computer ? Thank you very much. -- David [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list

Re: [R] wireplot margins and additional z-axis

2006-09-13 Thread Duncan Murdoch
On 9/13/2006 4:04 AM, Klaus Nordhausen wrote: Dear Deepayan, sorry for not being clear - but my problem has nothing to do with the aspect. If I create the eps the following way There is some ambiguity here. The aspect arg to wireframe controls the 3D aspect ratio. You want to control the

Re: [R] lattice cloud and conditional axis limits

2006-09-13 Thread Karl Ove Hufthammer
Deepayan Sarkar skreiv: cloud(z~x*y|s,scales=list(arrows=FALSE,relation=free)) However, it does not. Any ideas how I can make it work? There's no direct support, but you can write a small panel function with more or less the desired effect: Thank you so much. It works perfectly. -- Karl

Re: [R] install R on Sun Blade 2000

2006-09-13 Thread Brian Ripley
Without knowing your OS, it is hard to say. But if this is Solaris (the most likely OS), not to my knowledge. On Wed, 13 Sep 2006, David Hajage wrote: Hello useRs, I would like to install R 2.3.1 on a computer : Sun Blade 2000. Is there a precompiled version of R for this computer ?

Re: [R] rgl: exporting to pdf or png does not work

2006-09-13 Thread Ben Bolker
Daniel Franke franke.daniel at gmail.com writes: [This is a follow-up to the recent discussion on R-help] Hi all, I can reproduce both problems on gentoo (2006.0 profile), but not on OpenSuSE-10.1. Installed libraries: * Gentoo: R-2.2.1, rgl-0.67.2, OpenSuSE: R-2.3.1,

[R] printing a generated function crashes R

2006-09-13 Thread Mstislav Elagin
Dear All, the last expression in the following code snippet crashes R (version 2.3.1 on Windows XP) when run interactively: make.bad.function - function(kind) { zz - switch(kind, 1 = 1, 2 = 2) stopifnot( !is.null(zz) ) eval( bquote( function(x)

Re: [R] Reading fixed column format

2006-09-13 Thread Gabor Grothendieck
On 9/13/06, Anupam Tyagi [EMAIL PROTECTED] wrote: Gabor Grothendieck ggrothendieck at gmail.com writes: C:\bincut -c2-3,6-8 a.dat 23678 23678 23678 Thanks. I think this will work. How do I redirect the output to a file on windows? Same as on UNIX cut -c2-3,6-8 a.dat a2.dat Is

[R] input data format of multinom in nnet

2006-09-13 Thread sun
Hi, I 'd like to use multinom to estimate a multinomial logit model of a conjoint survey with a format like: individual 1 --choice -- X1-X2-X3 1-A1.2blue12 1-0-1.4red-13

[R] S in cor.test(..., method=spearman)

2006-09-13 Thread Dietrich Trenkler
Dear HelpeRs, I have some data: ice - structure(c(0.386, 0.374, 0.393, 0.425, 0.406, 0.344, 0.327, 0.288, 0.269, 0.256, 0.286, 0.298, 0.329, 0.318, 0.381, 0.381, 0.47, 0.443, 0.386, 0.342, 0.319, 0.307, 0.284, 0.326, 0.309, 0.359, 0.376, 0.416, 0.437, 0.548, 41, 56, 63, 68, 69,

Re: [R] R-question

2006-09-13 Thread Wensui Liu
For your 1st question, you can write query against the tables in DB using RODBC. Being a SAS programmer, I have to say that reporting function of R is not as good as that of SAS. On 9/13/06, Thorsten Muehge [EMAIL PROTECTED] wrote: Hello Colleagues, I programmed in SAS for 3 years and

Re: [R] S in cor.test(..., method=spearman)

2006-09-13 Thread Sundar Dorai-Raj
Dietrich Trenkler said the following on 9/13/2006 9:44 AM: Dear HelpeRs, I have some data: ice - structure(c(0.386, 0.374, 0.393, 0.425, 0.406, 0.344, 0.327, 0.288, 0.269, 0.256, 0.286, 0.298, 0.329, 0.318, 0.381, 0.381, 0.47, 0.443, 0.386, 0.342, 0.319, 0.307, 0.284, 0.326,

Re: [R] Gnuplot epslatex format also in R?

2006-09-13 Thread Greg Snow
There is a Java based implementation called jfig at: http://tams-www.informatik.uni-hamburg.de/applets/jfig/ that works on windows. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message-

Re: [R] R-question

2006-09-13 Thread Frank E Harrell Jr
Wensui Liu wrote: For your 1st question, you can write query against the tables in DB using RODBC. Being a SAS programmer, I have to say that reporting function of R is not as good as that of SAS. I beg to differ. See for example http://biostat.mc.vanderbilt.edu/StatReport Frank Harrell

Re: [R] R-question

2006-09-13 Thread Wensui Liu
well, Harrell, I understand sweave or R2html could be a solution. but please show me their applications in a large business setting. On the contrary, I can give you many such cases using SAS. On 9/13/06, Frank E Harrell Jr [EMAIL PROTECTED] wrote: Wensui Liu wrote: For your 1st question,

Re: [R] printing a generated function crashes R

2006-09-13 Thread Peter Dalgaard
Mstislav Elagin [EMAIL PROTECTED] writes: Dear All, the last expression in the following code snippet crashes R (version 2.3.1 on Windows XP) when run interactively: make.bad.function - function(kind) { zz - switch(kind, 1 = 1, 2 = 2)

Re: [R] R-question

2006-09-13 Thread Frank E Harrell Jr
Wensui Liu wrote: well, Harrell, I understand sweave or R2html could be a solution. but please show me their applications in a large business setting. On the contrary, I can give you many such cases using SAS. SAS requires much more coding than R/S-Plus to produce reports that are not

Re: [R] Gnuplot epslatex format also in R?

2006-09-13 Thread Anupam Tyagi
Greg Snow Greg.Snow at intermountainmail.org writes: There is a Java based implementation called jfig at: http://tams-www.informatik.uni-hamburg.de/applets/jfig/ that works on windows. Hope this helps, Thanks. Is there also a port of xv? It can be useful for some graphical output. I

Re: [R] Conservative ANOVA tables in lmer

2006-09-13 Thread Greg Snow
[snip] Douglas Bates wrote: Hmm - I'm not sure what confidence interval and what number of levels you mean there so I can't comment on that method. Suppose we go back to Spencer's example and consider if there is a signficant effect for the Nozzle factor. That is equivalent to the

[R] group bunch of lines in a data.frame, an additional requirement

2006-09-13 Thread Emmanuel Levy
Thanks for pointing me out aggregate, that works fine! There is one complication though: I have mixed types (numerical and character), So the matrix is of the form: A 1.0 200 ID1 A 3.0 800 ID1 A 2.0 200 ID1 B 0.5 20 ID2 B 0.9 50 ID2 C 5.0 70 ID1 One letter always has the same ID but one

Re: [R] R-question

2006-09-13 Thread Greg Snow
I don't believe that doing a direct SQL query on a native R object is currently possible, others have pointed out ways to do some of the things you would want SQL for using built-in R commands. If you really want to use SQL you could transfer the data frames you want to use to database tables,

Re: [R] Reading fixed column format

2006-09-13 Thread Jason Barnhart
Another possibility: 1) Split the original file into smaller chunks of xx,xxx of rows. 2) Process each file using read.fwf saving the requisite variables. (If necessary, save each intermediate matrix/data.frame to disk to conserve space) 3) 'rbind' the results. Not

[R] kendall's w

2006-09-13 Thread Bianca Vieru
Hi, I try to calculate Kendall's W coefficient and I have a bizarre error. little.app.mat-matrix(c(1,3,4,2,6,5,2,4,3,1,5,6,3,2,5,1,5,4),nrow=3,byrow=TRUE) print(kendall.w(little.app.mat[-1,])) Kendall's W for ordinal data W = 0.7753623Error in if (is.na(x$p.table)) { : argument is of

Re: [R] Reading fixed column format

2006-09-13 Thread Gabor Grothendieck
On 9/13/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: On 9/13/06, Anupam Tyagi [EMAIL PROTECTED] wrote: Gabor Grothendieck ggrothendieck at gmail.com writes: C:\bincut -c2-3,6-8 a.dat 23678 23678 23678 Thanks. I think this will work. How do I redirect the output to a file on

Re: [R] reshaping a dataset

2006-09-13 Thread Denis Chabot
Thank you Gabor, I'll need to explore a bit the reshape package to see what benefits I get compared with the basic reshape function, but I'm glad you made me aware of it. And your solution for fixing NAs just for the columns I want is just what I wanted. Many thanks, Denis Le 06-09-13 à

Re: [R] Gnuplot epslatex format also in R?

2006-09-13 Thread Richard M. Heiberger
xv has been available for windows for at least 10 years. http://download.mirror.ac.uk/sites/ftp.cis.upenn.edu/pub/xv/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] Access Rows in a Data Frame by Row Name

2006-09-13 Thread Michael Gormley
I have created a data frame using the read.table command. I want to be able to access the rows by the row name, or a vector of row names. I know that you can access columns by using the data.frame.name$col.name. Is there a way to access row names in a similar manner? [[alternative

Re: [R] Course***Dr Frank Harrell's Regression Modeling Strategies in R/Splus course *** September 2006 near you (San Francisco, Washington DC, Atlanta)

2006-09-13 Thread paul king
Anyone from Chicago area interested in this course? Please email XLSolutions so they can schedule it in Chicago. We ran out of travel budget in my company :( Date: Wed, 2 Aug 2006 13:20:23 -0700From: [EMAIL PROTECTED]: [S] Course***Dr Frank Harrell's Regression Modeling Strategies in R/Splus

Re: [R] group bunch of lines in a data.frame, an additional requirement

2006-09-13 Thread Marc Schwartz (via MN)
Try something like this: # Initial data frame DF V1 V2 V3 V4 1 A 1.0 200 ID1 2 A 3.0 800 ID1 3 A 2.0 200 ID1 4 B 0.5 20 ID2 5 B 0.9 50 ID2 6 C 5.0 70 ID1 # Now do the aggregation to get the means DF.1 - aggregate(DF[, 2:3], list(V1 = DF$V1), mean) DF.1 V1 V2 V3 1 A 2.0

Re: [R] group bunch of lines in a data.frame, an additional requirement

2006-09-13 Thread Gabor Grothendieck
See below. On 9/13/06, Emmanuel Levy [EMAIL PROTECTED] wrote: Thanks for pointing me out aggregate, that works fine! There is one complication though: I have mixed types (numerical and character), So the matrix is of the form: A 1.0 200 ID1 A 3.0 800 ID1 A 2.0 200 ID1 B 0.5 20 ID2

Re: [R] kendall's w

2006-09-13 Thread David Barron
I assume you are using the function in the concord package. This seems to happen because there is a different way of calculating the p-value depending on whether or not there are more than 7 cases. If there are 7 or less, the function doesn't work unless there are more than two rows. Here is the

Re: [R] Access Rows in a Data Frame by Row Name

2006-09-13 Thread Tony Plate
Matrix-style indexing works for both columns and rows of data frames. E.g.: x - data.frame(a=1:5, b=6:10, d=11:15) x a b d 1 1 6 11 2 2 7 12 3 3 8 13 4 4 9 14 5 5 10 15 x[2:4,c(1,3)] a d 2 2 12 3 3 13 4 4 14 Time spend reading the help document An Introduction to R will

[R] reformat records one to several

2006-09-13 Thread Steven Van Wilgenburg
Hi, I am a new user of R and am still trying to figure out which statements do which functions and am looking for a jump start. I have a dataset where the data were collected as ten minute counts where the number of new individuals within a species was recorded as cohorts within 3 separate

Re: [R] Access Rows in a Data Frame by Row Name

2006-09-13 Thread Berton Gunter
The answer is yes, you can access rows of a data.frame by rowname in the same way as columns, which you could have found by merely trying it. Don't overlook the value of a little experimentation as the fastest way to an answer. -- Bert Gunter Genentech -Original Message- From: [EMAIL

[R] Dear FE Harrell How can I get rreport ?

2006-09-13 Thread justin bem
Mr Harrell, After reading discussion about R output and SAS output , I will like to use rreport package. I a windows XP user Sincerly - Message d'origine De : Frank E Harrell Jr [EMAIL PROTECTED] À : Wensui Liu [EMAIL PROTECTED] Cc : Thorsten Muehge [EMAIL PROTECTED];

[R] Question about optim on survival data with censored data

2006-09-13 Thread Superdealhouse
I have a model which is mixed exponential model, with about 40 observations. I am wandering whether i can use the optim to optimized the parameters? Thank you very much. __ R-help@stat.math.ethz.ch mailing list

Re: [R] Conservative ANOVA tables in lmer

2006-09-13 Thread Andrew Robinson
On Wed, Sep 13, 2006 at 07:04:17AM -0400, Manuel Morales wrote: On Wed, 2006-09-13 at 08:04 +1000, Andrew Robinson wrote: On Tue, September 12, 2006 7:34 am, Manuel Morales wrote: On Mon, 2006-09-11 at 11:43 -0500, Douglas Bates wrote: Having made that offer I think I will now withdraw

Re: [R] About truncated distribution

2006-09-13 Thread Jenny Stadt
Inspired by the responses, I tried to do this analytically. The idea is that truncated mean and standard deviation could be expressed as integral forms. So if given truncated mean, sd and truncated point (mut, sdt, thre), an optim( ) function could be writen to get the parameters. But the

[R] recursive methods for concatenating sets of files

2006-09-13 Thread Warren
Hello, I would like to read sets of files within a folder, perhaps using recursive methods. Right now, I rename the files before import. It would be even better to do this without renaming files, without providing explicit filenames, perhaps by importing files based on chronology, and

[R] an error message with 't.test' with R under Unix

2006-09-13 Thread Tao Shi
Hi list,Could you please help me to explain the following error messages with 't.test' in R Unix 2.1.1? I don't see it in R under Windows (R 2.3.0) or Unix (R2.3.1). Is it really due to the different R versions?Thanks,...TaoUnix session: (R.2.1.1) R.version _

Re: [R] inserting columns in the middle of a dataframe

2006-09-13 Thread Jon Minton
Dear R users: Is there a built-in and simple way to insert new columns after other columns in a dataframe? I.e. currently I have: V1 V2 V3 V4 [1,] [2,] Etc. But I want V1 V5 V2 V3 V4 [1,] [2,] Etc. Can this be done in one line? Jon Minton

Re: [R] recursive methods for concatenating sets of files

2006-09-13 Thread jim holtman
Try this: setwd(d:/perf/windows) # wherever your data is results - list() for (i in list.files(pattern=t.*txt$)){ # need the 'pattern' of the names results[[i]] - read.delim(i, quote='', as.is=TRUE) } dataALL - do.call('cbind', results) write.table(dataALL,0905p528.txt, quote=FALSE) On

Re: [R] recursive methods for concatenating sets of files

2006-09-13 Thread Sebastian P. Luque
On Wed, 13 Sep 2006 13:53:45 -0700, Warren [EMAIL PROTECTED] wrote: Hello, I would like to read sets of files within a folder, perhaps using recursive methods. Maybe this: fv - list.files() lf - sapply(fv, read.delim, quote=, as.is=TRUE) xx - do.call(cbind, lf) You can find more info in

Re: [R] an error message with 't.test' with R under Unix

2006-09-13 Thread Peter Dalgaard
Tao Shi [EMAIL PROTECTED] writes: Hi list,Could you please help me to explain the following error messages with 't.test' in R Unix 2.1.1? This is completely unreadable! However, yes, there was at some point a bug where the LHS of model formulas was checked more rigorously than need be, using

Re: [R] inserting columns in the middle of a dataframe

2006-09-13 Thread Timothy Bates
Is there a built-in and simple way to insert new columns in a dataframe? You do this by collecting the columns in the new order you desire, and making a new frame. oldframe - data.frame(matrix(0:14,ncol=3)) newcol - data.frame(20:24) names(newcol) - newcol newframe

Re: [R] reformat records one to several

2006-09-13 Thread jim holtman
Try this: n - 10 # create some sample data x - data.frame(date=1:n, t1=sample(0:3, n, TRUE), t2=sample(0:3, n, TRUE), t3=sample(0:3, n, TRUE)) x # print data result - lapply(c('t1','t2','t3'), function(i){ xsub - x[rep(1:nrow(x), x[[i]]),] xsub$t1 - xsub$t2 - xsub$t3 - 0

Re: [R] inserting columns in the middle of a dataframe

2006-09-13 Thread David Barron
Another way is to use attach(dataframe) x1 - rep(1,10) x2 - rep(2,10) x3 - rep(3,10) x4 - rep(4,10) x5 - rep(5,10) dat - data.frame(x1,x2,x3,x4) rm(x1,x2,x3,x4) attach(dat) dat2 - data.frame(x1,x5,x2,x3,x4) detach(dat) On 13/09/06, Timothy Bates [EMAIL PROTECTED] wrote: Is there a

Re: [R] wireplot margins and additional z-axis

2006-09-13 Thread Deepayan Sarkar
On 9/13/06, Duncan Murdoch [EMAIL PROTECTED] wrote: On 9/13/2006 4:04 AM, Klaus Nordhausen wrote: Dear Deepayan, sorry for not being clear - but my problem has nothing to do with the aspect. If I create the eps the following way There is some ambiguity here. The aspect arg to

Re: [R] inserting columns in the middle of a dataframe

2006-09-13 Thread Christos Hatzis
See ?append -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jon Minton Sent: Wednesday, September 13, 2006 5:14 PM To: r-help@stat.math.ethz.ch Cc: 'Jon Minton' Subject: Re: [R] inserting columns in the middle of a dataframe Dear R users:

Re: [R] an error message with 't.test' with R under Unix

2006-09-13 Thread Tao Shi
Hi Peter, Thank you for the reply! Really sorry for the formating (forgot to change to plain text). Here is basically what I'm talking about: R.version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu

Re: [R] inserting columns in the middle of a dataframe

2006-09-13 Thread Jon Minton
Thanks, but isn't that only for elements in vectors? I think I've found the following method to work: e.g. for df - data.frame(v1,v2,v3,v4) use: df - data.frame(df[1:2],v5,df[-c(1:2)]) I *believe* this is the one-line solution I was looking for. Can anyone see why this wouldn't work? Jon

Re: [R] Reading fixed column format

2006-09-13 Thread Steve Miller
How about using python/perl/ruby, designed precisely for this type of routine data munging, to pipe the processed output into an R dataframe? msci - read.table(pipe(python steve/python/msci.py), header=T, as.is=T) Iteratively, you could deliver the python output in chunks, something like:

Re: [R] forcing levelplot to use relative cuts (ie cuts for each panel)

2006-09-13 Thread Deepayan Sarkar
On 9/13/06, Mike Townsley [EMAIL PROTECTED] wrote: Dear guRus, I'm having trouble producing a levelplot with relative cuts for each panel (my data has large differences in scales, so I want to use quantiles for each panel). My attempts to change the 'at' argument in panel.levelplot

Re: [R] inserting columns in the middle of a dataframe

2006-09-13 Thread Christos Hatzis
Sorry, I guess I did not explain at all how append could work in a one-liner: data.frame(df, v5)[append(1:4,5,2)] Your method is fine as well. The above might be more flexible if you need a more general solution, e.g. if you wanted to make it a function. -Christos -Original Message-

[R] lme for time series prediction

2006-09-13 Thread Markus Loecher
Could anyone give me a simple example how to use lme() for t time series prediction/modeling ? I understand the concept of longitudinal data and have read the book by Pinheiro but still have a difficult time for the (simpler) case of no grouped data. I am dealing with the case of predicting a

Re: [R] lme for time series prediction

2006-09-13 Thread Andrew Robinson
Hello Mark, it's quite possible that someone can do this. However, you should try to help us as much as possible by providing commented, minimal, self-contained, reproducible code. What are you trying to do? In what way is it not working? Etc. Cheers Andrew On Wed, Sep 13, 2006 at

[R] building R-2.3.1 on Solaris 10

2006-09-13 Thread Greg Dunkel
Sun has modified the standard gcc to provide better support for Sun's thread. They used it to build OpenSolaris and it is available under the standard GPL license, ie, it is free. I could build R-2.2.1 with the standard gcc, but I needed to use the gcc from Sun to build 2.3.x. I am not

Re: [R] Access Rows in a Data Frame by Row Name

2006-09-13 Thread Anupam Tyagi
I hope this helps. x - data.frame(a=1:5, b=6:10, d=11:15) x a b d 1 1 6 11 2 2 7 12 3 3 8 13 4 4 9 14 5 5 10 15 # access row with name a. This does not work. x$a [1] 1 2 3 4 5 # access column with name d x$d [1] 11 12 13 14 15 x$row.names NULL attributes(x) $names [1] a b d

Re: [R] inserting columns in the middle of a dataframe

2006-09-13 Thread Anupam Tyagi
I think it should be possible to create the column at the end and then use order on the columns names and indexes to only change the order of column indexes, rather than having to do operations on the data itself (which will be very time consuming if the dataset is large). Perhaps people with

Re: [R] Dear FE Harrell How can I get rreport ?

2006-09-13 Thread Anupam Tyagi
justin bem justin_bem at yahoo.fr writes: Mr Harrell, After reading discussion about R output and SAS output , I will like to use rreport package. I a windows XP user Sincerly See: http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/Rreport Anupam.

[R] Adding predicted values as a new variable in a data frame

2006-09-13 Thread Robi Ragan
I am running a regression: ols.reg1 - lm(y ~ x1 + x2 + x3 + x4) on a data.frame and then generating fitted values: y.hat - ols.reg1$fitted.values Then I would like to add these fitted values to the data.frame as a new variable. The problem is that when the values are predicted the resulting

  1   2   >