Re: [R] apply mean to a three-dimension data

2011-03-24 Thread Patrick Hausmann
Hi, I think you could also use this way (via array, see http://r.789695.n4.nabble.com/apply-over-list-of-data-frames-td3057968.html) b <- list() b[[1]] = matrix(1:4, 2, 2) b[[2]] = matrix(10:13, 2, 2) b[[3]] = matrix(20:23, 2, 2) b.a <- array(unlist(b), dim=c(2, 2, 3)) (b.mean <- apply(X = b.

Re: [R] error in bargraph.CI {sciplot}

2011-03-24 Thread David Winsemius
On Mar 24, 2011, at 8:35 PM, barbara costa wrote: Hi to all, Does anybody knows why this is giving an error? data(ToothGrowth) # Two-way design with options bargraph.CI(dose, len, group = supp, data = ToothGrowth, xlab = "Dose", ylab = "Growth", cex.lab = 1.5, x.leg = 1,

[R] two plots in qplot

2011-03-24 Thread Denis Kazakiewicz
Hello I simply want to plot two variables against one 'year' variable in qplot. Is any way of doing this without reshaping data in long format and using facet function afterwards? Thank you Denis __ R-help@r-project.org mailing list https://stat.ethz.c

Re: [R] error in bargraph.CI {sciplot}

2011-03-24 Thread Jorge Ivan Velez
Hi Barbara, Works just fine for me: > require(sciplot) Loading required package: sciplot > data(ToothGrowth) # Two-way design with options bargraph.CI(dose, len, group = supp, data = ToothGrowth, xlab = "Dose", ylab = "Growth", cex.lab = 1.5, x.leg = 1, col = "black", angle

[R] symmetric (& square) contingency table from dataset of unordered pairs

2011-03-24 Thread Daniel Weitzenfeld
Hi Everybody, I have a data set in which each observation has a pair of students, with each kid id'd by a 4 digit number: > head(PAIRS) student1 student2 2 2213 2200 4 2198 2195 5 2199 2191 6 2229 2221 7 2247 2249 8 2250 2263 There is no significa

Re: [R] Using C code in R

2011-03-24 Thread Steve Lianoglou
Trying to send to the list, take 3 (for some reason my mails get bounced when I send to r-help@r-project.org, and not when I send to r-h...@stat.math.ethz.ch) On Thu, Mar 24, 2011 at 8:34 PM, Steve Lianoglou wrote: > Hi Jaimin, > > Please include r-help in your reply -- it's not included by defau

[R] error in bargraph.CI {sciplot}

2011-03-24 Thread barbara costa
Hi to all, Does anybody knows why this is giving an error? data(ToothGrowth) # Two-way design with options bargraph.CI(dose, len, group = supp, data = ToothGrowth, xlab = "Dose", ylab = "Growth", cex.lab = 1.5, x.leg = 1, col = "black", angle = 45, cex.names = 1.25,

Re: [R] tapply with specific quantile value

2011-03-24 Thread Steven Ranney
Worked just fine. I had been incorrectly trying tapply(x, l.c.1, quantile(probs=0.75)) rather than tapply(x, l.c.1, quantile, probs=0.75) Thanks for the help - SR Steven H. Ranney On Thu, Mar 24, 2011 at 6:03 PM, Peter Alspach wrote: > Tena koe Steven > > The  ... argument of the apply se

Re: [R] Using C code in R

2011-03-24 Thread Steve Lianoglou
Hi Jaimin, Please include r-help in your reply -- it's not included by default, so you'll have to use your email client's "reply all" functionality when responding to posts coming from the mailing list. This way (i) more people will be able to help you than just me; and (ii) if someone runs into

Re: [R] tapply with specific quantile value

2011-03-24 Thread Jorge Ivan Velez
Hi Steven, See the prob argument under ?quantile. The following should be what you want: tapply(x, l.c.1, quantile, prob = 0.75) HTH, Jorge * * On Thu, Mar 24, 2011 at 7:18 PM, Steven Ranney <> wrote: > All - > > I have an example data frame > > x l.c.1 > 43.38812035 085 > 47.5571

Re: [R] tapply with specific quantile value

2011-03-24 Thread Tóth Dénes
Just have a look at ?quantile and the probs argument. tapply(x, l.c.1, quantile,probs=0.75) Anyway, quantiles and quartiles are not the same. I guess you meant the 3rd quartile. > All - > > I have an example data frame > > x l.c.1 > 43.38812035 085 > 47.55710661 085 > 47.55710661 085

Re: [R] tapply with specific quantile value

2011-03-24 Thread Peter Alspach
Tena koe Steven The ... argument of the apply series of functions allows one to pass arguments to the called function. So: tapply(x, l.c.1, quantile, probs=0.75) should work (although I haven't tested it). HTH . Peter Alspach > -Original Message- > From: r-help-boun...@r-projec

[R] tapply with specific quantile value

2011-03-24 Thread Steven Ranney
All - I have an example data frame x l.c.1 43.38812035 085 47.55710661 085 47.55710661 085 51.99211429 085 51.99211429 095 54.78449958 095 54.78449958 095 56.70201864 095 56.70201864 105 59.66361903 105 61.69573564 105 61.69573564 105 63.77469

Re: [R] Storing user-defined R functions

2011-03-24 Thread Duncan Murdoch
On 11-03-24 4:08 PM, Thomas Lumley wrote: On Fri, Mar 25, 2011 at 5:11 AM, David.Epstein wrote: Hello, I don't want to find out how to make packages unless that becomes necessary. Also, I don't want to clog up the computer memory with functions that I'm not using. (It would be great if someone

Re: [R] Help with creating a ts (time series) object with daily sampling values

2011-03-24 Thread Gabor Grothendieck
On Thu, Mar 24, 2011 at 3:25 PM, Pamela Allen wrote: > > > > Hi All, > > > > I have a data set of daily measurements of river flow. > I would like to create a “ts” object from this data. > > > > Here’s a sample data set: > > date <- as.Date(c(1:300), format="%Y") > > year=as.numeric(format(date, f

[R] Jri Examples

2011-03-24 Thread Richard Schäfer
Hello, Im new to R and I just successfully installed Jri. However I dont quite get the rtest examples. Is it working? One the console: Creating Rengine (with arguments) Rengine created, waiting for R re-routing stdout/err into R console rBusy(0) And the java window is asking me: to save the wor

Re: [R] How create vector that sums correct responses for multiple subjects?

2011-03-24 Thread Hadley Wickham
On Thu, Mar 24, 2011 at 2:24 PM, Kevin Burnham wrote: > I have a data file with indicates pretest scores for a linguistics > experiment.  The data are in long form so for each of 33 subjects there are > 400 rows, one for each item on the test, and there is a column called > ‘Correct’ that shows ‘C

Re: [R] Colour makes my life; but not my bwplot (panel.violin)

2011-03-24 Thread David Winsemius
On Mar 24, 2011, at 1:37 PM, JP wrote: Using Trellis, am successfully setting up a number of panels (25) in which I have two box and violin plots. I would like to colour - one plot as RED and the other as BLUE (in each panel). I can do that with the box plots, but the violin density are

Re: [R] Problems with predict in fGarch

2011-03-24 Thread Prof. John C Nash
It's likely that the loss function has a log() or 1/x and the finite difference approximations to gradients have added / subtracted a small number and caused a singularity. Unfortunately, you'll need to dig into the fGarch code or write your own (ouch!). Or perhaps the fGarch package maintainer wi

Re: [R] Storing user-defined R functions

2011-03-24 Thread David Scott
On 25/03/11 09:08, Thomas Lumley wrote: On Fri, Mar 25, 2011 at 5:11 AM, David.Epstein wrote: Hello, I don't want to find out how to make packages unless that becomes necessary. Also, I don't want to clog up the computer memory with functions that I'm not using. (It would be great if someone

Re: [R] Questions for "domist... subscript out of bounds"

2011-03-24 Thread David Winsemius
On Mar 24, 2011, at 1:15 PM, jessiecy2001 wrote: Hi all, I am a new user for R. I faced a questions about subscript out of bounds. Although I checked some other helps before I sent this email, I still don't know how to deal with this problems. I want to use "domain" function to run specie

Re: [R] Millisecond TimeStamps

2011-03-24 Thread David Winsemius
On Mar 24, 2011, at 1:13 PM, Madaliso Mulaisho wrote: I am wondering if there is a good way to work with data that is indexed in time, via timestamps with a resolution in milliseconds. As I understand it, the POSIX classes have a resolution i n terms of seconds, and will not process fracti

Re: [R] Millisecond TimeStamps

2011-03-24 Thread Dirk Eddelbuettel
On 24 March 2011 at 13:13, Madaliso Mulaisho wrote: | I am wondering if there is a good way to work with data that is indexed in | time, via timestamps with a resolution in milliseconds. As I understand it, | the POSIX classes have a resolution i n terms of seconds, and will not | process fractio

Re: [R] How create vector that sums correct responses for multiple subjects?

2011-03-24 Thread Jorge Ivan Velez
Hi Kevin, Try this (untested): sapply(split(pretestdata, Subject), function(l) with(l$Correct == "C")) HTH, Jorge On Thu, Mar 24, 2011 at 3:24 PM, Kevin Burnham <> wrote: > I have a data file with indicates pretest scores for a linguistics > experiment. The data are in long form so for each

Re: [R] How create vector that sums correct responses for multiple subjects?

2011-03-24 Thread Sarah Goslee
Try this: tapply(mydata$Correct, mydata$Subject, function(x)sum(x == "C")) Sarah On Thu, Mar 24, 2011 at 3:24 PM, Kevin Burnham wrote: > I have a data file with indicates pretest scores for a linguistics > experiment.  The data are in long form so for each of 33 subjects there are > 400 rows, o

Re: [R] apply mean to a three-dimension data

2011-03-24 Thread Jorge Ivan Velez
Hi Hui, Ssee ?Reduce for more details. You might try something along the lines of > mymean <- function(x) Reduce("+", x)/length(x) > add(b) [,1] [,2] [1,] 10.3 12.3 [2,] 11.3 13.3 HTH, Jorge On Thu, Mar 24, 2011 at 11:07 AM, Hui Du <> wrote: > Hi All, > >

Re: [R] apply mean to a three-dimension data

2011-03-24 Thread Jorge Ivan Velez
Sorry, the above should have been > mymean <- function(x) Reduce("+", x)/length(x) > mymean(b) [,1] [,2] [1,] 10.3 12.3 [2,] 11.3 13.3 Apologies for the noise. Best, Jorge On Thu, Mar 24, 2011 at 3:54 PM, Jorge Ivan Velez <> wrote: > Hi Hui, > > Ssee ?Reduce for m

Re: [R] Millisecond TimeStamps

2011-03-24 Thread David Reiner
?strptime or ?options > d1 <- as.POSIXct("2009-09-30 10:00:00.543") > d1 [1] "2009-09-30 10:00:00 CDT" > # Oh, yeah, I forgot > op <- options(digits.secs=6) # or 3 > d1 [1] "2009-09-30 10:00:00.543 CDT" > # The accuracy was there already HTH, David L. Reiner, PhD Head Quant XR Trading LLC -

Re: [R] Questions for "domist... subscript out of bounds"

2011-03-24 Thread Sarah Goslee
> I want to use "domain" function to run species distribution model in R. > I used "sp.occ.do<-domain(env.pre, pred_train, factors=c('continent')) & > sp.occ.pre.pro<-predict(env.pre, sp.occ.do)" to predict species distribution. > BUT, I got "Error in domdist(object, ln[j], vals[, ln[j]]) : subscr

Re: [R] apply mean to a three-dimension data

2011-03-24 Thread David Winsemius
Are you taking the same online course as Barth Riley, who posed a very similar question only this morning? On Mar 24, 2011, at 11:07 AM, Hui Du wrote: Hi All, Suppose I have data like b[[1]] = matrix(1:4, 2, 2) b[[2]] = matrix(10:13, 2, 2) b[[3]] = matrix(20:23, 2, 2) [[1]]

Re: [R] Longitudinal categorical response data

2011-03-24 Thread Ingmar Visser
package msm has some examples with this type of type, ie modeling disease state transitions in continuous time, using multi-state markov models. hth, Ingmar On Thu, Mar 24, 2011 at 6:22 PM, Rasanga Ruwanthi wrote: > Dear List, > > I have some longitudinal data, each patient was followed at times

Re: [R] Storing user-defined R functions

2011-03-24 Thread Thomas Lumley
On Fri, Mar 25, 2011 at 5:11 AM, David.Epstein wrote: > Hello, I don't want to find out how to make packages unless that becomes > necessary. Also, I don't want to clog up the computer memory with functions > that I'm not using. (It would be great if someone in this forum would > explain how memor

Re: [R] Estimating correlation in multiple measures data

2011-03-24 Thread Michal Figurski
Peter, Regarding 1) I do not agree. See the following, simplified example: x <- data.frame(ID=rep(1:2, each=4), Visit=rep(c(1:4), 2), ptA=c(7,8,9,10,17,18,19,20), ptB=c(5,6,7,8,21,20,19,18)) In this data frame you have only 2 patients with 4 visits each, but the correlation of ptA and ptB is

[R] How create vector that sums correct responses for multiple subjects?

2011-03-24 Thread Kevin Burnham
I have a data file with indicates pretest scores for a linguistics experiment. The data are in long form so for each of 33 subjects there are 400 rows, one for each item on the test, and there is a column called ‘Correct’ that shows ‘C’ for a correct response and ‘E’ for an incorrect response. I

[R] Help with creating a ts (time series) object with daily sampling values

2011-03-24 Thread Pamela Allen
Hi All, I have a data set of daily measurements of river flow. I would like to create a "ts" object from this data. Here's a sample data set: date <- as.Date(c(1:300), format="%Y") year=as.numeric(format(date, format = "%Y")) month=as.numeric(format(date, format = "%m")) julianday=

[R] debug R device plot

2011-03-24 Thread Michael Bach
Hi there, I was doing great with R, ggplot and tikzDevice, when suddenly it stopped working. I can do a plot just fine on the R online graphics device. I can also open a tikzdevice via tikz(). However, the plot (both ggplot and R graphics plot) call leads to the error: "createLockFile(lockname):

[R] Colour makes my life; but not my bwplot (panel.violin)

2011-03-24 Thread JP
Using Trellis, am successfully setting up a number of panels (25) in which I have two box and violin plots. I would like to colour - one plot as RED and the other as BLUE (in each panel). I can do that with the box plots, but the violin density areas just take on one colour. My basic call is as

[R] Longitudinal categorical response data

2011-03-24 Thread Rasanga Ruwanthi
Dear List,   I have some longitudinal data, each patient was followed at times 0, 12, 16, 24 weeks and measure severity of a illness (0-worse, 1-same, 2-better). So, longitudinal response is categorical.  I was wondering whether lmer in R can fit a model for this type of data. If so, how we code

[R] Questions for "domist... subscript out of bounds"

2011-03-24 Thread jessiecy2001
Hi all, I am a new user for R. I faced a questions about subscript out of bounds. Although I checked some other helps before I sent this email, I still don't know how to deal with this problems. I want to use "domain" function to run species distribution model in R. I used "sp.occ.do<-domain

Re: [R] R CMD build creates tar file instead of tar.gz file

2011-03-24 Thread Gabor Grothendieck
On Thu, Mar 24, 2011 at 12:36 PM, Ian Schiller wrote: > Thanks for your prompt answer Mr. Ripley.  It appears the version of tar I'm > using is exactly the same as the one included in the latest Rtools.  I > noticed that the Rtools/bin directory was not first in path, so I corrected > this.  Ho

Re: [R] Comparing non nested models with correlation coefficients (inspired from Lorch and Myers )

2011-03-24 Thread Bert Gunter
Yes, yes statisticians. But just remember that this is a plague that we have visited on ourselves. And continue to -- just peruse practically any statistical journal. ("People who live in grass houses shouldn't stow thrones") Cheers, Bert (To non-native English speakers: my apologies for the bad

Re: [R] R CMD build creates tar file instead of tar.gz file

2011-03-24 Thread Gabor Grothendieck
On Thu, Mar 24, 2011 at 1:28 PM, Ian Schiller wrote: > Ok guys.  First thanks again for your help.  It is very appreciated.  Now > here's the thing.  I downloaded the Rcmd.bat and included in the path.  I've > also changed the location of the package source and ran R CMD build mypackage > (Rcmd

[R] Storing user-defined R functions

2011-03-24 Thread David.Epstein
Hello, I don't want to find out how to make packages unless that becomes necessary. Also, I don't want to clog up the computer memory with functions that I'm not using. (It would be great if someone in this forum would explain how memory is used when I type library(MASS) and then use only one funct

[R] Millisecond TimeStamps

2011-03-24 Thread Madaliso Mulaisho
I am wondering if there is a good way to work with data that is indexed in time, via timestamps with a resolution in milliseconds. As I understand it, the POSIX classes have a resolution i n terms of seconds, and will not process fractional seconds from a string. Is this correct. I realize that

Re: [R] R CMD build creates tar file instead of tar.gz file

2011-03-24 Thread Duncan Murdoch
On 24/03/2011 12:36 PM, Ian Schiller wrote: Thanks for your prompt answer Mr. Ripley. Although Brian Ripley is faster at most things than I am, in this case I was more prompt than him. It appears the version of tar I'm using is exactly the same as the one included in the latest Rtools.

[R] apply mean to a three-dimension data

2011-03-24 Thread Hui Du
Hi All, Suppose I have data like [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide

[R] apply mean to a three-dimension data

2011-03-24 Thread Hui Du
Hi All, Suppose I have data like b[[1]] = matrix(1:4, 2, 2) b[[2]] = matrix(10:13, 2, 2) b[[3]] = matrix(20:23, 2, 2) [[1]] [,1] [,2] [1,]13 [2,]24 [[2]] [,1] [,2] [1,] 10 12 [2,] 11 13 [[3]] [,1] [,2] [1,] 20 22 [2,] 21 23

Re: [R] Ctree Model Variables

2011-03-24 Thread Achim Zeileis
On Thu, 24 Mar 2011, jdanielnd wrote: Hello! I am not familiar to deal with S4 objects in R, so this question can be stupid, but I hope I can get an answer. :P I'm trying to extract what are the response and explanatory variables from a Binary Tree and Random Forest. I could already extract t

[R] Help with creating a ts (time series) object with daily sampling values

2011-03-24 Thread Pamela Allen
Hi All, I have a data set of daily measurements of river flow. I would like to create a “ts” object from this data. Here’s a sample data set: date <- as.Date(c(1:300), format="%Y") year=as.numeric(format(date, format = "%Y")) month=as.numeric(format(date, format = "%m")) juliand

Re: [R] R CMD build creates tar file instead of tar.gz file

2011-03-24 Thread Prof Brian Ripley
For the record, you can avoid all the Cygwin tar problems in 2.13.0 by setting the environment variable TAR to 'internal': you most likely do not even need Rtools. You may get other issues, though (especially from Cygwin and permissions), which is why it is not the default yet on Windows. On

Re: [R] R CMD build creates tar file instead of tar.gz file

2011-03-24 Thread Ian Schiller
> (Rcmd.bat is not working so I assume there is something I'm doing wrong) I'd just like to let everyone knows that Rcmd.bat IS working properly after all. I had messed with the PATH "environmental variable". In fact, like Gabor Grothendieck pointed out to me, one can just copy the Rcmd.bat fi

Re: [R] R CMD build creates tar file instead of tar.gz file

2011-03-24 Thread Ian Schiller
> You likely have the Hide extensions options enabled on your Windows system. Yes you're right! Guys, I thank you all for your precious help! Ian ** IAN SCHILLER, M.Sc. S

Re: [R] R CMD build creates tar file instead of tar.gz file

2011-03-24 Thread Ian Schiller
Ok guys. First thanks again for your help. It is very appreciated. Now here's the thing. I downloaded the Rcmd.bat and included in the path. I've also changed the location of the package source and ran R CMD build mypackage (Rcmd.bat is not working so I assume there is something I'm doing w

Re: [R] R CMD build creates tar file instead of tar.gz file

2011-03-24 Thread Ian Schiller
> A couple of things to try: - try re-installing Rtools and R - put Rcmd.bat from http://batchfiles.googlecode.com on your path and then try re-building Rcmd.bat build mypackage Rcmd.bat will automatically find R and certain other files from the registry and temporarily set certain environment va

Re: [R] R CMD build creates tar file instead of tar.gz file

2011-03-24 Thread Ian Schiller
> Although Brian Ripley is faster at most things than I am, in this case I was more prompt than him. My mistake. I'm sorry! > I don't know the CRAN policy on this, but I think it would be worthwhile fixing the problem you can see, in case there are other problems that you can't see. Agree.

Re: [R] R CMD build creates tar file instead of tar.gz file

2011-03-24 Thread Ian Schiller
Oh Sorry Mr Murdoch! I read a post where both you and Brian Ripley were involved and the confusion probably arose from that! Ok thanks Mr Ligges. Ian ** IAN SCHILLER, M

Re: [R] R CMD build creates tar file instead of tar.gz file

2011-03-24 Thread Uwe Ligges
On 24.03.2011 17:36, Ian Schiller wrote: Thanks for your prompt answer Mr. Ripley. It appears the version of tar I'm using is exactly the same as the one included in the latest Rtools. I noticed that the Rtools/bin directory was not first in path, so I corrected this. However, I'm still n

Re: [R] R CMD build creates tar file instead of tar.gz file

2011-03-24 Thread Ian Schiller
Thanks for your prompt answer Mr. Ripley. It appears the version of tar I'm using is exactly the same as the one included in the latest Rtools. I noticed that the Rtools/bin directory was not first in path, so I corrected this. However, I'm still not able to create a tar.gz file with the R CM

Re: [R] write all the permutations of a set

2011-03-24 Thread Arnau Mir
Thanks a lot, Arnau. El 24/03/2011, a las 16:46, Bernd Weiss escribió: > Am 24.03.2011 11:28, schrieb Arnau Mir: >> Hello. >> >> Somebody knows how to write in R all the permutations of a given set? >> For example, is the set is {a,b,c} I want the following: >> a,b,c >> a,c,b >> b,c,a >> b,a,c >

Re: [R] subset and as.POSIXct / as.POSIXlt oddness

2011-03-24 Thread Gabor Grothendieck
On Thu, Mar 24, 2011 at 9:29 AM, Michael Bach wrote: > Dear R users, > > Given this data: > > x <- seq(1,100,1) > dx <- as.POSIXct(x*900, origin="2007-06-01 00:00:00") > dfx <- data.frame(dx) > > Now to play around for example: > > subset(dfx, dx > as.POSIXct("2007-06-01 16:00:00")) > > Ok. Now fo

Re: [R] Installing rJava fails

2011-03-24 Thread jcheng liu
Dear Orvalho Augusto, Thanks for your response. But we met a new problem. We set as waht you said in the last email and run installing agian. But we got the error: rJava.h:22:17: error: jni.h: No such file or directory. Actually we had found "jni.h" under {JAVA_HOME}/../include and the path had be

Re: [R] Comparing non nested models with correlation coefficients (inspired from Lorch and Myers )

2011-03-24 Thread Greg Snow
Well this starts veering towards fortune(194) and fortune(218). Though I did one time receive a response from an editor and reviewers asking for fewer p-values in favor of more confidence intervals. I was excited that someone was willing to move in that direction (unfortunately, that particular

Re: [R] write all the permutations of a set

2011-03-24 Thread Bernd Weiss
Am 24.03.2011 11:28, schrieb Arnau Mir: Hello. Somebody knows how to write in R all the permutations of a given set? For example, is the set is {a,b,c} I want the following: a,b,c a,c,b b,c,a b,a,c c,a,b c,b,a library(gregmisc) permutations(3, 3, letters[1:3]) gives [,1] [,2] [,3] [1,]

Re: [R] subset and as.POSIXct / as.POSIXlt oddness

2011-03-24 Thread David Winsemius
On Mar 24, 2011, at 10:02 AM, Michael Bach wrote: > Hi David, > > your approach selects the datapoints between "2007-06-01 10:00:00" > and "2007-06-01 14:00:00" true enough. However, my real dataset is > for several months and years. So I need data points between 10:00:00 > and 14:00:00 onl

[R] write all the permutations of a set

2011-03-24 Thread Arnau Mir
Hello. Somebody knows how to write in R all the permutations of a given set? For example, is the set is {a,b,c} I want the following: a,b,c a,c,b b,c,a b,a,c c,a,b c,b,a Thanks, Arnau. Arnau Mir Torres Edifici A. Turmeda Campus UIB Ctr

Re: [R] subset and as.POSIXct / as.POSIXlt oddness

2011-03-24 Thread Michael Bach
> > I wanted to point out that this is a little easier to express with the > lubridate package: > > subset(dfx, dx > ymd("2007-06-01") & hour(dx) > 14 & hour(x) < 10) > Thanks, will have a look at it.. > > but I presume you meant: > > subset(dfx, dx > ymd("2007-06-01") & hour(dx) > 10 & hour(x)

Re: [R] subset and as.POSIXct / as.POSIXlt oddness

2011-03-24 Thread Michael Bach
@Kenn: Yeah I have a way of loosing concentration when fiddling around and trying to get it work. Thanks for pointing out that I supplied a third argument when I wanted an additional test in the second argument instead. Also my selection choices indeed do not make any sense, no wonder your "parser"

Re: [R] subset and as.POSIXct / as.POSIXlt oddness

2011-03-24 Thread Hadley Wickham
On Thu, Mar 24, 2011 at 8:29 AM, Michael Bach wrote: > Dear R users, > > Given this data: > > x <- seq(1,100,1) > dx <- as.POSIXct(x*900, origin="2007-06-01 00:00:00") > dfx <- data.frame(dx) > > Now to play around for example: > > subset(dfx, dx > as.POSIXct("2007-06-01 16:00:00")) > > Ok. Now fo

Re: [R] predict.rpart help

2011-03-24 Thread Terry Therneau
Make your own copy of predict.rpart: mypredict <- rpart:::predict.rpart (Even better to grab the source code version, then you can start with a copy that has comments in it!) Edit it to add type='where': about 1/3 of the way down you will see that the routine has computed a variable "where"; th

Re: [R] R CMD build creates tar file instead of tar.gz file

2011-03-24 Thread Duncan Murdoch
On 24/03/2011 10:36 AM, Ian Schiller wrote: Dear all, I'm trying to create my own package by following for instance http://epub.ub.uni-muenchen.de/6175/2/tr036.pdf In step 6 (page 19) it says that the command 'R CMD build' should result in a tar.gz file. However, after running the command I

Re: [R] subset and as.POSIXct / as.POSIXlt oddness

2011-03-24 Thread Jeff Newmiller
On 03/24/2011 06:29 AM, Michael Bach wrote: Dear R users, Given this data: x<- seq(1,100,1) dx<- as.POSIXct(x*900, origin="2007-06-01 00:00:00") dfx<- data.frame(dx) Now to play around for example: subset(dfx, dx> as.POSIXct("2007-06-01 16:00:00")) Ok. Now for some reason I want to extract

[R] R CMD build creates tar file instead of tar.gz file

2011-03-24 Thread Ian Schiller
Dear all, I'm trying to create my own package by following for instance http://epub.ub.uni-muenchen.de/6175/2/tr036.pdf In step 6 (page 19) it says that the command 'R CMD build ' should result in a tar.gz file. However, after running the command I end up with a tar file only (no gz extensio

[R] questions regarding stat_smooth in ggplot area plot

2011-03-24 Thread jovian
Hello, I drew a simple area plot using ggplot2 using set <- read.table(file="http://www.jovian.nl/set.csv";, head=1, sep=",") library(ggplot2) ggplot() + layer( data = set, mapping = aes(x = time, y = hours), geom = "area", stat="smooth", color="red" ) + layer( data = set, mapping = aes(x

Re: [R] subset and as.POSIXct / as.POSIXlt oddness

2011-03-24 Thread Kenn Konstabel
On Thu, Mar 24, 2011 at 1:29 PM, Michael Bach wrote: > Dear R users, > > Given this data: > > x <- seq(1,100,1) > dx <- as.POSIXct(x*900, origin="2007-06-01 00:00:00") > dfx <- data.frame(dx) > > Now to play around for example: > > subset(dfx, dx > as.POSIXct("2007-06-01 16:00:00")) > > Ok. Now fo

[R] Ctree Model Variables

2011-03-24 Thread jdanielnd
Hello! I am not familiar to deal with S4 objects in R, so this question can be stupid, but I hope I can get an answer. :P I'm trying to extract what are the response and explanatory variables from a Binary Tree and Random Forest. I could already extract the response variable from a Binary Tree u

Re: [R] Help needed with plot axis labeling

2011-03-24 Thread Sarah Goslee
Thomas, You need to specify both the labels and the desired location: plot(1:10, xaxt = "n") axis(1, xaxp=c(2, 9, 7)) axis(4, labels=c("A", "B", "C", "D", "E"), at=seq(2, 10, by=2)) You want the labels at 2,4,6,8,10 so you need to specify that, not 1:5. Sarah On Thu, Mar 24, 2011 at 9:55 AM, T

Re: [R] subset and as.POSIXct / as.POSIXlt oddness

2011-03-24 Thread Michael Bach
Hi David, your approach selects the datapoints between "2007-06-01 10:00:00" and "2007-06-01 14:00:00" true enough. However, my real dataset is for several months and years. So I need data points between 10:00:00 and 14:00:00 only - independent of the date. I thought the name for that is "aggregat

[R] Help needed with plot axis labeling

2011-03-24 Thread Thomas Adams
I have looked at many examples and tried many different combinations of doing this, but with no luck. I have something like this: plot(1:10, xaxt = "n") axis(1, xaxp=c(2, 9, 7)) axis(4) but, what I need is to have different labels for axis-4 than those for axis-2 (the vertical axes) — that is

Re: [R] subset and as.POSIXct / as.POSIXlt oddness

2011-03-24 Thread David Winsemius
On Mar 24, 2011, at 9:29 AM, Michael Bach wrote: Dear R users, Given this data: x <- seq(1,100,1) dx <- as.POSIXct(x*900, origin="2007-06-01 00:00:00") dfx <- data.frame(dx) Now to play around for example: subset(dfx, dx > as.POSIXct("2007-06-01 16:00:00")) Ok. Now for some reason I want t

Re: [R] ) Error in eval(expr, envir, enclos) : object '' not found

2011-03-24 Thread mipplor
thx , i have solved this by sep="," -- View this message in context: http://r.789695.n4.nabble.com/Error-in-eval-expr-envir-enclos-object-not-found-tp3399503p3402403.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

[R] subset and as.POSIXct / as.POSIXlt oddness

2011-03-24 Thread Michael Bach
Dear R users, Given this data: x <- seq(1,100,1) dx <- as.POSIXct(x*900, origin="2007-06-01 00:00:00") dfx <- data.frame(dx) Now to play around for example: subset(dfx, dx > as.POSIXct("2007-06-01 16:00:00")) Ok. Now for some reason I want to extract the datapoints between hours 10:00:00 and 1

Re: [R] Collapsing/aggregating columns in a matrix

2011-03-24 Thread Ista Zahn
Hi Barth, Use rowMeans() like this: mat <- matrix(rnorm(100), ncol=10) cbind(sum1.5 = rowSums(mat[,1:5]), sum2.6 = rowSums(mat[,2:6])) Best, Ista On Thu, Mar 24, 2011 at 12:10 PM, Barth B. Riley wrote: > Dear list > > I want to know if there is a function in R that enables one to create a new >

Re: [R] Extract the names of the arguments in an "expression"

2011-03-24 Thread Duncan Murdoch
An improvement on my suggestion using codetools is to use codetools::findGlobals(f, merge=FALSE) which separates the functions and variables: $functions [1] "*" "cos" $variables [1] "omega" "rho" This is important, because R distinguishes between functions and variables by usage when it is

Re: [R] various plotting options

2011-03-24 Thread Michael Friendly
On 3/23/2011 10:27 AM, Grossmann Patrick wrote: Dear R-Project helpdesk member, I am currently working on some basic correspondence analysis using the R packages 'ca'. As I compute the CA by example<- ca(data), and plotting example via plot(example), I am trying to figure out, how to get

Re: [R] Extract the names of the arguments in an "expression"

2011-03-24 Thread Gabor Grothendieck
2011/3/24 Javier López-de-Lacalle : > Hi everybody: > > I need to get the names of the arguments in an object of class "expression". > I've got the following expression: > >> x <- expression(rho * cos(omega)) > > Is there any function or procedure that returns the names of the arguments > (in the e

Re: [R] ) Error in eval(expr, envir, enclos) : object '' not found

2011-03-24 Thread David Winsemius
On Mar 23, 2011, at 5:35 PM, mipplor wrote: exactly, i dont know why the header are separated by invisible periods. and it only happen to the header. If it continues as a problem, it because you have not followed my advice from yesterday. -- View this message in context: http://r.78

Re: [R] Extract the names of the arguments in an "expression"

2011-03-24 Thread Kenn Konstabel
I tried this as an exercise and here's what I arrived to: collector <- function(expr){ RES <- list() foo <- function(x) unlist(lapply(x, as.list)) EXPR <- foo(expr) while(length(EXPR) >0){ if(is.symbol(EXPR[[1]])){ RES <- c(RES, EXPR[[1]]) EXPR <- EXPR[-1

[R] Two matrix loop

2011-03-24 Thread Stefan Petersson
Hi, I'm trying to create a distance matrix. And it works out somewhat ok. However, I suspect that there are some efficiency issues with my efforts. Plz have a look at this: donor <- matrix(c(3,1,2,3,3,1,4,3,5,1,3,2), ncol=4) receiver <- matrix(c(1,4,3,2,4,3,1,5,1,3,2,1,4,5,3,5,1,3,2,4,5,1,2,3

[R] Collapsing/aggregating columns in a matrix

2011-03-24 Thread Barth B. Riley
Dear list I want to know if there is a function in R that enables one to create a new matrix based on values in an existing matrix, whereby each column in the new matrix is a row-specific summary (e.g., sum, mean) of multiple columns in the original matrix. For instance, to take a 12-column mat

Re: [R] Extract the names of the arguments in an "expression"

2011-03-24 Thread Duncan Murdoch
On 11-03-24 5:03 AM, Javier López-de-Lacalle wrote: Hi everybody: I need to get the names of the arguments in an object of class "expression". I've got the following expression: x<- expression(rho * cos(omega)) Is there any function or procedure that returns the names of the arguments (in th

Re: [R] fraction with timelag

2011-03-24 Thread Bill.Venables
How about simply > df <- data.frame(id = 1:6, + xout = c(12.34, 21.34, 2.34, 4.56, 3.24, 3.45), + xin = c(NA, 34,67,87,34, NA)) > > with(df, c(NA, xin[-1]/xout[-length(xout)])) [1]NA 2.755267 3.139644 37.179487 7.456140NA > BTW You seem to

Re: [R] Problem with Snowball & RWeka

2011-03-24 Thread Mike Marchywka
> Date: Thu, 24 Mar 2011 03:35:31 -0700 > From: kont...@alexanderbachmann.de > To: r-help@r-project.org > Subject: [R] Problem with Snowball & RWeka > > Dear Forum, > > when I try to use SnowballStemmer() I get the following error message: > > "Could not i

[R] fraction with timelag

2011-03-24 Thread Patrick Hausmann
Dear r-help, I'm having this DF df <- data.frame(id = 1:6, xout = c(1234, 2134, 234, 456, 324, 345), xin= c(NA, 34,67,87,34, NA)) and would like to calculate the fraction (xin_t / xout_t-1) The result should be: # NA, 2.76, 3.14, 37.18, 7.46, NA I am sure ther

Re: [R] recommended reading for manual maximum likelihood of a system of equations

2011-03-24 Thread Arne Henningsen
Hi Alex On 24 March 2011 04:47, Alex Olssen wrote: > I am looking for some recommended reading. > > I want to read up on the estimation systems of linear equations using > maximum likelihood? For a comprehensive review of estimating systems of linear equations, see: http://www.jstatsoft.org/v

[R] Problem with Snowball & RWeka

2011-03-24 Thread AlexB84
Dear Forum, when I try to use SnowballStemmer() I get the following error message: "Could not initialize the GenericPropertiesCreator. This exception was produced: java.lang.NullPointerException" It seems to have something to do with either Snowball or RWeka, however I can't figure out, what to

[R] Extract the names of the arguments in an "expression"

2011-03-24 Thread Javier López-de-Lacalle
Hi everybody: I need to get the names of the arguments in an object of class "expression". I've got the following expression: > x <- expression(rho * cos(omega)) Is there any function or procedure that returns the names of the arguments (in the example: "rho" and "omega")? I tried a rough appro

[R] JRI execution problem

2011-03-24 Thread wesley mathew
Dear All I don't know is this right place to ask this question. I made one program in R environment and now I need to call that program from the from the java application using JRI package. I tried in both eclipse and java compiler but the Rengine re = new Rengine(args, false, new TextConsole());

Re: [R] Comparing non nested models with correlation coefficients (inspired from Lorch and Myers )

2011-03-24 Thread Jim Lemon
On 03/24/2011 06:30 PM, Dieter Menne wrote: ... Nobody ever got fired for producing a p-value :-( Oh, fortune, fortune! Or an R-squared! Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

[R] Problems with predict in fGarch

2011-03-24 Thread Luis Felipe Parra
Hello. I am using fGarch to estimate the following model: Call: garchFit(formula = fmla, data = X[, i], trace = F) Mean and Variance Equation: data ~ arma(1, 1) + garch(1, 1) Conditional Distribution: norm Coefficient(s): mu ar1 ma1 omegaalpha1 beta1 -0.94934

Re: [R] binary exogenous variable in path analysis in sem or lavaan

2011-03-24 Thread yrosseel
Rob, If 'sex' is indeed an exogenous variable (ie. predictor only), you can simply code it as (1=male, 2=female) and use it as a covariate in any sem model. In lavaan, you can explicitly use the argument 'fixed.x=TRUE', which will regard all exogenous covariates as fixed variables. Their means/var

  1   2   >