Re: [R] Question about curve function

2011-06-05 Thread Prof Brian Ripley
On Sun, 5 Jun 2011, Abhilash Balakrishnan wrote: Dear Mr. Murdoch, I find out that still do not understand why the following does not work: curve(expression(x)) Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ As here the input to curve is an expression, as docume

Re: [R] Can't compile rtiff for OSX

2011-06-05 Thread Prof Brian Ripley
On Sun, 5 Jun 2011, Robert Baruch wrote: I have libtiff installed from macports, and it is sitting there in /opt/local/lib: Well, you haven't told us which build of R you used, but it looks like it is not the one from MacPorts (maybe the one from CRAN?). /opt/local is not a standard location

Re: [R] parallel computing package on a multicore windows workstation

2011-06-05 Thread Prof Brian Ripley
On Mon, 6 Jun 2011, Richard Wang wrote: Hi, I would like to get suggestion about parallel computing package on a multicore windows workstation. I tried doSMP, but it crashes R a lot. I am wondering if "snow" and "snowfall" can be used on a single workstation (i,e, not cluster). At suggestio

Re: [R] reproduction archives

2011-06-05 Thread Laurent Gatto
On 5 June 2011 21:07, Alexander Shenkin wrote: > Hello Folks, > > As some of my old code broke when an updated package changed its > interface, I started thinking about reproduction of analyses.  It's not > good enough to save our code - we have to save the package versions > those analyses used a

Re: [R] Can R do zero inflated gamma regression?

2011-06-05 Thread Simon Blomberg
You might find Tweedie distributions helpful. See packages tweedie and statmod. Cheers, Simon. On 06/06/11 14:12, siriustar wrote: Hi, Dear R-help I know there are some R package to deal with zero-inflated count data. But I am now looking for R package to deal with zero-inflated continuous da

[R] Can R do zero inflated gamma regression?

2011-06-05 Thread siriustar
Hi, Dear R-help I know there are some R package to deal with zero-inflated count data. But I am now looking for R package to deal with zero-inflated continuous data. The response variable (Y) in my dataset contains a larger mount of zero and the Non-zero response are quite right skewed. Now what i

Re: [R] Question about curve function

2011-06-05 Thread Abhilash Balakrishnan
Dear Mr. Murdoch, I find out that still do not understand why the following does not work: > curve(expression(x)) Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ As here the input to curve is an expression, as documented in the help, and the expression is simply x.

Re: [R] Question about curve function

2011-06-05 Thread Abhilash Balakrishnan
Dear Mr. Murdoch, I now understand that curve does not know how to guess what x in curve(x) means. As you say, it might guess that x means a function, and if there is a function x, execute it. This is seen in the example: > x <- function(x) { x } > curve(x) I think, if curve guesses I have a f

[R] Can't compile rtiff for OSX

2011-06-05 Thread Robert Baruch
I have libtiff installed from macports, and it is sitting there in /opt/local/lib: $ ls -l /opt/local/lib/*tiff* -rwxr-xr-x 2 root admin 796684 Jun 4 22:13 /opt/local/lib/libtiff.3.dylib -rw-r--r-- 2 root admin 990296 Jun 4 22:13 /opt/local/lib/libtiff.a lrwxr-xr-x 1 root admin 15

Re: [R] Error with BRugs 0.53 and 0.71, on Win7 with R 2.12.2 and 2.13.0 (crashes R GUI)

2011-06-05 Thread Chris Chapman
Thanks again. FWIW, I tried an even older R version (2.11) + BRugs 0.53 and 0.70 ... but got the same errors as with the iterations reported below. So I'm giving up on trying to solve the issue. My workaround is that I'm using the R2WinBUGS package instead. So far that has worked well -- I'

[R] Fwd: Question about curve function

2011-06-05 Thread Abhilash Balakrishnan
I accidentally did not respond to the list. -- Forwarded message -- From: Abhilash Balakrishnan Date: Sun, Jun 5, 2011 at 8:44 PM Subject: Re: [R] Question about curve function To: Matt Shotwell Dear Mr. Shotwell, Thank you for the explanation. You seem to be right. In parti

[R] anacor graphics

2011-06-05 Thread Claudia Isabel Rodríguez
Dear friends. I am using the command plot (inside the anacor package) to construct one simple correspondence analysis graphic. The line that I am using is this: plot(COL, plot.type = "jointplot", arrows = "FALSE", conf=NULL, xlim = c(-2.5,1.5), ylim = c(-1.2,3), col.r="BLUE", col.c="BLACK") An err

[R] ANACOR coordinates

2011-06-05 Thread Claudia Isabel Rodríguez
Dear friends. I am using the anacor command to do a simple correspondence analysis. I got correctly the eingenvalues, the Chi-Square decomposition and the graphics, but I do not know what is the command to "call" the row and column coordinates? Thanks in advance Claudia -- Claudia Isabel Rodrígue

[R] Lasso for k-subset regression

2011-06-05 Thread Dae-Jin Lee
Dear R-users I'm trying to use lasso in lars package for subset regression, I have a large matrix of size 1000x100 and my aim is to select a subset k of the 100 variables. Is there any way in lars to fix the number k (i.e. to select the best 10 variables) library(lars) aa=lars(X,Y,type="lasso"

[R] parallel computing package on a multicore windows workstation

2011-06-05 Thread Richard Wang
Hi, I would like to get suggestion about parallel computing package on a multicore windows workstation. I tried doSMP, but it crashes R a lot. I am wondering if "snow" and "snowfall" can be used on a single workstation (i,e, not cluster). At suggestion would be appreciated, Best, Richard

Re: [R] LM/two way analysis/classic parametrisation

2011-06-05 Thread Rolf Turner
On 06/06/11 03:01, kfl wrote: Thank you for your reply. However, I don't undestand what your are telling me. I would be pleased if you could give me the synstax in the following examples: #Exampel page side 372 trt<-gl(3,4,12,labels=c("T1","T2","T3")) blk<-gl(4,1,12,labels=c("B1","B2","B3","B4

Re: [R] panel.loess confidence interval

2011-06-05 Thread Felix Andrews
On 6 June 2011 06:45, Gabor Grothendieck wrote: > On Sun, Jun 5, 2011 at 3:18 PM, Mark Ebbert wrote: >> Dear R gurus, >> >> Based on my searches I think I know the answer to this question, but I'd >> like to pose it to you. Is there an easy way to plot the confidence interval >> around a loess

Re: [R] How to convert a factor column into a numeric one?

2011-06-05 Thread Joshua Wiley
Hmm, that is a bit tricky. The conversion from a table to a data frame uses the dimension names, which are always character. To bypass this, you would need to save the dimension names, convert the ones you want numeric to numeric (I am assuming everything except Conc, so the indices would be c(1,

Re: [R] reproduction archives

2011-06-05 Thread Duncan Murdoch
On 11-06-05 4:07 PM, Alexander Shenkin wrote: Hello Folks, As some of my old code broke when an updated package changed its interface, I started thinking about reproduction of analyses. It's not good enough to save our code - we have to save the package versions those analyses used as well as t

Re: [R] reproduction archives

2011-06-05 Thread Petr Savicky
On Sun, Jun 05, 2011 at 03:07:44PM -0500, Alexander Shenkin wrote: > Hello Folks, > > As some of my old code broke when an updated package changed its > interface, I started thinking about reproduction of analyses. It's not > good enough to save our code - we have to save the package versions > t

Re: [R] panel.loess confidence interval

2011-06-05 Thread Gabor Grothendieck
On Sun, Jun 5, 2011 at 3:18 PM, Mark Ebbert wrote: > Dear R gurus, > > Based on my searches I think I know the answer to this question, but I'd like > to pose it to you. Is there an easy way to plot the confidence interval > around a loess line using lattice? The only thing I've found is ggplot,

Re: [R] Question about curve function

2011-06-05 Thread Duncan Murdoch
On 11-06-05 1:07 PM, Abhilash Balakrishnan wrote: Dear Sirs, I am a new user of the R package. When I try to use the curve function it confuses me. curve(x^2) Works fine. curve(x) Makes a complaint I don't understand. Why is x^2 valid and x is not? curve() is a convenience function, an

[R] panel.loess confidence interval

2011-06-05 Thread Mark Ebbert
Dear R gurus, Based on my searches I think I know the answer to this question, but I'd like to pose it to you. Is there an easy way to plot the confidence interval around a loess line using lattice? The only thing I've found is ggplot, but I prefer to stick with lattice out of preference. Than

[R] Negating two identical characters with regular expressions

2011-06-05 Thread Michael Young
Hello all, Let's say I have a character string "Race-ethnicity-coding information" I want to extract all text before the multiple dashes, including the word "ethnicity." I wrote a handy function to extract the first matched text: grepcut <- function(pattern,x){ start.and.length <- regexpr(p

[R] reproduction archives

2011-06-05 Thread Alexander Shenkin
Hello Folks, As some of my old code broke when an updated package changed its interface, I started thinking about reproduction of analyses. It's not good enough to save our code - we have to save the package versions those analyses used as well as the R-core. I saw a couple references to "reprod

Re: [R] Question about example function

2011-06-05 Thread Ethan Brown
Hi Abhilash, >From ?example, under "arguments": local: logical: if ‘TRUE’ evaluate locally, if ‘FALSE’ evaluate in the workspace. So all you need to do is: > x <- 0 > example(mean, local=TRUE) mean> x <- c(0:10, 50) mean> xm <- mean(x) mean> c(xm, mean(x, trim = 0.10)) [1] 8.75 5.50 mean> m

Re: [R] Question about curve function

2011-06-05 Thread Matt Shotwell
I think there is trouble because expr in curve(expr) may be the name of a function, and it's ambiguous whether 'x' should be interpreted as a mathematical expression involving x, or the name of a function. Here are some examples that work: curve(I(x)) curve(1*x) On Sun, 2011-06-05 at 12:07 -0500,

[R] Question about curve function

2011-06-05 Thread Abhilash Balakrishnan
Dear Sirs, I am a new user of the R package. When I try to use the curve function it confuses me. > curve(x^2) Works fine. > curve(x) Makes a complaint I don't understand. Why is x^2 valid and x is not? I check the documentation of curve, and it says the first argument must be an expression c

[R] Question about example function

2011-06-05 Thread Abhilash Balakrishnan
Dear Sirs, I am exploring the R package and its documentation. I find there is the function example which runs examples from documentation pages. What confuses me is that running example interferes with the variables I have in my workspace. > x <- 0 > example(mean) > x Now x is a vector of some

Re: [R] LM/two way analysis/classic parametrisation

2011-06-05 Thread kfl
Thank you for your reply. However, I don't undestand what your are telling me. I would be pleased if you could give me the synstax in the following examples: #Exampel page side 372 trt<-gl(3,4,12,labels=c("T1","T2","T3")) blk<-gl(4,1,12,labels=c("B1","B2","B3","B4")) res<-c(13,7,9,3,6,6,3,1,11

Re: [R] unwanted switch to DST with POSIXct objects

2011-06-05 Thread Denis Chabot
Thanks Jeff and Spencer, I will probably set the time zone for my session, but I had forgotten the possibility of setting the time zone attribute of a POSIXct object, which would have solved my problem also. Denis Le 2011-06-05 à 11:14, Spencer Graves a écrit : > On 6/5/2011 9:30 AM, Jeff Newmi

Re: [R] unwanted switch to DST with POSIXct objects

2011-06-05 Thread Spencer Graves
On 6/5/2011 9:30 AM, Jeff Newmiller wrote: Sys.setenv(TZ="Etc/GMT+5") Or: x <- as.POSIXct(as.Date('2011-01-15')) attr(x, 'tzone') <- "Etc/GMT+5" x This version works without Sys.setenv, which may not work on some platforms. Unfortunately, I believe there are some copy operations that

Re: [R] kronecker sum

2011-06-05 Thread Ted Harding
On 05-Jun-11 13:36:18, Lara Poplarski wrote: > Dear All, > Could someone please suggest how to find the Kronecker sum > of two 2x2 matrices, > i.e. given two matrices: > > -A A > a -a > > and > > -B B > b -b > > I need: > > -A-BA B 0 > a -a-B 0 B > b

Re: [R] unwanted switch to DST with POSIXct objects

2011-06-05 Thread Jeff Newmiller
Sys.setenv(TZ="Etc/GMT+5") Make the timezone you prefer the default for that R session. FWIW: EST may or may not exist as a valid timezone on your system, but it is an ambiguous notation anyway. --- Jeff Newmiller The .

[R] unwanted switch to DST with POSIXct objects

2011-06-05 Thread Denis Chabot
Hi, For a project I try to keep everything in normal time, not daylight saving time, to prevent problem when instruments collected data during the nights when we go from DST to normal time. But sometimes R tricks me and I do not know how to prevent it. This is one example: lights_on = as.POSI

Re: [R] kronecker sum

2011-06-05 Thread Duncan Murdoch
On 11-06-05 9:36 AM, Lara Poplarski wrote: Dear All, Could someone please suggest how to find the Kronecker sum of two 2x2 matrices, i.e. given two matrices: -A A a -a and -B B b -b I need: -A-BA B 0 a -a-B 0 B b0 -A-b A 0b

Re: [R] ifelse strips POSIXct class from object

2011-06-05 Thread Denis Chabot
Hi Duncan, In this case they all had length 1, but I'll be careful at other occasions. Denis Le 2011-06-05 à 09:26, Duncan Murdoch a écrit : > On 11-06-05 8:49 AM, Denis Chabot wrote: >> Thanks Duncan, I'll go back to if and else! > > Be careful, it might not give you the same answer. > > I'd

[R] kronecker sum

2011-06-05 Thread Lara Poplarski
Dear All, Could someone please suggest how to find the Kronecker sum of two 2x2 matrices, i.e. given two matrices: -A A a -a and -B B b -b I need: -A-BA B 0 a -a-B 0 B b0 -A-b A 0b a-a-b Many thanks, Lara [[alternat

Re: [R] ifelse strips POSIXct class from object

2011-06-05 Thread Duncan Murdoch
On 11-06-05 8:49 AM, Denis Chabot wrote: Thanks Duncan, I'll go back to if and else! Be careful, it might not give you the same answer. I'd use this variation on the advice from ?ifelse: new.date <- my.date + x new.date[is.na(my.date)] <- min(default.date) + x The thing to watch out for in t

Re: [R] ifelse strips POSIXct class from object

2011-06-05 Thread Denis Chabot
I did not know this function, thanks a lot Gabor. Denis Le 2011-06-05 à 08:48, Gabor Grothendieck a écrit : > On Sun, Jun 5, 2011 at 8:23 AM, Denis Chabot wrote: >> Hi, >> >> I was "losing" my dates in a script and upon inspection, found that my >> recent switch from separate "if" and "else" t

Re: [R] ifelse strips POSIXct class from object

2011-06-05 Thread Denis Chabot
Thanks Duncan, I'll go back to if and else! Denis Le 2011-06-05 à 08:39, Duncan Murdoch a écrit : > On 11-06-05 8:23 AM, Denis Chabot wrote: >> Hi, >> >> I was "losing" my dates in a script and upon inspection, found that my >> recent switch from separate "if" and "else" to "ifelse" was the cau

Re: [R] ifelse strips POSIXct class from object

2011-06-05 Thread Gabor Grothendieck
On Sun, Jun 5, 2011 at 8:23 AM, Denis Chabot wrote: > Hi, > > I was "losing" my dates in a script and upon inspection, found that my recent > switch from separate "if" and "else" to "ifelse" was the cause. But why? > > my.date = as.POSIXct("2011-06-04 08:00:00") > default.date = seq(as.POSIXct("2

Re: [R] ifelse strips POSIXct class from object

2011-06-05 Thread Duncan Murdoch
On 11-06-05 8:23 AM, Denis Chabot wrote: Hi, I was "losing" my dates in a script and upon inspection, found that my recent switch from separate "if" and "else" to "ifelse" was the cause. But why? See ?ifelse. The class of the result is the same as the class of the test, not the classes of t

[R] ifelse strips POSIXct class from object

2011-06-05 Thread Denis Chabot
Hi, I was "losing" my dates in a script and upon inspection, found that my recent switch from separate "if" and "else" to "ifelse" was the cause. But why? my.date = as.POSIXct("2011-06-04 08:00:00") default.date = seq(as.POSIXct("2011-01-01 08:00:00"), as.POSIXct("2011-09-01 08:00:00"), length=

Re: [R] Remove row.names column in dataframe

2011-06-05 Thread mghenis
It seems row.names only shows up separately when it differs from the actual row numbers. I got them to go away by setting them as such, e.g. row.names(uniquedf) <- seq(nrow(uniquedf)) -- View this message in context: http://r.789695.n4.nabble.com/Remove-row-names-column-in-dataframe-tp856647p3574

Re: [R] conditions simpler way

2011-06-05 Thread Prof Brian Ripley
To drop the burnin period xx <- x1$x[-seq_len(burnin)] And it sounds like you want mean(xx > -1 & xx < 2] but your code and description differ. On Sun, 5 Jun 2011, Kehl Dániel wrote: Dear All, I have a MCMC result in x1. I was wondering if there is a simpler, more elegant way of evaluatin

[R] conditions simpler way

2011-06-05 Thread Kehl Dániel
Dear All, I have a MCMC result in x1. I was wondering if there is a simpler, more elegant way of evaluating the estimate of an integral then this (I am pretty sure there is): Also if I want to count the x's say -1in period. [code] z <- -2 burnin <- 2000 int1 <- length(x1$x[(burnin+1):length(