[R] nlme with a factor in R 2.4.0beta

2006-09-25 Thread Christian Ritz
Hi, the following R lines work fine in R 2.4.0 alpha (and older R versions), but not in R 2.4.0 beta (details below): library(drc) # to load the dataset 'PestSci' library(nlme) ## Starting values sv - c(0.328919, 1.956121, 0.097547, 1.642436, 0.208924) ## No error m1 - nlme(SLOPE ~ c +

Re: [R] contrasts in aov

2006-09-25 Thread Christoph Buser
Dear John ?ordered will help you. Regards, Christoph Buser -- Christoph Buser [EMAIL PROTECTED] Seminar fuer Statistik, LEO C13 ETH Zurich 8092 Zurich SWITZERLAND phone: x-41-44-632-4673 fax: 632-1228

[R] Initialising Mersenne-Twister with one integer

2006-09-25 Thread Gad Abraham
Hi, It seems to me that the Mersenne-Twister PRNG can be initialised using one integer instead of 624 integers, since inside RNG.c code there's a function defined as MT_sgenrand(Int32). How do I actually set this seed within R? I've tried: .Random.seed - c(3, 1) runif(1) Error in

Re: [R] Initialising Mersenne-Twister with one integer

2006-09-25 Thread Prof Brian Ripley
On Mon, 25 Sep 2006, Gad Abraham wrote: Hi, It seems to me that the Mersenne-Twister PRNG can be initialised using one integer instead of 624 integers, since inside RNG.c code there's a function defined as MT_sgenrand(Int32). How do I actually set this seed within R? set.seed(), on the

Re: [R] Lattice strip labels for two factors

2006-09-25 Thread Rafael Duarte
Dear Gabor and Deepayan, Many thanks for your help. I used suggestion 3 from Gabor (it worked well with my long df ) and will try Deepayan's suggestion. Rafael Deepayan Sarkar wrote: On 9/23/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: 1. You can write a custom strip function:

Re: [R] nlme with a factor in R 2.4.0beta

2006-09-25 Thread Peter Dalgaard
Christian Ritz [EMAIL PROTECTED] writes: Hi, the following R lines work fine in R 2.4.0 alpha (and older R versions), but not in R 2.4.0 beta (details below): library(drc) # to load the dataset 'PestSci' library(nlme) ## Starting values sv - c(0.328919, 1.956121, 0.097547,

Re: [R] behavior of [-.foo

2006-09-25 Thread Prof Brian Ripley
I've not seen an actual answer to this, which is that this is a misunderstanding as to how NextMethod works. First, + x - unclass(x) looks wrong. NextMethod uses the next method at the call to the generic, and subsequent changes to the object 'x' do not alter the class that would be

[R] Beginner question: select cases

2006-09-25 Thread Peter Wolkerstorfer - CURE
Hello all, I hope i chose the right list as my question is a beginner-question. I have a data set with 3 colums London, Rome and Vienna - the location is presented through a 1 like this: London RomeVienna q1 0 0 1 4 0 1 0

Re: [R] Beginner question: select cases

2006-09-25 Thread ONKELINX, Thierry
Your problem would be a lot easier if you coded the location in one variable instead of three variables. Then you could calculate the means with one line of code: by(results$q1, results$location, mean) With your dataset you could use by(results$London, results$location, mean) by(results$Rome,

Re: [R] Beginner question: select cases

2006-09-25 Thread Doran, Harold
Peter, There is a much easier way to do this. First, you should consider organizing your data as follows: set.seed(1) # for replication only # Here is a sample dataframe tmp - data.frame(city = gl(3,10, label = c(London, Rome,Vienna )), q1 = rnorm(30)) # Compute the means with(tmp,

[R] Selfstarting models for soil hydrology using R

2006-09-25 Thread CHRISTIAN OMUTO
Dear, I have developed and tested some models in soil hydrology with NLME library in R. I want to ask if it could be possible to submit this to the NLME library (with sample data) as a toolbox or something so that anyone downloading new components of new versions of R may simply call (say

[R] Beginner Loop Question with dynamic variable names

2006-09-25 Thread Peter Wolkerstorfer - CURE
Dear all, I have another small scripting-beginner problem which you hopefully can help: I compute new variables with: # Question 1 results$q1 - with(results, q1_1*1+ q1_2*2+ q1_3*3+ q1_4*4+ q1_5*5) # Question 2 results$q2 - with(results, q2_1*1+ q2_2*2+ q2_3*3+ q2_4*4+ q2_5*5) # Question 3

[R] Multiple imputation using mice with mean

2006-09-25 Thread Eleni Rapsomaniki
Hi I am trying to impute missing values for my data.frame. As I intend to use the complete data for prediction I am currently measuring the success of an imputation method by its resulting classification error in my training data. I have tried several approaches to replace missing values: -

Re: [R] Beginner question: select cases

2006-09-25 Thread John Kane
--- Peter Wolkerstorfer - CURE [EMAIL PROTECTED] wrote: Hello all, I hope i chose the right list as my question is a beginner-question. I have a data set with 3 colums London, Rome and Vienna - the location is presented through a 1 like this: LondonRomeVienna q1 0

Re: [R] Beginner Loop Question with dynamic variable names

2006-09-25 Thread David Barron
I think this does what you are looking for: dta - data.frame(q1_1=rep(1,5),q1_2=rep(2,5),q2_1=rep(3,5),q2_2=rep(4,5)) for (i in 1:2) { e1 - paste(q,i,_1 + q,i,_2 * 2,sep=) assign(paste(q,i,sep=),with(dta,eval(parse(text=e1 } On 25/09/06, Peter Wolkerstorfer - CURE [EMAIL

[R] glmmPQL in 2.3.1

2006-09-25 Thread Justin Rhodes
Dear R-help, I recently tried implementing glmmPQL in 2.3.1, and I discovered a few differences as compared to 2.2.1. I am fitting a regression with fixed and random effects with Gamma error structure. First, 2.3.1 gives different estimates than 2.2.1, and 2.3.1, takes more iterations to

Re: [R] Beginner Loop Question with dynamic variable names

2006-09-25 Thread Dimitris Rizopoulos
- Original Message - From: David Barron [EMAIL PROTECTED] To: Peter Wolkerstorfer - CURE [EMAIL PROTECTED]; r-help r-help@stat.math.ethz.ch Sent: Monday, September 25, 2006 3:33 PM Subject: Re: [R] Beginner Loop Question with dynamic variable names I think this does what you are

Re: [R] plotting grouped data object

2006-09-25 Thread Afshartous, David
Hello Xiaohui, data.grp is just a pseudo example of a grouped data object that is grouped according the factor y. I just tried your suggestion, but the result is that three separate panels are still created, whereas I would like to have all 3 lines in a single panel. cheers, dave

Re: [R] Multiple imputation using mice with mean

2006-09-25 Thread Ted Harding
On 25-Sep-06 Eleni Rapsomaniki wrote: Hi I am trying to impute missing values for my data.frame. As I intend to use the complete data for prediction I am currently measuring the success of an imputation method by its resulting classification error in my training data. I have tried

[R] RE : Beginner question: select cases

2006-09-25 Thread justin bem
Hi, subset function is use to select rows of a dataframe. just compute mean(results$q1) without subset instruction, or mean(results[,4]) Peter Wolkerstorfer - CURE [EMAIL PROTECTED] a écrit : Hello all, I hope i chose the right list as my question is a beginner-question.

[R] F values for glm with binomial distribution

2006-09-25 Thread andre tavares correa dias
Hi Rneters, I'm running a GLM model with a full factorial design in blocks and binomial error distribution. I would like to have the F values for this model but I got a message that using F test with a binomial family is inappropriate in: anova.glm(model, test = F). Should I not report F

[R] Best use of LaTeX listings package for pretty printing R code

2006-09-25 Thread Frank E Harrell Jr
This is what I have been using. Does anyone have a better way? In particular I would like to see letters in comment strings not stretched so much. Thanks -Frank \documentclass{article} \usepackage{listings,relsize} \lstloadlanguages{R} \newcommand{\lil}[1]{\lstinline|#1|} \begin{document}

[R] Splitting a character variable into a numeric one and a character one?

2006-09-25 Thread Frank Duan
Hi All, I have a data with a variable like this: Column 1 123abc 12cd34 1e23 ... Now I want to do an operation that can split it into two variables: Column 1Column 2 Column 3 123abc 123 abc 12cd34 12cd34 1e23 1

Re: [R] Splitting a character variable into a numeric one and a character one?

2006-09-25 Thread Marc Schwartz (via MN)
On Mon, 2006-09-25 at 11:30 -0500, Marc Schwartz (via MN) wrote: On Mon, 2006-09-25 at 11:04 -0500, Frank Duan wrote: Hi All, I have a data with a variable like this: Column 1 123abc 12cd34 1e23 ... Now I want to do an operation that can split it into two variables:

Re: [R] Splitting a character variable into a numeric one and a character one?

2006-09-25 Thread Gabor Grothendieck
Here is one more solution: library(gsubfn) s - c(123abc, 12cd34, 1e23) out - gsubfn(^([[:digit:]]+)(.*), paste, s, backref = -2) read.table(textConnection(out)) It assumes there are no spaces in the strings. If there are then choose a sep= that does not appear and do this: sep = , f -

[R] Sampling distribution of correlation estimations derived from robust MCD and MVE methods

2006-09-25 Thread Uri Hasson
Dear R users, I am trying to use MCD and MVE methods in the analysis of functional imaging (fMRI) data. But, before doing that, I want to understand the sampling distribution of the correlation parameter given by MCD and MVE (cov.mcd$cor, cov.mve$cor). To this end, I conducted a simulation where

Re: [R] Splitting a character variable into a numeric one and a character one?

2006-09-25 Thread Gabor Grothendieck
strapply in package gsubfn can do that: library(gsubfn) s - c(123abc, 12cd34, 1e23) out - strapply(s, ^([[:digit:]]+)(.*), c) out - do.call(rbind, out) # as a matrix data.frame(x = out[,1], num = as.numeric(out[,2]), char = out[,3]) # as a data.frame On 9/25/06, Frank Duan [EMAIL PROTECTED]

Re: [R] Splitting a character variable into a numeric one and a character one?

2006-09-25 Thread Gabor Grothendieck
And here is a third solution not using package gsubfn: s - c(123abc, 12cd34, 1e23) out - gsub(^(([[:digit:]]+)(.*)), \\1 \\2 \\3, s) read.table(textConnection(out), as.is = TRUE) Again, if spaces appear in the input string choose a character not appearing, such as comma, and do it like this: s

Re: [R] Splitting a character variable into a numeric one and a character one?

2006-09-25 Thread Marc Schwartz (via MN)
On Mon, 2006-09-25 at 11:04 -0500, Frank Duan wrote: Hi All, I have a data with a variable like this: Column 1 123abc 12cd34 1e23 ... Now I want to do an operation that can split it into two variables: Column 1Column 2 Column 3 123abc 123

[R] paste? 'cmd /c c:\\pheno\\whap --file c:\\pheno\\smri --alt 1'

2006-09-25 Thread Boks, M.P.M.
Dear R users, This command works (calling a programm -called whap- with file specifiers etc.): system('cmd /c c:\\pheno\\whap --file c:\\pheno\\smri --alt 1 --perm 500', intern=TRUE) Now I need to call it from a loop to replace the 1 by different number, however I get lost using the

Re: [R] Splitting a character variable into a numeric one and a character one?

2006-09-25 Thread Barry Rowlingson
Now I want to do an operation that can split it into two variables: Column 1Column 2 Column 3 123abc 123 abc 12cd34 12cd34 1e23 1 e23 ... So basically, I want to split the original variabe

[R] Passing R connection as argument to a shell command on Windows

2006-09-25 Thread Anupam Tyagi
Hello, is there a way to pass a connection to a file in a zipped archive as argument (instead of a file name of unzipped file) to shell command cut. In general, is it possible to pipe output of a R function to a shell command? How? I want to do something like: z = unz(zipArchive.zip,

Re: [R] Splitting a character variable into a numeric one and a character one?

2006-09-25 Thread Frank Duan
Great! That's exactly what I want. Thanks a lot, FD On 9/25/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: strapply in package gsubfn can do that: library(gsubfn) s - c(123abc, 12cd34, 1e23) out - strapply(s, ^([[:digit:]]+)(.*), c) out - do.call(rbind, out) # as a matrix

Re: [R] plotting grouped data object

2006-09-25 Thread Deepayan Sarkar
On 9/23/06, Afshartous, David [EMAIL PROTECTED] wrote: All, I'd like to plot the main relationship of a grouped data object for all levels of a factor in a single panel. The sample code below creates a separate panel for each level of the factor. I realize that this could be done in other

Re: [R] Passing R connection as argument to a shell command on Windows

2006-09-25 Thread Mike Nielsen
No, the cut command won't understand that z is an R connection and not a file in the current working directory: there is no overlap between the R object name space and the Windows object name space. Unfortunately, you may be forced to unzip to a temporary file, and then read from that. One thing

[R] Can't mix high level and low level plot functions.

2006-09-25 Thread Lothar Botelho-Machado
Hey R-Comunity, I'd like to print out an histogram of some experimental data and add a smooth curve of a normal distribution with an ideally generated population having the same mean and standard deviation like the experimental data. The experimental data is set as vector x and its name is set

Re: [R] Can't mix high level and low level plot functions.

2006-09-25 Thread Duncan Murdoch
On 9/25/2006 1:56 PM, Lothar Botelho-Machado wrote: Hey R-Comunity, I'd like to print out an histogram of some experimental data and add a smooth curve of a normal distribution with an ideally generated population having the same mean and standard deviation like the experimental data.

Re: [R] Adding percentage to Pie Charts

2006-09-25 Thread Anupam Tyagi
Gabor Grothendieck ggrothendieck at gmail.com writes: It might also be nice to be able to align the fans at the left or right, not just the center. Fans that open only on one side: A line that moves like the minute needle of an analog clock; with zero at the top. Movement of the needle in

[R] [PlainText Attempt] Sampling distribution of correlation estimations derived from robust MCD and MVE methods

2006-09-25 Thread Uri Hasson
Dear R users, I am trying to use MCD and MVE methods in the analysis of functional imaging (fMRI) data. But, before doing that, I want to understand the sampling distribution of the correlation parameter given by MCD and MVE (cov.mcd$cor, cov.mve$cor). To this end, I conducted a simulation where

[R] Unidentified warning message in Portuguese

2006-09-25 Thread Alberto Monteiro
What is the meaning of this message? Warning message: Realizando coerção de LHD para uma lista I tried to do something like this: test - function(x) { rval - NULL m - mean(x) s - sd(x) rval$m - m rval$s - s y - x[abs(x - m) 3 * s] rval$y - y # this is the critical line

Re: [R] Can't mix high level and low level plot functions.

2006-09-25 Thread Marc Schwartz (via MN)
On Mon, 2006-09-25 at 19:56 +0200, Lothar Botelho-Machado wrote: Hey R-Comunity, I'd like to print out an histogram of some experimental data and add a smooth curve of a normal distribution with an ideally generated population having the same mean and standard deviation like the

Re: [R] paste? 'cmd /c c:\\pheno\\whap --file c:\\pheno\\smri --alt 1'

2006-09-25 Thread Marc Schwartz (via MN)
On Mon, 2006-09-25 at 18:58 +0200, Boks, M.P.M. wrote: Dear R users, This command works (calling a programm -called whap- with file specifiers etc.): system('cmd /c c:\\pheno\\whap --file c:\\pheno\\smri --alt 1 --perm 500', intern=TRUE) Now I need to call it from a loop to

Re: [R] Best use of LaTeX listings package for pretty printing R code

2006-09-25 Thread Vincent Goulet
Le Lundi 25 Septembre 2006 09:31, Frank E Harrell Jr a écrit : This is what I have been using. Does anyone have a better way? In particular I would like to see letters in comment strings not stretched so much. Thanks -Frank \documentclass{article} \usepackage{listings,relsize}

[R] Rows of a data frame to matrix

2006-09-25 Thread Damian Betebenner
useRs, I have a data frame where four of the columns of the data frame represent the values of a two-by-two matrix. I'd like to, row-by-row, go through the data frame and use the four columns, in matrix form, to perform calculations necessary to create new values for variables in the data

Re: [R] Rows of a data frame to matrix

2006-09-25 Thread Gabor Grothendieck
Using the builtin 11x8 anscombe data frame here are some alternatives: # 1 # list of 2x2 matrices lapply(split(anscombe[1:4], 1:nrow(anscombe)), matrix, 2) # 2 # 2x2x11 array array(t(anscombe[1:4]), c(2, 2, nrow(anscombe))) # 3 # to create matrix and perform calculations, e.g. det, all in one

Re: [R] Beginner Loop Question with dynamic variable names

2006-09-25 Thread Mike Nielsen
Is this what you had in mind? j-data.frame(q1=rnorm(10),q2=rnorm(10)) j q1 q2 1 -0.9189618 -0.2832102 2 0.9394316 1.1345975 3 -0.6388848 0.6850255 4 0.4938245 -0.5825715 5 -1.2885257 -0.2654023 6 -0.5278295 0.2382791 7 0.6517268 0.8923375 8 0.4124178

Re: [R] plotting grouped data object

2006-09-25 Thread Afshartous, David
thanks! -Original Message- From: Deepayan Sarkar [mailto:[EMAIL PROTECTED] Sent: Monday, September 25, 2006 1:34 PM To: Afshartous, David Cc: r-help@stat.math.ethz.ch Subject: Re: [R] plotting grouped data object On 9/23/06, Afshartous, David [EMAIL PROTECTED] wrote: All, I'd like

Re: [R] paste? 'cmd /c c:\\pheno\\whap --file c:\\pheno\\smri --alt 1'

2006-09-25 Thread Gabor Grothendieck
Use single outer quotes so that the inner double quotes are not interpreted as the end of the string. cmd - 'cmd /c ...whatever... ' system(cmd, intern = TRUE) On 9/25/06, Boks, M.P.M. [EMAIL PROTECTED] wrote: Dear R users, This command works (calling a programm -called whap- with file

Re: [R] Can't mix high level and low level plot functions.

2006-09-25 Thread Lothar Botelho-Machado
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Thanks for your help!! I appreciate, now it works perfectly. Lothar Rubusch Duncan Murdoch wrote: On 9/25/2006 1:56 PM, Lothar Botelho-Machado wrote: Hey R-Comunity, I'd like to print out an histogram of some experimental data and add a

Re: [R] fraitly in coxph

2006-09-25 Thread Terry Therneau
For a nested model you want to use the coxme function, which is the much superior successor to frailty(). It is currently found in the kinship library. Terry Therneau __ R-help@stat.math.ethz.ch mailing list

[R] Sort problem with merge (again)

2006-09-25 Thread Bruce LaZerte
# R version 2.3.1 (2006-06-01) Debian Linux testing # Is the following behaviour a bug, feature or just a lack of # understanding on my part? I see that this was discussed here # last March with no apparent resolution. d - as.factor(c(1970-04-04,1970-08-11,1970-10-18)) x - c(9,10,11) ch -

Re: [R] Sort problem with merge (again)

2006-09-25 Thread Gabor Grothendieck
If you want it to act like a date store it as a Date: dx - as.Date(c(1970-04-04,1970-08-11,1970-10-18)) ### x - c(9,10,11) ch - data.frame(Date=dx,X=x) dy - as.Date(c(1970-06-04,1970-08-11,1970-08-18)) ### y - c(109,110,111) sp - data.frame(Date=dy,Y=y) merge(ch, sp, all = TRUE) By the way you

Re: [R] Creating Movies with R

2006-09-25 Thread Gregor Gorjanc
Hello! J.R. Lockwood lockwood at rand.org writes: An alternative that I've used a few times is the jpg() function to create the sequence of images, and then converting these to an mpeg movie using mencoder distributed with mplayer. This works on both windows and linux. I have a pretty

Re: [R] Splitting a character variable into a numeric one and a character one?

2006-09-25 Thread Gabor Grothendieck
Here is a slight simplification of the strapply solution using simplify = TRUE library(gsubfn) s - c(123abc, 12cd34, 1e23) out - t(strapply(s, ^([[:digit:]]+)(.*), c, simplify = TRUE)) # matrix data.frame(x = out[,1], num = as.numeric(out[,2]), char = out[,3]) On 9/25/06, Gabor Grothendieck

Re: [R] Best use of LaTeX listings package for pretty printing R code

2006-09-25 Thread Anupam Tyagi
Frank E Harrell Jr f.harrell at vanderbilt.edu writes: This is what I have been using. Does anyone have a better way? In particular I would like to see letters in comment strings not stretched so much. Thanks -Frank It may be possible to pass on all comments to a verbatim like

[R] linear terms within a nonlinear model

2006-09-25 Thread Ben Bolker
I have a complicated nonlinear function, myfun(a,b,c), that I want to fit to data, allowing one or more of the parameters a, b, and c in turn to have linear dependence on other covariates. In other words, I'd like to specify something like nls(y~myfun(a,b,c),linear=list(a~f1,b~1,c~1)) I

Re: [R] linear terms within a nonlinear model

2006-09-25 Thread Christian Ritz
Hi, the contributed package 'drc' allows specification of non-linear regression models with individual parameter models that include covariates. For an example see section 8 the accompanying paper in J. Statist. Software (http://www.jstatsoft.org/v12/i05/v12i05.pdf). Christian