Re: [R] Ordinal logistic regression p-values

2011-08-29 Thread Rune Haubo
There is also clm() (for cumulative link models) from package ordinal that has much the same interface that polr() has, but it does give you p-values for the regression parameters. A simple example from examples(clm): library(ordinal) data(wine) fm1 <- clm(rating ~ contact + temp, data=wine) (summ

Re: [R] Saving a graph

2011-08-29 Thread Prof Brian Ripley
On Mon, 29 Aug 2011, Dieter Menne wrote: Gang Chen-4 wrote: However, my problem is that the file generated from a graph of fixed size is too large (in the order of 10MB) because of many data points in multiple scatterplots. Any suggestions? Generate pdf, open and save it in Adobe Acrobat w

Re: [R] How do I get a weighted frequency table?

2011-08-29 Thread Luca Meyer
Thank you, that's works just fine. Luca Il giorno 29/ago/2011, alle ore 23.48, H. T. Reynolds ha scritto: > Hi, > > I use xtabs with the weight variable on the left hand side of the formula as > in > > xtabs(weight ~ opinion + gender + ...) __ R-h

Re: [R] Creating ODS RTF-style output in R XXXX

2011-08-29 Thread Dieter Menne
Dan Abner wrote: > > I have been using the sink() function as follows: > > x<-rnorm(100) > sink("C:\\Users\\dan\\Desktop\\Current Events\\myhw.txt", > append=TRUE,split=TRUE) > m1<-c(Mean=mean(x),SD=sd(x),Min=min(x),Max=max(x)) > m1 > sink() > > === > > Is it possible to create tabular style

Re: [R] Saving a graph

2011-08-29 Thread Dieter Menne
Gang Chen-4 wrote: > > However, my problem is that the file generated > from a graph of fixed size is too large (in the order of 10MB) because of > many data points in multiple scatterplots. Any suggestions? > Generate pdf, open and save it in Adobe Acrobat which does a compression when the set

Re: [R] R - Web - Interfaces

2011-08-29 Thread Dieter Menne
Marie Duarte wrote: > > Is anybody able to recommend packages to provide GUI like behaviour to > interface with R that would facilitate, eg. > * Rotatable surface plots (similar to LiveGraphics3D for mathematica, > http://www.vis.uni-stuttgart.de/~kraus/LiveGraphics3D/examples/color_volumes.html

[R] Plotting multiple vectors in one window?

2011-08-29 Thread Caitlin
Hi all. Using the following code: plot(bsa, abs, col='blue', pch=16, xlim=c(0, 25), ylim=c(0.0, 1.0), xlab = expression(paste(BSA, " (", mu, "g)", sep="")), ylab=expression(A[595])) plot(unknown1, abs2, col='blue', pch=16, xlim=c(0, 25), ylim=c(0.0, 1.0), xlab = expression(paste(Unknown_1, " (",

Re: [R] Simulating distribution of max of two die

2011-08-29 Thread Jeff Newmiller
Why not d <- ifelse( d1 > d2, d1, d2 ) or d <- pmax( d1, d2 ) ? Apply operations may seem "beautiful", but I think the speed and simplicity of vectorized operations are truly beautiful. --- Jeff Newmiller The . .

[R] Simulating distribution of max of two die

2011-08-29 Thread Jaap van Wyk
Hallo I am teaching a very elementary intro course about R, and want to show the students how to find the distribution of the maximum of rolling two balanced die. Is there perhaps a more elegant way to do this, other than the way I am using below? (I would like to show them two ways - the

Re: [R] weird apply() behavior

2011-08-29 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Heikki Kaskelma > Sent: Monday, August 29, 2011 6:13 PM > To: r-h...@stat.math.ethz.ch > Subject: Re: [R] weird apply() behavior > > "array chip": > >Hi, I had a weird results fr

[R] Help me with repeated measures

2011-08-29 Thread Carlos Neftaly Lozano
Hello, I'm fitting a repeated measures models, I don't know many things about it, I need to help me with the model's graphic representation, and checking the assumptions. My data set haves a cuantitative response variable and a factor with 5 levels, this variable was measured three times each 20

Re: [R] character vector to text with returns

2011-08-29 Thread Bert Gunter
Is something like this what you want? x <- letters[1:4] x y <-do.call(paste,c( paste('"',x[1]), as.list(x[2:3]), paste(x[4],'"'),sep="\n")) y cat(y,"\n") -- Bert On Mon, Aug 29, 2011 at 6:59 PM, Ben qant wrote: > Unfortunately that didn't work. I just says the text is an invalid argument. > I

[R] Conditional plots in the soiltexture package

2011-08-29 Thread samuel-rosa
Dear R users I'd like to know if it is possible to create conditional plots in the soiltexture package. I have data from the particle size distribution of soils derived from two parent materials and I want to use the parent material as conditioner. Thanks a lot. Alessandro Samuel-Rosa Post-Gradu

Re: [R] weird apply() behavior

2011-08-29 Thread Heikki Kaskelma
"array chip": >Hi, I had a weird results from using apply(). Consider: y<-data.frame(list(a=c(1,NA), b=c('2k','0'))) do.call(args=y, Vectorize(v=c("a","b"), function(a,b) if(is.na(z<-b=="2k" & a==1)) 0 else z+0)) Heikki Kaskelma Munkkiniemi _

[R] R - Web - Interfaces

2011-08-29 Thread Marie Duarte
Hi, The information on the following link concerning web interfaces to R appears outdated: http://cran.r-project.org/doc/FAQ/R-FAQ.html#R-Web-Interfaces Is anybody able to recommend packages to provide GUI like behaviour to interface with R that would facilitate, eg. * Rotatable surface plots (si

Re: [R] Avoiding Biplot Labels Overllaping

2011-08-29 Thread samuel-rosa
Dear Rodrigo The best thing to do is to label manually the points in the biplot. To do so you have to use the following comand: > text(location, "text to place") *location* can be an x,y coordinate. Alternatively, the text can be placed interactively via mouse by specifying location as *locator(

Re: [R] character vector to text with returns

2011-08-29 Thread Jeff Newmiller
Perhaps you need to conform to the conventions mandated by RFC 2822 section 2.1 for record separators. Most libraries automatically handle this for you, but perhaps your rJython library does not. --- Jeff Newmiller The .

Re: [R] character vector to text with returns

2011-08-29 Thread Ben qant
Unfortunately that didn't work. I just says the text is an invalid argument. I also tried saving it in a variable name and passed that in, but that didn't work. I get: Error in ls(envir = envir, all.names = private) : invalid 'envir' argument ...when I try to send the message. Any other ideas?

Re: [R] Ordinal logistic regression p-values

2011-08-29 Thread Frank Harrell
Use the rms package to replace Design. Run anova(fit object from lrm) which produces a matrix from which you can extract P-values. This also handles the case of multiple degrees of freedom per predictor. Frank Debs Majumdar wrote: > > Hi, > >    Are there any packages which prints out p-values

Re: [R] weird apply() behavior

2011-08-29 Thread array chip
Thanks Bill and David! John - Original Message - From: William Dunlap To: array chip ; "r-help@r-project.org" Cc: Sent: Monday, August 29, 2011 5:21 PM Subject: RE: [R] weird apply() behavior apply() should come with a big warning that it was written for matrices and can cause a lo

Re: [R] weird apply() behavior

2011-08-29 Thread David Winsemius
On Aug 29, 2011, at 8:17 PM, David Winsemius wrote: On Aug 29, 2011, at 8:02 PM, array chip wrote: Hi, I had a weird results from using apply(). Here is an simple example: y<-data.frame(list(a=c(1,NA),b=c('2k','0'))) y a b 1 1 2k 2 NA 0 apply(y,1,function(x){x<-unlist(x);

Re: [R] weird apply() behavior

2011-08-29 Thread William Dunlap
apply() should come with a big warning that it was written for matrices and can cause a lot of surprises with data.frames. apply(X, ...) converts X to a matrix and that is the kernel of your problem: if any columns of X are not numeric then as.matrix(X) is a character matrix whose columns are made

[R] Creating ODS RTF-style output in R XXXX

2011-08-29 Thread Dan Abner
Hello everyone, I have been using the sink() function as follows: x<-rnorm(100) sink("C:\\Users\\dan\\Desktop\\Current Events\\myhw.txt", append=TRUE,split=TRUE) m1<-c(Mean=mean(x),SD=sd(x),Min=min(x),Max=max(x)) m1 sink() === Is it possible to create tabular style output very much like the OD

Re: [R] weird apply() behavior

2011-08-29 Thread David Winsemius
On Aug 29, 2011, at 8:02 PM, array chip wrote: Hi, I had a weird results from using apply(). Here is an simple example: y<-data.frame(list(a=c(1,NA),b=c('2k','0'))) y a b 1 1 2k 2 NA 0 apply(y,1,function(x){x<-unlist(x); That is quite unnecessary since apply coerces the r

[R] weird apply() behavior

2011-08-29 Thread array chip
Hi, I had a weird results from using apply(). Here is an simple example: > y<-data.frame(list(a=c(1,NA),b=c('2k','0'))) > y     a b 1  1   2k 2 NA   0 > apply(y,1,function(x){x<-unlist(x); if (!is.na(x[2]) & x[2]=='2k' & > !is.na(x[1]) & x[1]=='1') 1 else 0} ) This should print "1 0" as ou

Re: [R] character vector to text with returns

2011-08-29 Thread Henrique Dallazuanna
Try: paste(c("a", "b", "c"), collapse = "\n") On Mon, Aug 29, 2011 at 8:56 PM, Ben qant wrote: > Hello, > > Does anyone know how to convert this: > > msg > [1] "a" > [2] "b" > [3] "c" > > > To: > > > msg > "a > b > c" > > In other words, I need to convert a character vector to a single str

[R] character vector to text with returns

2011-08-29 Thread Ben qant
Hello, Does anyone know how to convert this: > msg [1] "a" [2] "b" [3] "c" To: > msg "a b c" In other words, I need to convert a character vector to a single string with carriage returns for each row. Functionally, I'm attempting to send an email of a character vector in a way that is re

[R] Ordinal logistic regression p-values

2011-08-29 Thread Debs Majumdar
Hi,    Are there any packages which prints out p-values for OLR's (like `ologit' from Stata)? I want to run a bunch of OLRs and print the p-value for the first coefficient from each of them.   I checked polr() under MASS and it doesn't.  There's a lrm() function under Design which does print

Re: [R] sum of two lists

2011-08-29 Thread Henrique Dallazuanna
Try this: as.list(colSums(merge(m, n, all = TRUE), na.rm = TRUE)) On Mon, Aug 29, 2011 at 7:39 PM, zhenjiang xu wrote: > Hi R users, > > Suppose I have two lists and the names of list 'm' are a subset of those of > 'n', how can I sum the two lists with corresponding elements added together > to

[R] sum of two lists

2011-08-29 Thread zhenjiang xu
Hi R users, Suppose I have two lists and the names of list 'm' are a subset of those of 'n', how can I sum the two lists with corresponding elements added together to get list 'o'? > n = list("a"=1,"b"=3,"c"=5) > m = list('b'=4) > o $a [1] 1 $b [1] 7 $c [1] 5 Thanks -- Best, Zhenjiang

Re: [R] Plot history

2011-08-29 Thread David Winsemius
On Aug 29, 2011, at 6:03 PM, Ayyappa Chaturvedula wrote: Dear R group, I am trying to plot uisng a for loop. Here is the script: for (i in unique(cfn$ID)){ plot(cfn$TIME[cfn$ID==i],cfn$DV[cfn$ID==i],pch=16)} I could access only the last plot of the series and cannot go back to see all the

Re: [R] Difference between a data frame and data table

2011-08-29 Thread Bert Gunter
Google on "R data table" please. Read the vignettes therein. -- Bert On Mon, Aug 29, 2011 at 1:59 PM, Abraham Mathew wrote: > I didn't learn about data tables until recently. (They're never covered in > any intro R books). > > In any case, I'm not sure what (if any) is the difference between a d

Re: [R] replacing elements of a zoo object

2011-08-29 Thread Gene Leynes
David - I'm a little confused about why you would call that indexing error "trifling". It seems like a pretty serious problem with the zoo internals although it seems to have been fixed in the latest version of zoo. Gabor - Thank you. After updating to the latest version of zoo *and* restart

Re: [R] replacing elements of a zoo object

2011-08-29 Thread David Winsemius
On Aug 29, 2011, at 3:33 PM, R. Michael Weylandt wrote: Hmm, I don't know what this means as trouble shooting, but I get the following: snipped 4 > x[as.Date('2001-01-05')] = 0 > x Error in dimnames(x) <- dn : length of 'dimnames' [1] not equal to array extent > str(x) ‘zoo’ s

[R] ggplot2 question ...

2011-08-29 Thread vamshi999
i have this data with me...i am only copying part of data here... date time "2011-05-23""04:31:17" "2011-05-23""04:31:20" "2011-05-23""04:31:22" "2011-05-23""04:31:25" "2011-05-23""04:31:27" "2011-05-23""04:31:18" "2011-05-23""04:31:20" "2011-05

[R] Difference between a data frame and data table

2011-08-29 Thread Abraham Mathew
I didn't learn about data tables until recently. (They're never covered in any intro R books). In any case, I'm not sure what (if any) is the difference between a data frame and a data table. Can anyone provide a brief explanation? Is one preferred over another or is it just dependent on the tas

[R] Plot history

2011-08-29 Thread Ayyappa Chaturvedula
Dear R group, I am trying to plot uisng a for loop. Here is the script: for (i in unique(cfn$ID)){ plot(cfn$TIME[cfn$ID==i],cfn$DV[cfn$ID==i],pch=16)} I could access only the last plot of the series and cannot go back to see all the plots. I appreciate your help in resolving this issue and also

Re: [R] Improving result from integrate

2011-08-29 Thread . .
So guys, I am writing to ask for an opinion from you... As I begin to write in the previous post, I developed a function called myintegrate that is based in integrate but my function give better results for the problem I am dealing. My development was inspired in this post http://r.789695.n4.nabb

[R] Saving a graph

2011-08-29 Thread Gang Chen
I read somewhere that vector graphics such as eps or dpf are more favorable than alternatives (jpeg, bmp or png) for publication because vector graphics scale properly when enlarged. However, my problem is that the file generated from a graph of fixed size is too large (in the order of 10MB) becaus

Re: [R] replacing elements of a zoo object

2011-08-29 Thread Gabor Grothendieck
On Mon, Aug 29, 2011 at 4:59 PM, Gene Leynes wrote: > David - > I'm a little confused about why you would call that indexing error > "trifling".  It seems like a pretty serious problem with the zoo > internals although it seems to have been fixed in the latest version of > zoo. At one time zo

Re: [R] Pb with \t interpretation in R

2011-08-29 Thread Duncan Murdoch
On 29/08/2011 3:29 PM, Imbeaud (Inserm U674) wrote: Hi, I have to deal with a huge .txt table (~485.577 rows and 469 columns,> 1.5 Go file) I used the read.table function > tmp=read.table("data.txt", header=TRUE, sep="\t", fill=TRUE, na.strings="NA", comment.char="", stringsAsFactors = FALSE)

[R] Competing Risk with survey data

2011-08-29 Thread Lamke
Dear Group, Has anyone conducted CR analysis using survey data i.e. with sampling weights. I've already looked up CRAN task view in survival analysis. Any lead is appreciated. Thanks! Kel -- View this message in context: http://r.789695.n4.nabble.com/Competing-Risk-with-survey-data-tp3777189

[R] ATSP to TSP reformulation

2011-08-29 Thread Ian Deters
Greetings, I am having trouble getting the function reformulate_ATSP_as_TSP to work for me. I have provided a simple example of some of the code I've been using. In particular, I'm not sure why I'm getting the error "Error in dimnames(tsp) <- list(lab, lab) : length of 'dimnames' [1] not e

[R] Pb with \t interpretation in R

2011-08-29 Thread Imbeaud (Inserm U674)
Hi, I have to deal with a huge .txt table (~485.577 rows and 469 columns, > 1.5 Go file) I used the read.table function > tmp=read.table("data.txt", header=TRUE, sep="\t", fill=TRUE, na.strings="NA", comment.char="", stringsAsFactors = FALSE) However, I encounter troubles in interpreting some "\t"

[R] Multiple Traveling Salesperson Problem

2011-08-29 Thread Ian Deters
While R has library TSP to help solve traveling salesperson problems, does anyone know if it has any libraries to help solve multiple traveling salesperson problems? For instance, suppose one is planning school bus routes and one has multiple buses. Thank you for your time. -- View this message

Re: [R] replacing elements of a zoo object

2011-08-29 Thread Gene Leynes
Michael, By the way, although I replied to David's email, I was responding to you as well. Your results were exactly what I was expecting, but I didn't get your results. On Mon, Aug 29, 2011 at 1:51 PM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > How exactly do you mean it doesn

Re: [R] replacing elements of a zoo object

2011-08-29 Thread Gene Leynes
This seems like a very strange error. In trying to troubleshoot this further I looked at the structure of x. The new x has the length of the Index (2001-01-05 = 11327). > library(zoo) > x = zoo(1:5, as.Date('2001-01-01')+1:5) > str(x) ‘zoo’ series from 2001-01-02 to 2001-01-06 Data: int [1:5]

Re: [R] rpart: apply tree to new data to get "counts"

2011-08-29 Thread Jay
I tried that, while I find the documentation a bit short, but the only result I get from this is a probability distribution of my data (I'm building a tree with 2 classes). How do I plot a tree where the counts are show in each step/node? BR, Jay On Aug 29, 9:40 pm, Weidong Gu wrote: > ? predict

Re: [R] replacing elements of a zoo object

2011-08-29 Thread Gabor Grothendieck
On Mon, Aug 29, 2011 at 2:45 PM, Gene Leynes wrote: > Why doesn't this work? > > x = zoo(1:5, as.Date('2001-01-01')+1:5) > x[as.Date('2001-01-05')] > x[as.Date('2001-01-05')] = 0 > x > Make sure you have the most recent version of zoo which is this: > packageVersion("zoo") [1] ‘1.7.4’ -- Stat

Re: [R] how to referee a dimension name via a variable?

2011-08-29 Thread Duncan Murdoch
On 29/08/2011 3:52 PM, Jie TANG wrote: thank you , it works . another problem is if can could define a variable to express the data.frame? for example : datanam<-c("newdata","newdata2") plot(datanam[1][[newnam[1]]]) Use get(): plot(get(datanam[1])[[newnam[1]]])) Duncan Murdoch 2011/8/30 J

Re: [R] how to referee a dimension name via a variable?

2011-08-29 Thread Jie TANG
thank you , it works . another problem is if can could define a variable to express the data.frame? for example : datanam<-c("newdata","newdata2") plot(datanam[1][[newnam[1]]]) 2011/8/30 Justin Haynes > try: > > newnam<-paste('newdatadat',dayno,sep='') > > plot(test[[newnam[1]]]) > > > On Mon,

Re: [R] splitting into multiple dataframes and then create a loop to work

2011-08-29 Thread Dimitris Rizopoulos
well, if a pooled estimate of the residual standard error is not desirable, then you just need to set argument 'pool' of lmList() to FALSE, e.g., mlis <- lmList(yvar ~ . - clvar | clvar, data = df, pool = FALSE) summary(mlis) Best, Dimitris On 8/29/2011 9:20 PM, Dennis Murphy wrote: Hi:

Re: [R] how to referee a dimension name via a variable?

2011-08-29 Thread Justin Haynes
try: newnam<-paste('newdatadat',dayno,sep='') plot(test[[newnam[1]]]) On Mon, Aug 29, 2011 at 12:29 PM, Jie TANG wrote: > hi, R-users > I have a data.frame for example test$newdataday24 and test$newdataday48 > I can plot them by > plot(test$newdataday24) > but now i want to plot different

Re: [R] replacing elements of a zoo object

2011-08-29 Thread R. Michael Weylandt
Hmm, I don't know what this means as trouble shooting, but I get the following: 1) After library(zoo) Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date and then for the first str(x) ‘zoo’ series from 2001-01-02 to 2001-01-06 Data: int [1:5] 1 2 3 4

[R] how to referee a dimension name via a variable?

2011-08-29 Thread Jie TANG
hi, R-users I have a data.frame for example test$newdataday24 and test$newdataday48 I can plot them by plot(test$newdataday24) but now i want to plot different data by define a variable to describe them dayno<-c(24,48) newnam<-paste("test$newdataday",dayno,sep="") plot(newnam[1]) but i failed,

Re: [R] Bayesian functions for mle2 object

2011-08-29 Thread JLucke
I would recommend using the new Bayesian package 'LaplacesDemon' available on CRAN. Ben Bolker Sent by: r-help-boun...@r-project.org 08/29/2011 02:50 PM To cc Subject Re: [R] Bayesian functions for mle2 object Billy.Requena gmail.com> writes: > > Hi everybody, > > I'm interested

Re: [R] splitting into multiple dataframes and then create a loop to work

2011-08-29 Thread Dennis Murphy
Hi: Dimitris' solution is appropriate, but it needs to be mentioned that the approach I offered earlier in this thread differs from the lmList() approach. lmList() uses a pooled measure of error MSE (which you can see at the bottom of the output from summary(mlis) ), whereas the plyr approach subd

Re: [R] replacing elements of a zoo object

2011-08-29 Thread David Winsemius
On Aug 29, 2011, at 3:02 PM, Gene Leynes wrote: Although I'm not sure what you're talking about with pop-up windows... I got (as expected) assignment, so I assumed you were not expecting assignment. Weird, this is what I'm getting in either R 2.13.0 or R 2.12.0: > library(zoo) Warning

Re: [R] replacing elements of a zoo object

2011-08-29 Thread Gene Leynes
Although I'm not sure what you're talking about with pop-up windows... Weird, this is what I'm getting in either R 2.13.0 or R 2.12.0: > library(zoo) Warning: package 'zoo' was built under R version 2.13.1 > x = zoo(1:5, as.Date('2001-01-01')+1:5) > x[as.Date('2001-01-05')] 2001-01-05 4

Re: [R] splitting into multiple dataframes and then create a loop to work

2011-08-29 Thread Dimitris Rizopoulos
You can do this using function lmList() from package nlme, without having to split the data frames, e.g., library(nlme) mlis <- lmList(yvar ~ . - clvar | clvar, data = df) mlis summary(mlis) I hope it helps. Best, Dimitris On 8/29/2011 5:37 PM, Nilaya Sharma wrote: Dear All Sorry for th

Re: [R] R question: generating data using MASS

2011-08-29 Thread Ben Bolker
Michael Parent ufl.edu> writes: > > Thanks! > > "This problem isn't uniquely defined. Are you > willing to generate more samples than you need and then throw > away extreme values? Or do you want to 'censor' > extreme values (i.e. set values <= 1 to 1 and values >=7 to 7)?" > > I'd like the

Re: [R] splitting into multiple dataframes and then create a loop to work

2011-08-29 Thread Dennis Murphy
Hi: This is straightforward to do with the plyr package: # install.packages('plyr') library('plyr') set.seed(1234) df <- data.frame(clvar = rep(1:4, each = 10), yvar = rnorm(40, 10, 6), var1 = rnorm(40, 10, 4), var2 = rnorm(40, 10, 4), var3 = rnorm(40, 5, 2), var

[R] Rpart modelling a decisión tree and getting probability

2011-08-29 Thread Jose Bustos Melo
Hello everyone, I working in a public health project and we have created a Decision Tree for categorical variables usign the package rpart. Our goal is to develop a model (Using the ROC tool) in order to predict presence/ausent of  diabetes and get a better understanding  of what are the import

Re: [R] replacing elements of a zoo object

2011-08-29 Thread David Winsemius
On Aug 29, 2011, at 2:45 PM, Gene Leynes wrote: Why doesn't this work? x = zoo(1:5, as.Date('2001-01-01')+1:5) x[as.Date('2001-01-05')] x[as.Date('2001-01-05')] = 0 x I think this is especially bad because it doesn't cause an error. It lets you do something to x, but then you can't see x

Re: [R] replacing elements of a zoo object

2011-08-29 Thread R. Michael Weylandt
How exactly do you mean it doesn't work? Copied from my GUI: > x = zoo(1:5, as.Date('2001-01-01')+1:5) > x[as.Date('2001-01-05')] 2001-01-05 4 > x[as.Date('2001-01-05')] = 0 > x 2001-01-02 2001-01-03 2001-01-04 2001-01-05 2001-01-06 1 2 3 0 5

Re: [R] Bayesian functions for mle2 object

2011-08-29 Thread Ben Bolker
Billy.Requena gmail.com> writes: > > Hi everybody, > > I'm interested in evaluating the effect of a continuous variable on the mean > and/or the variance of my response variable. I have built functions > expliciting these and used the 'mle2' function to estimate the coefficients, > as follows:

[R] replacing elements of a zoo object

2011-08-29 Thread Gene Leynes
Why doesn't this work? x = zoo(1:5, as.Date('2001-01-01')+1:5) x[as.Date('2001-01-05')] x[as.Date('2001-01-05')] = 0 x I think this is especially bad because it doesn't cause an error. It lets you do something to x, but then you can't see x again to see what it did. [[alternative HTML

[R] Lee-Carter in R package

2011-08-29 Thread Cristina Guimaraes
Dear all, I'm forecasting health services utilization using Lee-Carter method. I have a routine to run LC method in R package, and I understood all steps to model and forecasting the rates by this method, except two things: 1) how to adjust the estimated admission rates by the total number of adm

Re: [R] How to order based on the second two columns?

2011-08-29 Thread David Winsemius
On Aug 29, 2011, at 2:40 PM, Andra Isan wrote: Hello All, I have a data frame consisting of 4 columns (id1, id2, y, pred) where pred is the predicted value based on the glm function and my data frame is called "all". "data" is another data frame that has all data but I want to put together

Re: [R] rpart: apply tree to new data to get "counts"

2011-08-29 Thread Weidong Gu
? predict.rpart Weidong Gu On Mon, Aug 29, 2011 at 12:49 PM, Jay wrote: > Hi, > > when I have made a decision tree with rpart, is it possible to "apply" > this tree to a new set of data in order to find out the distribution > of observations? Ideally I would like to plot my original tree, with >

[R] How to order based on the second two columns?

2011-08-29 Thread Andra Isan
Hello All, I have a data frame consisting of 4 columns (id1, id2, y, pred) where pred is the predicted value based on the glm function and my data frame is called "all". "data" is another data frame that has all data but I want to put together some important columns from my original data frame

Re: [R] reading tables from multiple HTML pages

2011-08-29 Thread Dennis Murphy
?tryCatch HTH, Dennis On Mon, Aug 29, 2011 at 9:04 AM, s1oliver wrote: > Hi, beginner to R and was having some problems scraping data from tables in > html using the XML package. I have included some code below. > > I am trying to loop through a series of html pages, each of which contains a > s

Re: [R] R question: generating data using MASS

2011-08-29 Thread Michael Parent
Thanks! "This problem isn't uniquely defined. Are you willing to generate more samples than you need and then throw away extreme values? Or do you want to 'censor' extreme values (i.e. set values <= 1 to 1 and values >=7 to 7)?" I'd like the retain a normal distribution so I wouldn't want to

[R] splitting into multiple dataframes and then create a loop to work

2011-08-29 Thread Nilaya Sharma
Dear All Sorry for this simple question, I could not solve it by spending days. My data looks like this: # data set.seed(1234) clvar <- c( rep(1, 10), rep(2, 10), rep(3, 10), rep(4, 10)) # I have 100 level for this factor var; yvar <- rnorm(40, 10,6); var1 <- rnorm(40, 10,4); var2 <- rnorm(40,

[R] reading tables from multiple HTML pages

2011-08-29 Thread s1oliver
Hi, beginner to R and was having some problems scraping data from tables in html using the XML package. I have included some code below. I am trying to loop through a series of html pages, each of which contains a single table from which I want to scrape data. However, some of the pages are blank

[R] rpart: apply tree to new data to get "counts"

2011-08-29 Thread Jay
Hi, when I have made a decision tree with rpart, is it possible to "apply" this tree to a new set of data in order to find out the distribution of observations? Ideally I would like to plot my original tree, with the counts (at each node) of the new data. Reagards, Jay _

Re: [R] maximum number of subdivisions reached

2011-08-29 Thread Dennis Murphy
Hi: integrate() is not a vectorized function. This appears to work: sapply(1:2, function(x) func(x, 0.1, 0.1, sad = Exp)) [1] 0.250 0.125 In this case, sapply() is a disguised for loop. HTH, Dennis On Mon, Aug 29, 2011 at 9:45 AM, . . wrote: > Ooops, > > sorry! > > The problem occurs when > >

Re: [R] control line break behavior of R output

2011-08-29 Thread Greg Snow
If your main goal is to look at a data frame and you are ok with scrolling, then look at the View function (note capitalization) as an alternative to just printing the data frame. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111

Re: [R] Function rank() for data frames (or multiple vectors)?

2011-08-29 Thread peter dalgaard
On Aug 29, 2011, at 15:39 , Sebastian Bauer wrote: >> >> > rr <- data.frame(a = c(1,1,1,1,2), b=c(1,2,2,3,1)) >> >> > ave(order(rr$a, rr$b), rr$a, rr$b ) >> [1] 1.0 2.5 2.5 4.0 5.0 > > Actually, this may be a solution I was looking for! Note that it assumes that > rr to be sorted already (hen

Re: [R] separate mfrow region with line

2011-08-29 Thread Greg Snow
The grconvertX and grconvertY functions may be helpful in finding the endpoints to use. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-

Re: [R] Legend / bar order - ggplot2

2011-08-29 Thread Dennis Murphy
Hi: The bars *are* ordered in the same way, but when you use coord_flip(), the left category goes on top and the right category goes on the bottom. Is this what you want? ggplot(df, aes(x = name, y = value, fill = type)) + geom_bar(position = position_dodge()) + coord_flip() + scale_fill_ma

Re: [R] Differences in SAS and R defaults

2011-08-29 Thread Jeremy Miles
Do you mean things like treatment of categorical variables in regression procedures (which have different defaults in different procedures in SAS), and different default as to the reference category in logistic regression? Jeremy On 29 August 2011 04:46, n wrote: > Hello all, > > I am looking

Re: [R] How do I get a weighted frequency table?

2011-08-29 Thread Luca Meyer
Hi David, Unfortunately I need to use the "should have been" frequencies if the sample corresponded perfectly in terms of some "reference" variables to the population. That is, if in my sample I observe V1_R1=10%, V1_R2=50%, V3_R3=40% while the same known population distribution is V1_R1=20%,

Re: [R] Exception while using NeweyWest function with doMC

2011-08-29 Thread David Winsemius
On Aug 27, 2011, at 3:37 PM, Simon Zehnder wrote: Dear R users, I am using R right now for a simulation of a model that needs a lot of memory. Therefore I use the *bigmemory* package and - to make it faster - the *doMC* package. See my code posted on http://pastebin.com/dFRGdNrG Now, if I

Re: [R] Basic question about re-writing for loop as a function

2011-08-29 Thread Patrick Burns
You are somewhere in Circles 3 and 4 of 'The R Inferno'. If you have a function to apply over more than one argument, then 'mapply' will do that. But you don't need to do that -- you can do the operation you want efficiently: *) create your resulting matrix with all zeros, no reason for this to

Re: [R] maximum number of subdivisions reached

2011-08-29 Thread . .
Ooops, sorry! The problem occurs when func(1:2,0.1,0.1,sad=Exp) On Mon, Aug 29, 2011 at 12:27 PM, R. Michael Weylandt wrote: > Can't help, code runs fine on my machine once you change "valu" to "value." > Are you sure it fails in a vanilla run of R and isn't caused by any other > choices you h

Re: [R] Asking Favor For "Remove element with Particular Value In Vector"

2011-08-29 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Bert Gunter > Sent: Monday, August 29, 2011 7:07 AM > To: Jim Lemon > Cc: r-help@r-project.org > Subject: Re: [R] Asking Favor For "Remove element with Particular Value In > Vect

Re: [R] R.oo data members / inheritance

2011-08-29 Thread Henrik Bengtsson
Hi, comments below. On Mon, Aug 29, 2011 at 8:12 AM, Ben qant wrote: > Correction. My solution didn't work either Didn't return the correct > values. Can you post an example that takes three arguments? I'm working on > how to do this now. > thanks...sorry. I"m new to R and R.oo. > > Ben > >

Re: [R] Exception while using NeweyWest function with doMC

2011-08-29 Thread Jay Emerson
Simon, Though we're please to see another use of bigmemory, it really isn't clear that it is gaining you anything in your example; anything like as.big.matrix(matrix(...)) still consumes full RAM for both the inner matrix() and the new big.matrix -- is the filebacking really necessary. It also do

Re: [R] Differences in SAS and R defaults

2011-08-29 Thread Frank Harrell
It doesn't help to post this twice, but it may help to know why this is of interest. Frank n wrote: > > Hello all, > > I am looking for theories and statistical analyses where the defaults > employed in R and SAS are different. As a result, the outputs under > the defaults should (at least sligh

Re: [R] Configuring Proxy: Proxy Authentication Required with --internet2

2011-08-29 Thread Duncan Murdoch
On 29/08/2011 9:23 AM, behave wrote: Hi there I'm trying to configure R to get access to the internet. Using the Internet Explorer a proxy .pac script is used. Reading some older threads I found that I can use the --internet2 option. When choosing a mirror I get the error: "407 Proxy Authentica

Re: [R] all combinations of the elements of two vectors

2011-08-29 Thread David Winsemius
On Aug 29, 2011, at 9:15 AM, Campbell, Desmond wrote: Petr, Jorge, Daniel, Yes you could also use outer() instead of expand.grid(). This is quite useful to know. Also I didn't know you could turn a matrix into a vector by setting its dimensions to NULL like that. I always used as.vector( m

[R] MuMIn Problem getting adjusted Confidence intervals

2011-08-29 Thread Marcos Lima
Hello R users I'm using MuMIn but for some reason I'm not getting the adjusted confidence interval and uncoditional SE whe I use model.avg(). I took into consideration the steps provided by Grueber et al (2011) Multimodel inference in ecology and evolution: challenges and solutions in JEB. I cre

Re: [R] Asking Favor For "Remove element with Particular Value In Vector"

2011-08-29 Thread chuan_zl
Thank you very much,friend. -- View this message in context: http://r.789695.n4.nabble.com/Asking-Favor-For-Remove-element-with-Particular-Value-In-Vector-tp3772779p3776435.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-proje

[R] Configuring Proxy: Proxy Authentication Required with --internet2

2011-08-29 Thread behave
Hi there I'm trying to configure R to get access to the internet. Using the Internet Explorer a proxy .pac script is used. Reading some older threads I found that I can use the --internet2 option. When choosing a mirror I get the error: "407 Proxy Authentication Required". This seems reasonable

Re: [R] Asking Favor For "Remove element with Particular Value In Vector"

2011-08-29 Thread chuan_zl
Thank you very much,friend. -- View this message in context: http://r.789695.n4.nabble.com/Asking-Favor-For-Remove-element-with-Particular-Value-In-Vector-tp3772779p3776430.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-proje

Re: [R] Help with levelplot color assignment in lattice

2011-08-29 Thread sguyader
In fact by fiddling with the "at" and "colorkey" options, I was able to get the result I expected. Now the colors are assigned correctly, as well as the colorkey. Here's my code: # see data in the original data$level[is.na(data$level)] <- 10 # assign a value above the scale to NA values levelplo

Re: [R] Asking Favor For "Remove element with Particular Value In Vector"

2011-08-29 Thread chuan_zl
Thank you very much,friend. -- View this message in context: http://r.789695.n4.nabble.com/Asking-Favor-For-Remove-element-with-Particular-Value-In-Vector-tp3772779p3776427.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-proje

Re: [R] all combinations of the elements of two vectors

2011-08-29 Thread Campbell, Desmond
Petr, Jorge, Daniel, Yes you could also use outer() instead of expand.grid(). This is quite useful to know. Also I didn't know you could turn a matrix into a vector by setting its dimensions to NULL like that. I always used as.vector( m ). And (as I've just discovered) you can use it to reconfi

[R] Legend / bar order - ggplot2

2011-08-29 Thread Yang Lu
Hi all, I am trying to do a barplot in ggplot2 and want to make sure that the legend order is consistent with the bar order, that is the legend order is orig and match; and the bars are ordered in the same way. It seems to me that I can only control one of them. Any idea? library(ggplot2) df <

  1   2   >