Re: [R] Summing daily data for each year

2010-03-16 Thread Tal Galili
HI Santosh, The simplest way I can think of is (after you import the data) to do: tapply(Zvo$V2, YEAR, sum) The question is how to get "YEAR". You could do that if you know how to play with date objects. Another option is to do something like: YEAR <- as.data.frame(strsplit(Zvo$V2, "-"))[1,] F

Re: [R] C# DLL Library

2010-03-16 Thread Romain Francois
The link works fine for me on firefox, chrome and safari. Other ways to get to it are: - search "rcpp mailing list" on google. - go to r-forge (again google knows where), click on the "Rcpp - R/C++ interface", click on the "Lists" tab, click on subscribe, etc ... Le 17/03/10 04:42, Jeremie Sm

[R] Summing daily data for each year

2010-03-16 Thread Santosh.Aryal
Hello there I have a DAILY data set (as shown below) with Date and Streamflow from April 1995 to Aug 2006. I want a yearly sum the streamflow value (for each year - first and last incomplete year). Does anyone know how to do this in R? I have tried everything I could think of, e.g. i

Re: [R] Effect Size Formaula and Calulations in R

2010-03-16 Thread C.H.
pwr package: ES.h and ES.w1, ES.w2, cohen.ES On Wed, Mar 17, 2010 at 1:28 PM, Jim Silverton wrote: > Hello, > I would like to find out how to use R to compute the effect size of two > samples for a two sample t test. Is there a formula for the fisher's exact > test? Any R code and/or formula w

[R] Reg GARCH+ARIMA

2010-03-16 Thread RAGHAVENDRA PRASAD
Hi, Although my doubt is pretty,as i m not from stats background i am not sure how to proceed on this. Currently i am doing a forecasting.I used ARIMA to forecast and time series was volatile i used garchFit for residuals. How to use the output of Garch to correct the forecasted values from ARIMA

Re: [R] Effect Size Formaula and Calulations in R

2010-03-16 Thread Jim Silverton
Hello, I would like to find out how to use R to compute the effect size of two samples for a two sample t test. Is there a formula for the fisher's exact test? Any R code and/or formula would be greatly appreciated. Thanks, Jim [[alternative HTML version deleted]] ___

Re: [R] Are loops handled differently in newer versions of R?

2010-03-16 Thread Don MacQueen
Joshua's explanation of rownames makes a lot more sense than my speculation about conversion to numeric. Rownames of dataframes is an area in which there have definitely been changes in R in the last year or two, give or take. (I don't recall details or timing) Therefore, I find it very plausi

Re: [R] Help running a Fortran subroutine from R

2010-03-16 Thread dc896148
Another issue with this is how 'mask' is declared within the filter2d subroutine as well as 'subarray' and 'subarray1' integer ijx,ijy,ix,iy,jx,jy,icx,icy integer nx,ny,halfintx,halfinty real count logical missing real array(nx,ny),array1(nx,ny),miss real s

[R] odfWeave Error

2010-03-16 Thread Btibert3
Hi All, This is probably basic, but I am just starting with R and very interested in learning how to automate my reports. I am just learning about Sweave and LaTex. I am following an example from online and am getting the following error: ."Error unizipping fileunzip not found". I am

Re: [R] Help running a Fortran subroutine from R

2010-03-16 Thread dc896148
Maybe this is my problem. Perhaps passing an array of just 1's would work? -- View this message in context: http://n4.nabble.com/Help-running-a-Fortran-subroutine-from-R-tp1595641p1595795.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Are loops handled differently in newer versions of R?

2010-03-16 Thread Joshua Wiley
Michael, I have to agree with Don that using a factor as a loop index seems like a risky choice. At any rate, part of the problem is that you are referencing a nonexistant part of your dataframe. i is an index of characters, but your rownames are 1:5, not LETTERS[1:5]. If you give your datafram

Re: [R] Are loops handled differently in newer versions of R?

2010-03-16 Thread Michael Bibo
Michael Rennie gmail.com> writes: > > > Hi gang, > > I'm perplexed- I have some code that uses for() loops that works fine in > R version 2.8 on my mac, worked fine in version 2.8 on my old windows > machine, but doesn't work in version 2.10 on windows. > > The loop implements a function ov

Re: [R] C# DLL Library

2010-03-16 Thread Jeremie Smaga
I found the problem for the package that wasn't found... My R version was 2.9. Sorry about that. However, I would really appreciate it if you could let me know where I could find the mailing list... Thanks, Jeremie On Tue, Mar 16, 2010 at 6:56 PM, Romain Francois wrote: > Hello, > > disclaime

Re: [R] Are loops handled differently in newer versions of R?

2010-03-16 Thread Don MacQueen
Try for ( i in seq(nrow(lab8.dat)) ) p_unadj[i]<-calc.prob.t(lab8.dat[i,2], lab8.dat[i,3]) The first column of lab8.dat is a factor, and you're trying to use it as a loop index as if it were an integer. (Which I would consider dangerous.) No, loops are not handled differently, but a

[R] In readGDAL(destfile, silent = TRUE) : GeoTransform values not available

2010-03-16 Thread Nilza BARROS
Dear Ruser, I am trying to use the map library. But I have been problem the follow message. Warning message: *In readGDAL(destfile, silent = TRUE) : GeoTransform values not available * library(rgdal) library(RgoogleMaps) > GetMap(markers = '40.702147,-74.015794,blues%7C40.711614,-74.012318,gre

[R] Are loops handled differently in newer versions of R?

2010-03-16 Thread Michael Rennie
Hi gang, I'm perplexed- I have some code that uses for() loops that works fine in R version 2.8 on my mac, worked fine in version 2.8 on my old windows machine, but doesn't work in version 2.10 on windows. The loop implements a function over a data frame (code is included below). In Mac (ru

Re: [R] How to read a file of the following format?

2010-03-16 Thread David Winsemius
On Mar 16, 2010, at 10:29 PM, rosemary roy wrote: Hi all I have a data set of the following format. 0 0.7087872E+06 5 0.7087872E+06 10 0.7087872E+06 15 0.7087872E+06 20 0.7087872E+06 25 0.7087872E+06 30 0.7087872E+06 35 0.7087872E+06 I was trying to

[R] How to read a file of the following format?

2010-03-16 Thread rosemary roy
Hi all I have a data set of the following format. 0 0.7087872E+06 5 0.7087872E+06 10 0.7087872E+06 15 0.7087872E+06 20 0.7087872E+06 25 0.7087872E+06 30 0.7087872E+06 35 0.7087872E+06 I was trying to read in this file and plot it. leg16<-read.cs

Re: [R] C# DLL Library

2010-03-16 Thread Jeremie Smaga
Hi guys, Thanks for the explanations. I installed the RCPP package on R, but for some reasons, the two commands do not work. Besides, https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel is a broken link. So I tried to install the RcppExamples, but this package is not availab

[R] Help running DEA model

2010-03-16 Thread Xiaoxi Gao
Hello all, I am wondering if anyone has a R code for Data Envelopment Analysis (DEA) or linear programming (original code, not using "DEA" package). Thanks a lot! Xiaoxi _ Hotmail is red

Re: [R] simple line graphics, labels and legend

2010-03-16 Thread Jim Lemon
Hi Ivan, You can get your first plot this way: plot(test$SILIKATG, ylim=c(0,0.02), type="l",xaxt="n",xlab="Group") axis(1,at=c(5,10,15,20),labels=sort(unique(test$DIET))) I was going to suggest using reshape to get the following matrix, but I just couldn't work out how to do it. test.wide<-cb

Re: [R] Eliminate border in wireframe plot

2010-03-16 Thread Seth W Bigelow
Scott, I asked this same question a few years back, here's what Deepayan wrote. I think the last hint about scales will help you --Seth On 5/9/07, Seth W Bigelow wrote: > > I would like to remove the outermost box from my wireframe plots -- this is > the box that is automatically generated,

Re: [R] Help running a Fortran subroutine from R

2010-03-16 Thread Ray Brownrigg
On Wed, 17 Mar 2010, dc896148 wrote: > The output will be an array of the same dimension as 'array', the first > argument passed to the subroutine. The output array is the second > argument, 'array1', which will be populated with the smoothed values > according to the subroutine. > I can run the s

Re: [R] Help running a Fortran subroutine from R

2010-03-16 Thread dc896148
The output will be an array of the same dimension as 'array', the first argument passed to the subroutine. The output array is the second argument, 'array1', which will be populated with the smoothed values according to the subroutine. I can run the subroutine in R without receiving an error, i

Re: [R] Missing index in vector assignment

2010-03-16 Thread jim holtman
Please provide what LVvar is. At least provide str(LVvar), or preferably a 'dput' of the object. PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. On Tue,

Re: [R] Simple for-loop runs out of memory

2010-03-16 Thread jim holtman
Learn how to do some basic debugging. If you are running out of memory after 10 times, then you must be creating a large object and using up memory. Put: cat(i, memory.size(), '\n') In your loop to see how memory is being used. You might also look at the size of the objects you are creating.

Re: [R] cut out single lines out of matrix

2010-03-16 Thread jim holtman
Here is a way of creating a list of the matrices: > x <- matrix(1:(12*30), nrow=30) > # create a list of single row matrices > x.l <- lapply(seq(nrow(x)), function(a) x[a,, drop=FALSE]) > > x.l [[1]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,]1 31 61 91 121

Re: [R] Help running a Fortran subroutine from R

2010-03-16 Thread Sharpie
dc896148 wrote: > > useR's, > I need help getting a Fortran DLL successfully returning the correct > output. The attached fortran source code (filter2d.f) and DLL > (filter2d.dll) are attached. Also, I attached a text file for which I > want to apply the filter to (time702.txt). > > Here is w

Re: [R] plm "within" models: is the correct F-statistic reported?

2010-03-16 Thread Achim Zeileis
Dear R users I get different F-statistic results for a "within" model, when using "time" or "twoways" effects in plm() [1] and when manually specifying the time control dummies [2]. [1] vignette("plm") [2] http://cran.r-project.org/doc/contrib/Farnsworth-EconometricsInR.pdf Well, the question is

[R] panel regression diagnostics?

2010-03-16 Thread Liviu Andronic
Dear R users How should one approach diagnosing a regression on panel data? I am mostly talking about the "within" or Fixed Effects case. There are some panel-specific tests and diagnostics explained in require(plm) vignette("plm") But I was wondering if diagnostics on ordinary linear models (as e

[R] recursive term

2010-03-16 Thread Roslina Zakaria
Hi r-users;   I have this values: eign_val <- c(137.810447,3.538721,2.995161,1.685670) alp    <- 1.6549 ;  lamda <- eign_val lamda_m <- min(lamda)   First I calculated manually: delta0 <- 1 delta1 <- alp*delta0*(4-lamda_m*(1/lamda[1]+1/lamda[2]+1/lamda[3]+1/lamda[4]))  delta1 delta2 <- (alp/2)*(d

[R] cut out single lines out of matrix

2010-03-16 Thread Schmidt Martin
Hey dear users I'm trying to kind of split my matrix which looks as follows: dim(out) [1] 30 12 What I finally want is each line as it's own matrix which I can handle then separately. Like, say: out1<- [1,] out2<-[2,] .. Would you do that with a for() loop or does exist an other approp

[R] PCA - blank loadings

2010-03-16 Thread Xanthe Walker
Hi, I have successfully completed a PCA and printed the loadings, however, numerous values are blank. I know that this means the values are just very small but not equal to zero. Is there a way to print out the loadings, including the very small values, I need them for graphing purposes. Thanks,

[R] Simple for-loop runs out of memory

2010-03-16 Thread Astrix
I have the following simple for-loop, which makes R crash every time. The length of the vectors is about 1200 rows, 1 column. n = max(length(GSPC),length(FTSE)) for(i in 1:1000) { if (row.names(GSPC)[i]==row.names(FTSE)[i]){ } else { if (row.names(GSPC)[i]>row.nam

[R] Help running a Fortran subroutine from R

2010-03-16 Thread dc896148
useR's, I need help getting a Fortran DLL successfully returning the correct output. The attached fortran source code (filter2d.f) and DLL (filter2d.dll) are attached. Also, I attached a text file for which I want to apply the filter to (time702.txt). Here is what I am doing... > dyn.load("C:/f

Re: [R] Is there a way to edit a specific line in a function (e.g: doing function->text->edit->function) ?

2010-03-16 Thread Tal Galili
Dear Duncan and Henrique - Thanks for the answers. Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English

[R] Missing index in vector assignment

2010-03-16 Thread Chaehan So
Dear r-helpers, I am getting a mismatch error between two variables: svp <- ksvm(x, y, type="nu-svc") Error in .local(x, ...) : x and y don't match. and I suspect that it might be due to missing index in the y variable which I defined as: y <- (LVvar[,1]) I tried various methods to make

[R] FW: How to parse a string (by a "new" markup) with R ?

2010-03-16 Thread Andrej Blejec
A version using regular expressions, regexpr() and substr() functions is attached. Finally everything is packed into splitSeq() function (chunk 14 in the attached file) Seq<- "GCCTCGATAGCTCAGTTGGGAGAGCGTACGACTGAAGATCGTAAGGtCACCAGTTCGATCCTGGTTCCA" Str<- ">>>...>...

[R] plm "within" models: is the correct F-statistic reported?

2010-03-16 Thread Liviu Andronic
Dear R users I get different F-statistic results for a "within" model, when using "time" or "twoways" effects in plm() [1] and when manually specifying the time control dummies [2]. [1] vignette("plm") [2] http://cran.r-project.org/doc/contrib/Farnsworth-EconometricsInR.pdf Two examples below: lib

Re: [R] testing parallelism of does-response curves using package "drc"

2010-03-16 Thread array chip
Hi Eik, Thanks for pointing out this great package "drc". Can you or anyone please help me to specify a constrained 5 PL model where only the transition parameter ("e" in L.5()) are allowed to differ? BTW, what does the argument "pmodels=" do in the model specification? And what about argumen

Re: [R] Retrieving latitude and longitude via Google Maps API

2010-03-16 Thread hadley wickham
>>> Does anyone have any experience retrieving latitutde and longitude for >>> an address from the Google Maps API? > > This thread from r-sig-geo may be of interest: > https://stat.ethz.ch/pipermail/r-sig-geo/2010-March/thread.html#7788 In particularly, note that what you are doing is against the

Re: [R] How can I save the result for goodness of fit test

2010-03-16 Thread Tal Galili
Hi pinusan, If it is possible, please add the code you used and output so to help people here help you. In general, take the object you got, put it inside "str" and see where you statistic is (but for us to write the code, it would help if you where to add it to your massage) Best, Tal ---

Re: [R] Is there a way to edit a specific line in a function (e.g: doing function->text->edit->function) ?

2010-03-16 Thread Duncan Murdoch
On 16/03/2010 5:31 PM, Tal Galili wrote: Hello, Let's say we have the following function: foo <- function(x) { line1 <- x line2 <- 0 line3 <- line1 + line2 return(line3) } And that we want to change the second line to be: line2 <- 2 How would you do that? The

Re: [R] Is there a way to edit a specific line in a function (e.g: doing function->text->edit->function) ?

2010-03-16 Thread Tal Galili
That did it. Thanks Henrique! Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English)

[R] [R-pkgs] New package: ordinal

2010-03-16 Thread Rune Haubo
This is to announce the new R-package ‘ordinal’ that implements cumulative link (mixed) models for ordinal (ordered categorical) data (http://www.cran.r-project.org/package=ordinal/). The main features are: - scale (multiplicative) as well as location (additive) effects - nominal effec

Re: [R] using RKWard for a function plot

2010-03-16 Thread KAYVEN RIESE
On Tue, 16 Mar 2010, KAYVEN RIESE wrote: Is it possible to use the RKWard GUI to just plot a function? I will have some exponential function, I need to plot u as a function of y where u= -2yg exp(-y^2/beta) - f where everything

Re: [R] R on Linux - a primer

2010-03-16 Thread Emmanuel Charpentier
Le dimanche 14 mars 2010 à 18:04 -0400, Axel Urbiz a écrit : > Hi, > > I'm looking to move from Windows into a 64-bit Linux environment. Which is > the best Linux Flavor to use within R? To install R on this environment, do > I need to do any compiling? I'd like to add two cents of folly to the (

[R] using RKWard for a function plot

2010-03-16 Thread KAYVEN RIESE
Is it possible to use the RKWard GUI to just plot a function? I will have some exponential function, I need to plot u as a function of y where u= -2yg exp(-y^2/beta) - f where everything else other than u and y are various cons

Re: [R] Is there a way to edit a specific line in a function (e.g: doing function->text->edit->function) ?

2010-03-16 Thread Henrique Dallazuanna
Try this: body(foo)[[grep('^line2', body(foo))]][[3]] <- 2 On Tue, Mar 16, 2010 at 6:31 PM, Tal Galili wrote: > Hello, > > Let's say we have the following function: > > foo <- function(x) > > { > > >    line1 <- x > > >    line2 <- 0 > > >    line3 <- line1 + line2 > > >    return(line3) > > } >

[R] Is there a way to edit a specific line in a function (e.g: doing function->text->edit->function) ?

2010-03-16 Thread Tal Galili
Hello, Let's say we have the following function: foo <- function(x) { line1 <- x line2 <- 0 line3 <- line1 + line2 return(line3) } And that we want to change the second line to be: line2 <- 2 How would you do that? The two ways I know of are either to use fix(

[R] Re : Eliminate border in wireframe plot

2010-03-16 Thread Seth W Bigelow
Scott: This may work for you. Just include the statement par.settings <- par.set1 in your wire graph statement par.set1 <-list( axis.line=list(col="transparent"), # Get rid of box around fig? clip=list(panel=FALSE), # disarm l

Re: [R] Retrieving latitude and longitude via Google Maps API

2010-03-16 Thread Michael Denslow
Hi Benjamin, > > On Tue, 16 Mar 2010, Nutter, Benjamin wrote: > >> Does anyone have any experience retrieving latitutde and longitude for >> an address from the Google Maps API? This thread from r-sig-geo may be of interest: https://stat.ethz.ch/pipermail/r-sig-geo/2010-March/thread.html#7788 Ho

Re: [R] Constrained non linear regression using ML

2010-03-16 Thread Gabor Grothendieck
Check out the betareg package. On Tue, Mar 16, 2010 at 2:58 PM, Corrado wrote: > Dear R users, > > I have to fit the non linear regression: > > y~1-exp(-(k0+k1*p1+k2*p2+ +kn*pn)) > > where ki>=0 for each i in [1 n] and pi are on R+. > > I am using, at the moment, nls, but I would rather

Re: [R] Retrieving latitude and longitude via Google Maps API

2010-03-16 Thread Phil Spector
Benjamin - Perhaps this will get you started: addr = '1600 Pennsylvania Avenue, Washington, DC' url = paste('http://maps.google.com/maps/api/geocode/xml?address=', + addr,'&sensor=false',sep='') library(XML) doc = xmlTreeParse(url) root = xmlRoot(doc) lat = xmlValue(root[['resu

Re: [R] OT Really: Odds Are, It's Wrong...

2010-03-16 Thread Dieter Menne
Johannes Huesing wrote: > > I have little problems with scientists publishing all their findings with > p-values (or > confidence intervals) but big problems with people who use them as a > filter. > While I am aware that CI and p-values have a common root, I do not to throw both into one po

Re: [R] Constrained non linear regression using ML

2010-03-16 Thread Ravi Varadhan
I have an algorithm that can perform nonlinear optimization, with linear/nonlinear, equality and/or inequality constraints. From your description, it seems like this algorithm would work for your problem. Contact me if you are interested and I will send you the code. Ravi. -Original Message-

Re: [R] Conditional variable assignment

2010-03-16 Thread David Winsemius
On Mar 16, 2010, at 3:44 PM, Hosack, Michael wrote: Hi everyone, Once again I am stuck with a problem I can't seem to figure out. I suppose this learning curve levels off eventually, lol. I am learning on my own with absolutely no background in programming, so if I seem to request help a

Re: [R] Error in pruning hclust object using maptree package

2010-03-16 Thread Keith
My bad. I did read the help. However, I didn't pay enough attention to the data argument, and it seems it doesn't need to use data argument in the earlier version. I also noticed this argument afterwards. Now it works for me as well. Thanks a lot. Uwe Ligges wrote: On 15.03.2010 16:37,

[R] Fw: an ordinal regression MCMC run high correlation

2010-03-16 Thread ping chen
I tried thinning of the mcmc run with 500,000 iteration. It looks like 100 or 200 is enough to remove the autocorrelation of a1 and tau. Is that too much thining? --- On Tue, 3/16/10, ping chen wrote: > From: ping chen > Subject: an ordinal regression MCMC run high correlation > To: r-help@r

[R] Retrieving latitude and longitude via Google Maps API

2010-03-16 Thread Nutter, Benjamin
Does anyone have any experience retrieving latitutde and longitude for an address from the Google Maps API? I'd like to have an R script that submits a street address, city, state, and zip code and returns the coordinates. So far, I've been submitting the coordinates from another program, then

Re: [R] Changing global variables from functions

2010-03-16 Thread David Winsemius
On Mar 16, 2010, at 3:11 PM, David Winsemius wrote: On Mar 16, 2010, at 2:43 PM, jtouyz wrote: Hi David, Thank you for your response. Yes, num_decks was previously defined in my program, I apologize for the confusion as it is an integral value. This is only one portion of my program that

Re: [R] OT Really: Odds Are, It's Wrong...

2010-03-16 Thread Johannes Hüsing
Dieter Menne schrieb: Marc Schwartz-3 wrote: I thought that readers of R-Help might find the following article at ScienceNews of interest: Odds Are, It's Wrong Science fails to face the shortcomings of statistics By Tom Siegfried March 27th, 2010; Vol.177 #7 (p. 26) http://www.scie

[R] How can I save the result for goodness of fit test

2010-03-16 Thread pinusan
Dear All, I run the goodness of fit test using goodfit() in vcd package. The result is as follow: Goodness-of-fit test for poisson distribution X^2 df P(> X^2) Pearson 1.053348 2 0.5905661 Warning message: In summary.goodfit(gf) : Chi-squared approximation may be incorrec

Re: [R] Changing global variables from functions

2010-03-16 Thread David Winsemius
On Mar 16, 2010, at 2:43 PM, jtouyz wrote: Hi David, Thank you for your response. Yes, num_decks was previously defined in my program, I apologize for the confusion as it is an integral value. This is only one portion of my program that is being used to simulate card counting in blackjac

[R] Problems with loading arm

2010-03-16 Thread Gregory Wawro
Hello, I recently updated to R 2.10 on my 64 bit Dell Precision T7400 running Enterprise Linux and now I can't get the arm library to load when I run R using Wine. Prior to the update I was able to use arm without any trouble. My main goal is to use arm with WinBUGS on this machine, calling it

[R] Constrained non linear regression using ML

2010-03-16 Thread Corrado
Dear R users, I have to fit the non linear regression: y~1-exp(-(k0+k1*p1+k2*p2+ +kn*pn)) where ki>=0 for each i in [1 n] and pi are on R+. I am using, at the moment, nls, but I would rather use a Maximum Likelhood based algorithm. The error is not necessarily normally distributed.

Re: [R] Changing global variables from functions

2010-03-16 Thread jtouyz
Hi David, Thank you for your response. Yes, num_decks was previously defined in my program, I apologize for the confusion as it is an integral value. This is only one portion of my program that is being used to simulate card counting in blackjack. The basic idea was to modify deckn without havin

[R] an ordinal regression MCMC run high correlation

2010-03-16 Thread ping chen
I am trying to model a clusterd ordinal response data (either 1, 2 or 3) called , the correponding physician of the patient is also in the data. Since it is ordinal, I used the ordinal logit model topbox[i]~discrete with probability P[j,1],p[j,2], p[j,3], j is the corresponding physician of

Re: [R] Changing global variables from functions

2010-03-16 Thread David Winsemius
On Mar 16, 2010, at 11:04 AM, jtouyz wrote: Hey all, I'm relatively new to the R-environment. I'm having a bit of trouble with encapsulation. I have a globally declared variable that doesn't update it when I change it in a function. For example when I run the following function deck

[R] simple line graphics, labels and legend

2010-03-16 Thread Ivan Calandra
Dear users, I think my questions are pretty simple, but I got lost in the hundreds of par() and plot() arguments and plot functions, so I don't know in which direction I should go. Here is my sample dataset: test <- structure(list(DIET = structure(c(1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 2L,

Re: [R] inner join sqldf

2010-03-16 Thread Gabor Grothendieck
Its unlikely that the inner join is what you want. prochi has only 5 levels so the result is going to be enormous. In the second statement you are trying to union incompatible tables. Get an introductory book on SQL and read up on how it works. On Mon, Mar 15, 2010 at 10:39 AM, Newbie19_02 wrot

Re: [R] Regarding variable importance in the randomForest package

2010-03-16 Thread Liaw, Andy
Seems like you're new to R as well? The first argument should contain only the predictor variables, but you used the entire data frame that contains the response. Andy > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Corinne

Re: [R] bottlenecks in R script

2010-03-16 Thread Gabor Grothendieck
Check out read.csv.sql in the sqldf package. It reads a file directly into sqlite without going through R and then from there into R. It sets up the database and file layouts in the database for you and also destroys the database when finished so reading is just a matter of one line of R code. I

[R] Writting in the file

2010-03-16 Thread rizesimoes
Hi user I'm learning how to use R and I have a problem with the format file. How do I to write in a file? I have some variables which I would like to write in a file.  Att. Marize Simões __ R-help@r-project.org mailing list htt

[R] Changing global variables from functions

2010-03-16 Thread jtouyz
Hey all, I'm relatively new to the R-environment. I'm having a bit of trouble with encapsulation. I have a globally declared variable that doesn't update it when I change it in a function. For example when I run the following function >deckn<-NULL >deck1<-1 #52 card deck >deck<-function() { #Cr

Re: [R] nested looping functions and dataframes

2010-03-16 Thread Lanna Jin
Thanks Phil, That worked wonders! Best, Lanna 2010/3/16 Phil Spector > Lanna - > Here's one way: > > makeframe = function(x){ > b = as.data.frame(as.matrix(table(x$Species,x$Species))) > b = b[!(b$Var1 == b$Var2),-3] > data.frame(Year=x$Year[1],Location=x$Location[1],b) > } > > result

Re: [R] Package documentation in dissertation

2010-03-16 Thread statmobile
Thanks Gabor, that looks to be exactly what I was seeking. I'll play around with that. Thanks, Brian On Tue, Mar 16, 2010 at 05:19:23AM -0400, Gabor Grothendieck wrote: > See: > https://stat.ethz.ch/pipermail/r-help/2005-April/070581.html > > On Mon, Mar 15, 2010 at 11:16 PM, statmobile wrote:

Re: [R] Error in pruning hclust object using maptree package

2010-03-16 Thread Uwe Ligges
On 15.03.2010 16:37, Keith wrote: Dear R users, Due to too many children in my clustering result, I would like to prune the tree-like hclust object into a certain groups. However, an error: > clip.clust: no data provided for hclust object always shows up. Firstly, I tried the example in th

Re: [R] unknown compression

2010-03-16 Thread Uwe Ligges
On 16.03.2010 14:35, R Heberto Ghezzo, Dr wrote: Thanks to Uwe Ligges, simply putting library(xxx) dump(ls(pos=2)),file="xxx.r") gives a file with all the 'pure R' function in a package This just solved my problem, as an added curiosity or just for completion sake, if the package 'xxx' has som

Re: [R] aggregate without removing empty subset

2010-03-16 Thread Henrique Dallazuanna
If the factor have only level: apply(m1, 2, tapply, addNA(part2), mean)[-2,,drop = FALSE] On Tue, Mar 16, 2010 at 12:43 PM, Christophe Genolini wrote: > As I told you in private, thanks, it works perfectly. > > More precisely, I am working with 3D array. Your code works well (both on > matrix o

[R] bottlenecks in R script

2010-03-16 Thread Joe Calderon
hello *, im running into two major bottlenecks an R script. 1. going through a 40mb file and reading in via readLines() 1 line at a time is almost an order of magnitude slow than the equivalent in python, im wondering if there are alternatives to readLines(), doing more lines at a time helps a bit

Re: [R] nested looping functions and dataframes

2010-03-16 Thread Phil Spector
Lanna - Here's one way: makeframe = function(x){ b = as.data.frame(as.matrix(table(x$Species,x$Species))) b = b[!(b$Var1 == b$Var2),-3] data.frame(Year=x$Year[1],Location=x$Location[1],b) } result = lapply(split(x,list(x$Year,x$Location)),makeframe) result will be a list of data fra

Re: [R] Error in library(eda) : there is no package called 'eda'

2010-03-16 Thread Uwe Ligges
On 15.03.2010 21:44, Phil Spector wrote: Peter - While the message hasn't been shown in more recent versions of R, older (< 2.9) versions of R used to print the following: library(eda) Warning message: package 'eda' has been merged into 'stats' ... which happened for R-1.9.0 roughly 6 year

[R] nested looping functions and dataframes

2010-03-16 Thread Lanna Jin
Hey All, So, I am confused how exactly to use nesting loop functions in R to spit out data frames. I've managed to create a working function for my data set that generates a data frame for a given set of Year i and Location j; but how would I do it for all Years and Locations? Here is my workin

Re: [R] Help with calculating entropy of data

2010-03-16 Thread Marsh
mnstn wrote: > > Hello All, > My question is not directly related to R but rather on which statistical > method I should look in to for capturing the entropy of a data-set as a > number. In this figure http://www.twitpic.com/18sob5 are two data sets > blue and green (x-axis is time) that fluctua

Re: [R] function arguments: name of an object vs. call producing theobject?

2010-03-16 Thread Bert Gunter
Michael: Well, several possibilities come to mind, but their appropriateness depends on what your argument could be. 1) The deparse(substitute(...)) construction will get you the character string that was used as the argument and you can grep for "~" in it. 2) Or maybe check the class of the arg

Re: [R] function arguments: name of an object vs. call producing the object?

2010-03-16 Thread Michael Friendly
Thanks, Duncan In my context, the following gives me what I want: > foo.glm <- function(object) { + if (typeof(substitute(object))=="symbol") + oname <- as.character(sys.call())[2] + else oname <- NULL + oname + } > > > > indep <- glm(Freq ~ mental + ses, family = poisson, data =

[R] memory failure in adonis function (permanova)

2010-03-16 Thread Paloma Ruiz
Dear all, I am trying to get a PERMANOVA with quite large data set. I am reading a lot about this question, but I do not get the answer about it. Although I know that the R function is adonis () (vegan package), it does not work: adonis(Pha.env~SPha, data=Pha, permutations=10) The error message:

Re: [R] R-Documentation including an image?

2010-03-16 Thread Thomas Roth
Thank you for the info, I couldn't find anything in the documentation and wasn't sure ut now I know for sure. -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Dieter Menne Gesendet: Dienstag, 16. März 2010 14:36 An: r-help@r-p

Re: [R] How to parse a string (by a "new" markup) with R ?

2010-03-16 Thread Tal Galili
Gabor, Thank you very very much! Your code consists of so many commands I never played with, both helpful and educational. Thanks! Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.

Re: [R] remove substring from each string vector component

2010-03-16 Thread Marc Schwartz
On Mar 16, 2010, at 9:50 AM, arnaud chozo wrote: > Hi all, > > I have a string vector like that: x=c("1\t\t", "2", "3\t\t\t") > I need to remove all the occurrences of "\t", in order to obtain: x = "1" > "2" "3" > > I'm trying to use the function substring2, and it works for each component, >

Re: [R] aggregate without removing empty subset

2010-03-16 Thread Christophe Genolini
As I told you in private, thanks, it works perfectly. More precisely, I am working with 3D array. Your code works well (both on matrix or on array). But when part is a factor with only one value, the result has not a correct dimension (vector if m is a matrix, a matrix if m is an array). Any way

Re: [R] Save variable in the file

2010-03-16 Thread Joshua Wiley
Dear Marize, It depends a bit on what format you would like to write your data as and what your goals are. Try looking at ?save ?write.table save() will save objects as an R data file, write.table() will write tables to a file, you can specify the delimiter (e.g., "," for commas, "\t" for tab,

Re: [R] remove substring from each string vector component

2010-03-16 Thread Miguel Porto
Hi! It's just this easy: x=gsub("\t","",x) For more complex things, it's worth learning some regular expressions syntax. Miguel On Tue, Mar 16, 2010 at 2:50 PM, arnaud chozo wrote: > Hi all, > > I have a string vector like that: x=c("1\t\t", "2", "3\t\t\t") > I need to remove all the occurrenc

Re: [R] heatmap.2 - ColSideColors question

2010-03-16 Thread Rainer Machne
On 03/16/2010 04:06 PM, Tim Smith wrote: > Hi, > > I wanted to make more than one side color bar. The function heatmap.plus (library: heatmap.plus) can do that, just combine the different color vectors with cbind(col1,col2). Unfortunately the arguments required for heatmap, heatmap.2 and heatmap

[R] Save variable in the file

2010-03-16 Thread rizesimoes
Hi user's I'm learning how to use R and I have a problem with the format file. How do I to write in a file? I have some variables which I would like to write in a file.  Att. Marize Simões __ R-help@r-project.org

[R] heatmap.2 - ColSideColors question

2010-03-16 Thread Tim Smith
Hi, I wanted to make more than one side color bar. For example, I can make one side color bar (col1) with the following code: --- library(gplots) mat <- matrix(sample(1:100,40),nrow=5) class1 <- c(rep(0,4),rep(1,4)) col1 <- ifelse(class1 == 0,"blue","red") class2

Re: [R] remove substring from each string vector component

2010-03-16 Thread Eik Vettorazzi
Hi Arnaud, how about this: x=c("1\t\t", "2", "3\t\t\t") gsub("\t","",x) hth. arnaud chozo schrieb: Hi all, I have a string vector like that: x=c("1\t\t", "2", "3\t\t\t") I need to remove all the occurrences of "\t", in order to obtain: x = "1" "2" "3" I'm trying to use the function substr

Re: [R] passing columns of tables as a variable to functions

2010-03-16 Thread Phil Spector
Sacha - The "$" notation can only be used when you literally use the name of the column you want. If the name of the column is stored in a variable, you should use this notation: maptable[,value] to refer to the column whose name is stored in "value".

Re: [R] Problem in installing ncdf package

2010-03-16 Thread Uwe Ligges
On 16.03.2010 07:06, BabyL BabyK wrote: Dear R communities Could you please help me with the problem I encounter while trying to install the ncdf package? download.packages("ncdf", "/home/user/soft/R/library/") cd /home/user/soft/R/library R CMD INSTALL ncdf_1.6.tar.gz # fail sudo R CMD INST

  1   2   >