Re: [R] How to get the t-stat for arima()?

2013-03-20 Thread Prof Brian Ripley
On 19/03/2013 22:26, Rui Barradas wrote: Hello, Sorry for the error, the sqrt(n - 1) is wrong. Delete it: t.stat - coef(fit)/se Note though that this is a z ratio, not a 't-stat', whatever that is. Its utility is moot: coefficients of ARMA models are constrained, and if there is more than

[R] Unable to start with package rattle

2013-03-20 Thread Jun_Kim
Dear, I recently installed R 2.15.3 and R-package named “rattle” for data mining. After I typed “rattle()” for start, pop-up window appeared. (pop-up window saying Need GTK+? -- Install GTK+ / Do not Install GTK+ Whether I clicked “OK” or Cancel, error message appeared. (Error message saying ...

Re: [R] Introduction to R. Any such documentation in Vietnamese?

2013-03-20 Thread Alain Guillet
There is a contributed section on the http://cran.r-project.org/. Go to it, there is a vietnamese document to introduce R. Alain Guillet On 20/03/2013 02:06, Peter Alspach wrote: Dear fellow users Are there any Vietnamese language resources for beginners of R? If so, I would be interested

Re: [R] Unable to start with package rattle

2013-03-20 Thread Uwe Ligges
Works for me, have you run update.packages(checkBuilt=TRUE) recently? Otherwise, check your GTK installation. Uwe Ligges On 20.03.2013 09:08, Jun_Kim wrote: Dear, I recently installed R 2.15.3 and R-package named “rattle” for data mining. After I typed “rattle()” for start, pop-up window

Re: [R] Unable to start with package rattle

2013-03-20 Thread Jun_Kim
Thank you for reply. After I updated packages as you said, the same error message appeared. I have installed RGtk2 and RGtk Extras. Is there additional GTK I need? -- View this message in context: http://r.789695.n4.nabble.com/Unable-to-start-with-package-rattle-tp4661881p4661885.html Sent

Re: [R] Error when adding lines to a plot using the mixed-effect model and metafor package

2013-03-20 Thread Viechtbauer Wolfgang (STAT)
See comments below. Best, Wolfgang -- Wolfgang Viechtbauer, Ph.D., Statistician Department of Psychiatry and Psychology School for Mental Health and Neuroscience Faculty of Health, Medicine, and Life Sciences Maastricht University, P.O. Box 616 (VIJV1) 6200 MD Maastricht, The

Re: [R] How to get the t-stat for arima()?

2013-03-20 Thread Jose Iparraguirre
Rebecca, Not to contradict Prof. Ripley re the merits and de-merits of the z ratios in an ARMA setting -far from it-, I'd like to point out that in the package cashcrono you can find the function t_stat() to compute the t-statistics tests for the coefficients of Arima models. José José

[R] help on extracting values from a matrix

2013-03-20 Thread Andras Farkas
Dear All,   any thoughts on how I can do the following:   let us say we have:   a -c(2,4,16,28,48) b -c(10,4,2,0.4,0.03) d -cbind(a,b)   what I would like to do is to extract values of column b in the matrix based on the corresponding values of column a. For example: I would like to extract all

Re: [R] help on extracting values from a matrix

2013-03-20 Thread Pierrick Bruneau
Hi, Well, simply : d[a24,2] should do the trick. Pierrick Bruneau CRP Gabriel Lippmann On Wed, Mar 20, 2013 at 12:53 PM, Andras Farkas motyoc...@yahoo.com wrote: Dear All, any thoughts on how I can do the following: let us say we have: a -c(2,4,16,28,48) b -c(10,4,2,0.4,0.03) d

Re: [R] How to get the t-stat for arima()?

2013-03-20 Thread Kevin E. Thorpe
On 03/20/2013 03:49 AM, Prof Brian Ripley wrote: If things are not readily available in R it is always good to pause and reflect if there might be a good reason. I nominate this as a fortune candidate. -- Kevin E. Thorpe Head of Biostatistics, Applied Health Research Centre (AHRC) Li Ka

[R] [R-pkgs] Versions 0.50-1 of the np and npRmpi packages released - new features and deprecated options…

2013-03-20 Thread Jeffrey Racine
Dear useRs, We are pleased to announce that versions 0.50-1 of the np package and its MPI-aware counterpart, the npRmpi package, are now available on CRAN: http://cran.r-project.org/web/packages/np/index.html http://cran.r-project.org/web/packages/npRmpi/index.html In these versions we add new

[R] on R package vignette

2013-03-20 Thread Han Lin Shang
Dear R core team and R users, I am building a vignette for an existing R package on CRAN. In the example section of the vignette document, I require a non-cran R package (currently available at my co-author's personal website) for loading data. My question is: I am not sure if I am allowed to

[R] Histogram equalization of dataset

2013-03-20 Thread SpaceSeller
I read about histogram equalization of dataset. It is commonly used for image data. It is written: Each variable in dataset is assigned to one bin. Then, each variable in the dataset is assigned to one bin, incrementing the value of that bin by one. Then, a cumulative histogram is created by

Re: [R] data.frame with NA

2013-03-20 Thread Pietro
Thank you David and thank you Petr At 14.18 19/03/2013, David L Carlson wrote: Try this instead: Foglio1[,2:ncol(Foglio1)] - na.locf(Foglio1[,2:ncol(Foglio1)],fromLast=T) str(Foglio1) 'data.frame': 1489 obs. of 15 variables: $ Date: Date, format: 2001-08-17 2001-08-20 ... $ a : num

[R] highlight overlapping region of two densities

2013-03-20 Thread andrija djurovic
Hi all. I would like to highlight overlapping regions of two densities and I could not find a way to do it. Here is the sample code: myd - c(2,4,5, 4,3,2,2,3,3,3,2,3,3,4,2,4,3,3,3,2,2.5, 2, 3,3, 2.3, 3, 3, 2, 3) myd1 - myd-2 plot(range(density(myd)$x, density(myd1)$x),

Re: [R] Creating 3d partial dependence plots

2013-03-20 Thread Liaw, Andy
It needs to be done by hand, in that partialPlot() does not handle more than one variable at a time. You need to modify its code to do that (and be ready to wait even longer, as it can be slow). Andy -Original Message- From: r-help-boun...@r-project.org

[R] how to skip part of the code

2013-03-20 Thread Andras Farkas
Dear All,   another quick question, this one is on skipping part of my code, so let us say:   a -5 b -2 e -0   d -a+b f -a-b   what I would like to do is to have R NOT to calculate the value for d in case the value of e equals to zero (essentially skip that chunk), but instead move on to

Re: [R] highlight overlapping region of two densities

2013-03-20 Thread Pierrick Bruneau
Hi Andrija, As far as I understood, your problem comes from the density() function - the domains of myd and myd1 are different, which causes slightly shifted x values in the density() output. A simple workaround (which you maybe already came up with): dens1 - density(myd, from=-1, to=6) # force

Re: [R] how to skip part of the code

2013-03-20 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Andras Farkas Sent: Wednesday, March 20, 2013 2:11 PM To: r-help@r-project.org Subject: [R] how to skip part of the code Dear All, another quick question, this one is

Re: [R] on R package vignette

2013-03-20 Thread Prof Brian Ripley
On 20/03/2013 10:28, Han Lin Shang wrote: Dear R core team and R users, I am building a vignette for an existing R package on CRAN. In the example section of the vignette document, I require a non-cran R package (currently available at my co-author's personal website) for loading data. My

Re: [R] how to skip part of the code

2013-03-20 Thread Robert Baer
On 3/20/2013 8:21 AM, PIKAL Petr wrote: Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Andras Farkas Sent: Wednesday, March 20, 2013 2:11 PM To: r-help@r-project.org Subject: [R] how to skip part of the code Dear All,

Re: [R] How to get the t-stat for arima()?

2013-03-20 Thread John Kane
-Original Message- From: kevin.tho...@utoronto.ca Sent: Wed, 20 Mar 2013 08:02:36 -0400 To: r-help@r-project.org Subject: Re: [R] How to get the t-stat for arima()? On 03/20/2013 03:49 AM, Prof Brian Ripley wrote: If things are not readily available in R it is always good to

Re: [R] data.frame with NA

2013-03-20 Thread David Winsemius
On Mar 19, 2013, at 8:18 AM, David L Carlson wrote: Try this instead: Foglio1[,2:ncol(Foglio1)] - na.locf(Foglio1[, 2:ncol(Foglio1)],fromLast=T) str(Foglio1) 'data.frame': 1489 obs. of 15 variables: $ Date: Date, format: 2001-08-17 2001-08-20 ... $ a : num 202 201 202 201 202 ... $ b

Re: [R] How to subsetting data based on factor levels

2013-03-20 Thread capricy gao
Thanks a lot! Cc: R help r-help@r-project.org Sent: Tuesday, March 19, 2013 8:39 PM Subject: Re: [R] How to subsetting data based on factor levels levels(group) #[1] A C  levels(group)==A #[1]  TRUE FALSE a[,group==A] # A AB #[1,] 1  6 #[2,] 2  7

Re: [R] highlight overlapping region of two densities

2013-03-20 Thread andrija djurovic
Hi Pierrick, thanks for reply. This is the closest solution that I got. I also found something like this: dens1 - density(myd) dens2 - density(myd1) plot(range(dens1$x, dens2$x), range(dens1$y, dens2$y), type = n) polygon(dens1$x, dens1$y, col = rgb(1,0,0, .5),lwd=4, lty=2) polygon(dens2$x,

Re: [R] Unable to start with package rattle

2013-03-20 Thread David Winsemius
On Mar 20, 2013, at 3:56 AM, Jun_Kim wrote: Thank you for reply. After I updated packages as you said, the same error message appeared. I have installed RGtk2 and RGtk Extras. Is there additional GTK I need? Yes. RGtk2 is only interface support for GTK www.gtk.org/ Please read the Posting

Re: [R] highlight overlapping region of two densities

2013-03-20 Thread Marc Girondot
Le 20/03/13 13:32, andrija djurovic a écrit : Hi all. I would like to highlight overlapping regions of two densities and I could not find a way to do it. Here is the sample code: myd - c(2,4,5, 4,3,2,2,3,3,3,2,3,3,4,2,4,3,3,3,2,2.5, 2, 3,3, 2.3, 3, 3, 2, 3) myd1 - myd-2

Re: [R] how to skip part of the code

2013-03-20 Thread Andras Farkas
Dear Pikal and Robert,   thanks for the help, I guess trying the if function is worth it, and indeed, it works for the example I provided. Unfortunatelly though I am not getting the expected results with my actual code, which is a lot more complicated using R2OpenBUGS. Let me give you the

Re: [R] highlight overlapping region of two densities

2013-03-20 Thread Rui Barradas
Hello, Try the following. d0 - density(myd) d1 - density(myd1) idx0 - d0$x = 1 d0$x = 4 idx1 - d1$x = 1 d1$x = 4 yy - apply(cbind(d0$y[idx0], d1$y[idx1]), 1, min) xx - d0$x[idx0] xx - c(xx[1], xx, xx[1]) yy - c(0, yy, 0) polygon(xx, yy, col = blue) Hope this helps, Rui Barradas Em

Re: [R] how to skip part of the code

2013-03-20 Thread arun
Hi, set.seed(24)  dat1- data.frame(a=1:5,b=2:6,e=sample(c(0,1,2),5,replace=TRUE)) merge(within(subset(dat2,e0),d-a+b),within(subset(dat2,e==0),f-a-b),all=TRUE) #  a b e  d  f #1 1 2 0 NA -1 #2 2 3 0 NA -1 #3 3 4 2  7 NA # 4 5 1  9 NA #5 5 6 1 11 NA A.K. - Original Message - From:

Re: [R] how to skip part of the code

2013-03-20 Thread David Winsemius
On Mar 20, 2013, at 9:52 AM, Andras Farkas wrote: Dear Pikal and Robert, thanks for the help, I guess trying the if function is worth it, and indeed, it works for the example I provided. Unfortunatelly though I am not getting the expected results with my actual code, which is a lot more

[R] Pattern match

2013-03-20 Thread Christofer Bogaso
Hello again, in the help page of grep() function, it is written that pattern: character string containing a regular expression (or character string for fixed = TRUE) to be matched in the given character vector. Coerced by as.character to a character string if possible. If a character vector of

[R] S4 Reference Classes: undesired behavior when calling method '$field()'

2013-03-20 Thread Janko Thyson
Dear list, I came across a behavior that IMHO is somewhat undesired when calling '$field()': If the field name whose value you're trying to get is *not* a valid field of the Reference Class, then R doesn't stop there with an error, but scans through all enclosing environments/frames. The

Re: [R] S4 Reference Classes: undesired behavior when calling method '$field()'

2013-03-20 Thread Gabor Grothendieck
On Wed, Mar 20, 2013 at 12:38 PM, Janko Thyson janko.thyson.rst...@googlemail.com wrote: Dear list, I came across a behavior that IMHO is somewhat undesired when calling '$field()': If the field name whose value you're trying to get is *not* a valid field of the Reference Class, then R

Re: [R] Pattern match

2013-03-20 Thread Milan Bouchet-Valat
Le mercredi 20 mars 2013 à 21:58 +0530, Christofer Bogaso a écrit : Hello again, in the help page of grep() function, it is written that pattern: character string containing a regular expression (or character string for fixed = TRUE) to be matched in the given character vector. Coerced

Re: [R] misc3d Contour export to vtk

2013-03-20 Thread Duncan Murdoch
On 09/03/2013 7:45 PM, John Muschelli wrote: So I wanted to export a contour3d object into VTK and it worked well enough, except the top of the ball (the contour) was missing. Example below, or gist here: https://gist.github.com/muschellij2/5126544 I don't know VTK, but perhaps some other

[R] htmlParse (from XML library) working sporadically in the same code

2013-03-20 Thread Andre Zege
I am using htmlParse from XML library on a paricular website. Sometimes code fails, sometimes it works, most of the time id doesn't and i cannot see why. The file i am trying to parse is 

Re: [R] Bootstrap (bootSem) causes R to crash

2013-03-20 Thread pedroabg
I think we didn't receive this on the list. -- View this message in context: http://r.789695.n4.nabble.com/Bootstrap-bootSem-causes-R-to-crash-tp4661900p4661944.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] highlight overlapping region of two densities

2013-03-20 Thread andrija djurovic
Hi Rui. Thank you very much. I had similar idea like yours but your is more elegant. Andrija On Wed, Mar 20, 2013 at 4:03 PM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, Try the following. d0 - density(myd) d1 - density(myd1) idx0 - d0$x = 1 d0$x = 4 idx1 - d1$x = 1 d1$x = 4

Re: [R] Bootstrap (bootSem) causes R to crash

2013-03-20 Thread John Fox
Dear pedtroabq, I think that it's impossible to know from the information given why R crashes when bootSem() is called a second time after it worked the first time (which is how I interpret the message that you reference). I don't think that bootSem() is doing anything unusual -- it simply refits

Re: [R] htmlParse (from XML library) working sporadically in the same code

2013-03-20 Thread Duncan Temple Lang
When readHTMLTable() or more generally the HTML/XML parser fails to retrieve a URL, I suggest you use check to see if a different approach will work. You can use the download.file() function or readLines(url()) or getURLContent() from the RCurl package to get the content of the URL. The you can

[R] How to look at the source code for predict()

2013-03-20 Thread Yuan, Rebecca
Hello, I try to look at the source code of predict() it turns out that I cannot find it. I can see it with debug(library), but not efficient. Can someone help? Thanks, Rebecca -- This message, and any attachments, is for

Re: [R] How to get the t-stat for arima()?

2013-03-20 Thread Yuan, Rebecca
Hello Rui, Thanks very much! This works! Cheers, Rebecca -Original Message- From: Rui Barradas [mailto:ruipbarra...@sapo.pt] Sent: Tuesday, March 19, 2013 6:26 PM To: Yuan, Rebecca Cc: R help Subject: Re: [R] How to get the t-stat for arima()? Hello, Sorry for the error, the sqrt(n

Re: [R] RGL 3D plots are flat. Please Help

2013-03-20 Thread Duncan Murdoch
On 19/03/2013 1:12 AM, Ben Bolker wrote: Pascal Oettli kridox at ymail.com writes: Hi, Try by multiplying z by 1000. HTH Pascal Or try using persp3d() instead of rgl.surface() Or follow the call to rgl.surface with a call to aspect3d. (Actually, I generally recommend against using

Re: [R] How to look at the source code for predict()

2013-03-20 Thread Yuan, Rebecca
Hello all, I thought I found it, it is in the arima.R if I use arima to fit the model. But how could we see the source code of some function in R? Thanks, Rebecca From: Yuan, Rebecca Sent: Wednesday, March 20, 2013 2:38 PM To: R help Subject: How to look at the source code for predict()

Re: [R] How to look at the source code for predict()

2013-03-20 Thread R. Michael Weylandt
getS3method(predict, arima) Cheers, MW On Wed, Mar 20, 2013 at 6:43 PM, Yuan, Rebecca rebecca.y...@bankofamerica.com wrote: Hello all, I thought I found it, it is in the arima.R if I use arima to fit the model. But how could we see the source code of some function in R? Thanks, Rebecca

[R] unexpected local minima/maxima with surf.gls

2013-03-20 Thread Pantin Florent
Hi there, I use the surf.gls() function to fit a variable measured over a surface. When I plot the predicted surface, there are local minima/maxima in almost every coordinate where data were measured, which seems aberrant. For instance:    x -

[R] why a moving average fun takes too long time!!

2013-03-20 Thread Jonsson
I am calculating a moving average for 601 rasters (720, 1440)and it is taking a day to finish. I wonder if this is normal or something is wrong I am using Linux . code: dir1 - list.files(/home/spa4-358-4-365, *.img, full.names = TRUE) saf=stack(dir1) meansmosas -

[R] help pairs

2013-03-20 Thread Filippo Monari
Hi everybody, I'm exploring likelihood function having several parameters and I'm trying to work with pairs but I have the following problem. I need to colour my dots depending on the value of the likelihood of just two parameters, thus basically I need different colour scale for each plot of

Re: [R] Pattern match

2013-03-20 Thread Mark Sharp
I like the stringr package. Its functions allow vectors for the patterns. From the examples of str_detect() fruit - c(apple, banana, pear, pinapple) str_detect(fruit, a) [1] TRUE TRUE TRUE TRUE str_detect(fruit, ^a) [1] TRUE FALSE FALSE FALSE str_detect(fruit, a$) [1] FALSE TRUE FALSE

Re: [R] How to look at the source code for predict()

2013-03-20 Thread Duncan Murdoch
On 20/03/2013 2:43 PM, Yuan, Rebecca wrote: Hello all, I thought I found it, it is in the arima.R if I use arima to fit the model. But how could we see the source code of some function in R? The information in the article by Uwe Ligges in this issue of R News:

Re: [R] How to look at the source code for predict()

2013-03-20 Thread R. Michael Weylandt
On Wed, Mar 20, 2013 at 6:49 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: getS3method(predict, arima) Pardon -- it's either Arima or arima0 but not arima in this case. But, in general, getS3method is what you're looking for. Cheers, MW

[R] bigmemory: Using backing file as alternate to write.big.matrix

2013-03-20 Thread Shraddha Pai
Hi, Does the backing file of a big.matrix store the contents of entire matrix? Or does it store the portion of it that is not stored in RAM? In other words, can the backing file be treated as a file containing the matrix's full data? I have been writing my big.matrix objects to disk

[R] behaviour of formula objects and environment inside functions

2013-03-20 Thread Thomas Alexander Gerds
Dear List I am looking for the recommended way to create a formula inside a function with an empty environment. I tried several versions (see below), and one of them seemed to work, but I dont understand why there is a difference between .GlobalEnv and the environment inside a function. I would

Re: [R] R web application development

2013-03-20 Thread MacQueen, Don
I would go to the CRAN Packages web page and do a simple text search for web on that page. And easily find, for example Rook - a web server interface for R -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 3/18/13

Re: [R] help pairs

2013-03-20 Thread John Kane
https://github.com/hadley/devtools/wiki/Reproducibilityhttps://github.com/hadley/devtools/wiki/Reproducibility John Kane Kingston ON Canada -Original Message- From: ingf...@gmail.com Sent: Wed, 20 Mar 2013 18:18:17 + To: r-help@r-project.org Subject: [R] help pairs Hi

Re: [R] How to look at the source code for predict()

2013-03-20 Thread Yuan, Rebecca
Hello MW, Thanks very much! I use getS3method(predict,arima0) And be able to see the source code. Have a great day! Cheers, Rebecca -Original Message- From: R. Michael Weylandt [mailto:michael.weyla...@gmail.com] Sent: Wednesday, March 20, 2013 2:52 PM To: Yuan, Rebecca Cc: R

Re: [R] How to look at the source code for predict()

2013-03-20 Thread Yuan, Rebecca
Hello Duncan, Thanks for this link! A very good article that has useful information! Best, Rebecca -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: Wednesday, March 20, 2013 2:53 PM To: Yuan, Rebecca Cc: 'R help' Subject: Re: [R] How to look at the

Re: [R] Pattern match

2013-03-20 Thread Christofer Bogaso
Thanks Mark for your reply. Actually I was looking for following type of solution: grep((wti)|(asdf), c(aa, wti-fgg, wtihjg, fdsdasdf, wti)) [1] 2 3 4 5 However I was able to find the solution just using grep() function. On Wed, Mar 20, 2013 at 11:48 PM, Mark Sharp msh...@txbiomed.org wrote:

Re: [R] why a moving average fun takes too long time!!

2013-03-20 Thread MacQueen, Don
This looks like a question for r-sig-geo. -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 3/20/13 8:02 AM, Jonsson amen.alya...@bordeaux.inra.fr wrote: I am calculating a moving average for 601 rasters (720, 1440)and it is

Re: [R] R web application development

2013-03-20 Thread Gergely Daróczi
Hello John, sure, you might want to check out the below applications for your purposes with a dedicated server: * http://rapache.net * http://opencpu.org And we also do something similar at http://rapporter.net in the means of Rapplications on cloud servers. Best, Gergely On 19 March 2013

Re: [R] How to look at the source code for predict()

2013-03-20 Thread Rui Barradas
Hello, In the case of predict.Arima, you can type at an R prompt the following. stats:::predict.Arima Hope this helps, Rui Barradas Em 20-03-2013 18:43, Yuan, Rebecca escreveu: Hello all, I thought I found it, it is in the arima.R if I use arima to fit the model. But how could we see the

[R] summarize dataframe based on multiple cols, not their combinations

2013-03-20 Thread Alexander Shenkin
Hi folks, I'm trying to figure out how to get summarized data based on multiple columns. However, instead of giving summaries for every combination of categorical columns, I want it for each value of each categorical column regardless of the other columns. I could do this with three different

[R] Hands-on Webinar: Advances in Regression: Modern Ensemble and Data Mining Approaches (no charge)

2013-03-20 Thread Lisa Solomon
Hands-on Webinar (no charge) Advances in Regression: Modern Ensemble and Data Mining Approaches **Part of the series: The Evolution of Regression from Classical Linear Regression to Modern Ensembles Register Now for Parts 3, 4: https://www1.gotomeeting.com/register/500959705 **All registrants

Re: [R] summarize dataframe based on multiple cols, not their combinations

2013-03-20 Thread Ista Zahn
How about library(reshape2) mdf.m - melt(my_df, measure.vars=c(a, b, c)) mdf.m - mdf.m[mdf.m$value 0, ] ddply(mdf.m, variable, function(x) c(mean=mean(x$dat), n=nrow(x))) ? Best, Ista On Wed, Mar 20, 2013 at 3:57 PM, Alexander Shenkin ashen...@ufl.edu wrote: Hi folks, I'm trying to figure

Re: [R] summarize dataframe based on multiple cols, not their combinations

2013-03-20 Thread John Kane
Will this do? library(plyr) ddply(my_df, .(a), summarize, mm = mean(dat), number = length(dat)) John Kane Kingston ON Canada -Original Message- From: ashen...@ufl.edu Sent: Wed, 20 Mar 2013 14:57:36 -0500 To: r-help@r-project.org Subject: [R] summarize dataframe based on

Re: [R] summarize dataframe based on multiple cols, not their combinations

2013-03-20 Thread Alexander Shenkin
Nice, thanks Ista! On 3/20/2013 3:18 PM, Ista Zahn wrote: How about library(reshape2) mdf.m - melt(my_df, measure.vars=c(a, b, c)) mdf.m - mdf.m[mdf.m$value 0, ] ddply(mdf.m, variable, function(x) c(mean=mean(x$dat), n=nrow(x))) ? Best, Ista On Wed, Mar 20, 2013 at 3:57 PM,

Re: [R] summarize dataframe based on multiple cols, not their combinations

2013-03-20 Thread Alexander Shenkin
Thanks, John. Your solution gives me: ddply(my_df, .(a), summarize, mm = mean(dat), number = length(dat)) a mm number 1 0 14 3 2 1 11 3 I'm looking for (and Ista found a way): a b c mean n 1 1 * * 11 3 2 * 1 * 14 3 3 * * 1 12 3 thanks, allie On 3/20/2013 3:24 PM,

Re: [R] summarize dataframe based on multiple cols, not their combinations

2013-03-20 Thread arun
Hi,  lst1- lapply(letters[1:3],function(i) {df1-data.frame(my_df[i],my_df[dat]); res-ddply(df1,.(df1[[i]]),function(x) c(mean=mean(x$dat),n=nrow(x)));names(res)[1]-i;res-res[res[,1]==1,]}) res1-Reduce(function(...) merge(...,all=TRUE),lst1) res1[is.na(res1)]-*  res1 #  mean n a b c #1   11 3

[R] remove specific number of rows from a matrix

2013-03-20 Thread Andras Farkas
Dear All,   sorry, got stuck again on the following: let us say we have:   a -c(1:5) b -c(6:10) d -cbind(a,b)     from d I would like to remove total number of rows based on the length of f. So if:   f -c(1)   my result is working great with the following solution:   d[-length(f),]   so I get:

Re: [R] remove specific number of rows from a matrix

2013-03-20 Thread Gergely Daróczi
Hi Andras, what about: d[-(1:length(f)), ] a b [1,] 3 8 [2,] 4 9 [3,] 5 10 Best, Gergely On 20 March 2013 22:53, Andras Farkas motyoc...@yahoo.com wrote: Dear All, sorry, got stuck again on the following: let us say we have: a -c(1:5) b -c(6:10) d -cbind(a,b) from d I would

Re: [R] remove specific number of rows from a matrix

2013-03-20 Thread arun
Hi, Try: f-c(1,2)  d[-seq_along(f),] # a  b #[1,] 3  8 #[2,] 4  9 #[3,] 5 10 A.K. - Original Message - From: Andras Farkas motyoc...@yahoo.com To: r-help@r-project.org Cc: Sent: Wednesday, March 20, 2013 5:53 PM Subject: [R] remove specific number of rows from a matrix Dear All,  

[R] Dealing with missing values in princomp (package psych)

2013-03-20 Thread Dimitri Liakhovitski
Hello! I am running principle components analysis using princomp function in pacakge psych. mypc - princomp(mydataforpc, cor=TRUE) Question: I'd like to use pairwise deletion of missing cases when correlations are calculated. I.e., I'd like to have a correlation between any 2 variables to be

Re: [R] Counting confidence intervals

2013-03-20 Thread Greg Snow
The TeachingDemos package has %% and %=% functions that can be chained simply, so you could do something like: sum( 5:1 %=% 1:5 %=% 10:14 ) and other similar approaches. The idea is that you can do comparisons as: lower %% x %% upper instead of lower x x upper On Mon, Mar 18, 2013 at

Re: [R] Dealing with missing values in princomp (package psych)

2013-03-20 Thread Dimitri Liakhovitski
Just a small correction. I am running it like this: mypc - princomp(~.,data=q7a.forfa, cor=TRUE, na.action=na.omit) With na.omit it works. But I have way too many unsystematically missing values on different variables. I tried na.action = na.pass, but it's not working: Error in cov.wt(z) : 'x'

Re: [R] Dealing with missing values in princomp (package psych)

2013-03-20 Thread Bert Gunter
Well, you can do this, but there's no guarantee that the resulting correlation matrix will be positive definite. And what would principle components based on this mean even if it is positive definite? -- Bert On Wed, Mar 20, 2013 at 3:14 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com

Re: [R] Dealing with missing values in princomp (package psych)

2013-03-20 Thread Dimitri Liakhovitski
Yes, Bert, you are right and I do know I might run into a non-positive definite intercorrelation matrix. But if I do, then I can go back to those for whom I am doing the analysis and tell them that. Not before. This sad truth being said - can I do it directly in the function, without building a

[R] problem subsetting data.frame in R version 2.15.2 for Windows

2013-03-20 Thread Borja .
Good day. I create a data frame like this: data - data.frame(a=1:10,b=11:20,c=21:30) I can subset this data.frame by saying: data[data$a7,] and I get this result a b c8 8 18 28 9 9 19 29

[R] boot with different sample sizes

2013-03-20 Thread paolo brunori
Dear all, a question about the package boot: is it possible to bootstrap a function of arguments of different length? is there an alternative package? below an example of a simple try, many thanks paolo library(boot) blue-c(4, 3, 4, 1, 2, 3, 1) red-c(4, 3, 4, 1, 2, 3, 1, 2, 3, 1, 3, 2)

Re: [R] Dealing with missing values in princomp (package psych)

2013-03-20 Thread William Dunlap
You can build the variance matrix you want manually with cov(x, use=pairwise). You can supply a variance matrix to princomp with princomp(covmat=outputOfCov). See their manual pages for details. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From:

Re: [R] boot with different sample sizes

2013-03-20 Thread Rui Barradas
Hello, The second argument to your function must be a vector of indices, like the manual page for ?boot says. And you were missing a comma. That's what the error message was saying. library(boot) blue-c(4, 3, 4, 1, 2, 3, 1) red-c(4, 3, 4, 1, 2, 3, 1, 2, 3, 1, 3, 2) test1-function(x, d, y){

Re: [R] Dealing with missing values in princomp (package psych)

2013-03-20 Thread Dimitri Liakhovitski
Yes, that's what I've done. I was just wondering if the function can do it itself. If not - no problem. Dimitri On Wed, Mar 20, 2013 at 7:35 PM, William Dunlap wdun...@tibco.com wrote: You can build the variance matrix you want manually with cov(x, use=pairwise). You can supply a variance

Re: [R] problem subsetting data.frame in R version 2.15.2 for Windows

2013-03-20 Thread Rui Barradas
Hello, Inline. Em 20-03-2013 22:17, Borja . escreveu: Good day. I create a data frame like this: data - data.frame(a=1:10,b=11:20,c=21:30) I can subset this data.frame by saying: data[data$a7,] and I get this result a b c

Re: [R] Counting confidence intervals

2013-03-20 Thread David Winsemius
You should look at findInterval. Used with as.numeric it could do what you request although it has a much wider range of uses. -- David Sent from my iPhone On Mar 20, 2013, at 5:15 PM, Greg Snow 538...@gmail.com wrote: The TeachingDemos package has %% and %=% functions that can be chained

Re: [R] Unable to start with package rattle

2013-03-20 Thread Jun_Kim
Thank you so much! After setting up GTK, rattle works! I think the problem was caused because GTK had not been installed automatically. I guess it has something to do with the fact that my labtop is not private. Thanks again. -- View this message in context:

Re: [R] behaviour of formula objects and environment inside functions

2013-03-20 Thread Charles Berry
Thomas Alexander Gerds tag at biostat.ku.dk writes: Dear List I am looking for the recommended way to create a formula inside a function with an empty environment. I tried several versions (see below), and one of them seemed to work, but I dont understand why there is a difference

Re: [R] behaviour of formula objects and environment inside functions

2013-03-20 Thread William Dunlap
I didn't see where you said what your goal was in making the environment of a formula and empty environment. I'm guessing that you want to make sure the variables in the formula come from the data.frame given to a fitting function along with the formula (so that typos cause errors for sure

[R] installation of package had non-zero exit status

2013-03-20 Thread Sachinthaka Abeywardana
Hi all, I am trying to install this NBPSeq package, but I'm now getting the error shown below with ANY package that I try to install. installation of package ‘NBPSeq’ had non-zero exit status This started happening ever since I tried to install a package that I downloaded from a personal

Re: [R] installation of package had non-zero exit status

2013-03-20 Thread Jeff Newmiller
Contact the package author? --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live:

Re: [R] installation of package had non-zero exit status

2013-03-20 Thread Sachinthaka Abeywardana
my mistake, had to install the dependency from bioconductor. Thank you, Sachin On Thu, Mar 21, 2013 at 4:11 PM, Jeff Newmiller jdnew...@dcn.davis.ca.uswrote: Contact the package author? --- Jeff Newmiller

[R] NADA

2013-03-20 Thread Janh Anni
Dear Users Regarding the NADA package, would anyone be able to help me understand what values are actually plotted on the Y axis of the plot obtained by using the *ros* function on the data and plotting the result with the plot() function? The Y axis is labeled Values. According to the NADA user