Re: [R] save to file

2012-12-16 Thread Vivek Singh
try the following. it works for linux: $ R|tee log.txt I stored the log for a small period. *R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-pc-linux-gnu (64-bit) R is free software and com

Re: [R] save to file

2012-12-16 Thread David Winsemius
On Dec 16, 2012, at 7:35 PM, Felipe Carrillo wrote: > Well, I am going to give copies of an application to different offices and > want to be able to generate an output file > in the event that an error would ocurr while running the different R > routines. By saving the entire R console along w

[R] looping through spatial points and getting counts of spatial points in spatial grid in R

2012-12-16 Thread Tilottama Ghosh
Hi, I am stuck in a looping problem. It might be an easy problem for experienced R users but I have been unable to do it. Any kind of help or advice will be great appreciated. I am creating a spatial grid and have a list of spatial points in a folder. I can read the spatial points separately and

Re: [R] kruskalmc, significant differences while median values are the same

2012-12-16 Thread Omphalodes Verna
Thank for help! My ''problem'' is a little bit complicated. I have a dataset of trees (five tree species) and I need to calculate if there are the significant differences in the period of suppressed growth among tree species (length in years, e.g. 1, 2, 3, 6, 10, 50, 80, etc.). Because data are

Re: [R] Mixed Anova

2012-12-16 Thread Bert Gunter
What you are doing wrong: 1. You haven't read the posting guide, and so have not posted with sufficient clarity for people to help (at least I can't -- what's your data look like?); 2. You've posted to the wrong list: mixed models posts are better answered on the r-sig-mixed-models list. 3. I am

Re: [R] Mixed Anova

2012-12-16 Thread Vivek Singh
please check this: http://stats.stackexchange.com/questions/11079/problem-with-anova-repeated-measures-error-model-is-singular On Mon, Dec 17, 2012 at 12:11 PM, Stephen Sammut wrote: > model is singular > -- Thanks and Regards, Vivek Kumar Singh Alcatel-Lucent, Bangalore (91)9886317184,

Re: [R] nls for sum of exponentials

2012-12-16 Thread Bert Gunter
1. Fit a simpler model -- you're probably overfitting. 2. Consult your local statistician. 3. Post to stats.stackexchange.com, as this appears to be primarily a statistical issue, not an R issue. But 2) would probably be better. Cheers, Bert On Sun, Dec 16, 2012 at 3:57 PM, Diviya Smith wrote: >

[R] User defined functions error - where is it ?

2012-12-16 Thread edoardo baldoni
Hello, I have a written a couple of functions (states.trends(.) and trend.generator(.)) to create monthly aggregated time series from disaggregated data. They seem to work pretty fine with all the data I provide, but they give me the following error in one the case I use a particular table (per.aft

Re: [R] save to file

2012-12-16 Thread Felipe Carrillo
Well, I am going to give copies of an application to different offices and want to be able to generate an output file in the event that an error would ocurr while running the different R routines. By saving the entire R console along with the R version, I should be able to see where the error ocu

Re: [R] Mixed Anova

2012-12-16 Thread Stephen Sammut
I am new to R and have been doing my utmost to learn it in order to teach my students how to use it as an alternative to programs you have to purchase ­ and I am very grateful for the program and what it can doŠ.but I am having a slight problem as I also am not very much into programming ­ though w

Re: [R] save to file

2012-12-16 Thread arun
Hi, This is what I did: library(TeachingDemos)  txtStart("foo1.txt",commands=TRUE,results=TRUE,append=FALSE) Output being copied to text file, use txtStop to end txt> ave(dta$Range,dta$Lat1,FUN=mean)  [1] 616.440 714.360 616.440 690.770 714.360 714.360 690.770 766.155 851.550 [10] 851.550 766.15

Re: [R] save to file

2012-12-16 Thread vivek kumar singh
On 17/12/2012 11:03, Felipe Carrillo wrote: > I did check that link but it doesn't do what I want..thanks for trying though. > > > Felipe D. Carrillo > Supervisory Fishery Biologist > Department of the Interior > US Fish & Wildlife Service > California, USA > http://www.fws.gov/redbluff/rbdd_jsmp.a

Re: [R] save to file

2012-12-16 Thread arun
HI, I guess ?sink() may not work for you as you need  the whole R console. Have you tried library(TeachingDemos) ?txtStart(), ?txtStop() ? txtStart("foo.txt",commands=TRUE,results=TRUE,append=FALSE) txtStop() A.K. - Original Message - From: Felipe Carrillo To: "r-h...@stat.math.eth

Re: [R] forecasting accuracy problem in R

2012-12-16 Thread Leo
Thanks. Could be the following reason given in the changelog. " accuracy() can now figure out overlapping times for x and f." best regards Leo On Mon, Dec 17, 2012 at 10:11 AM, Jeff Newmiller wrote: > Please read the posting guide. Packages have their own developers, as well as > their own chan

Re: [R] forecasting accuracy problem in R

2012-12-16 Thread Jeff Newmiller
Please read the posting guide. Packages have their own developers, as well as their own change logs [in this case http://cran.r-project.org/web/packages/forecast/ChangeLog]. --- Jeff NewmillerThe .

[R] forecasting accuracy problem in R

2012-12-16 Thread Leo
Hi, A few weeks back I used the following command: accuracy(train,test) where train and test are training and test data respectively. Last night I updated R and the forecast package and used the same command and I got error. After trying a little I used the following command accuracy(train,test

Re: [R] save to file

2012-12-16 Thread Felipe Carrillo
I did check that link but it doesn't do what I want..thanks for trying though. Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA http://www.fws.gov/redbluff/rbdd_jsmp.aspx From: arun >To: Felipe Carrillo >Sent: Sunday, Dec

Re: [R] averaging X of specific Y (latitude)

2012-12-16 Thread arun
HI, Not sure if this what you meant. ave(dta$Range,floor(dta$Latitude),FUN=mean) # [1] 616.440 714.360 616.440 690.770 714.360 714.360 690.770 766.155 851.550 #[10] 851.550 766.155 A.K. - Original Message - From: Elaine Kuo To: dcarl...@tamu.edu; r-help@r-project.org; r-sig-...@stat.ma

[R] save to file

2012-12-16 Thread Felipe Carrillo
 Hi, What's the equivalent of "Save to File" from the R console File menu on an R routine? Just trying to capture the whole R console into a text file when my code fails. Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA http

Re: [R] averaging X of specific Y (latitude)

2012-12-16 Thread David L Carlson
It is not necessary to rearrange the order. The aggregate function will do that. To get the mean Range for a latitude combining species within a latitude just remove Species: > aggregate(Range~floor(Latitude), dta, mean) floor(Latitude) Range 1 9 616.440 2 10 714.360

Re: [R] interfacing with .Call

2012-12-16 Thread Thomas Lumley
On Mon, Dec 17, 2012 at 8:02 AM, William Dunlap wrote: > The problem almost certainly lies in the parts of the code that you have > not shown, the R-language code including the .Call or, more likely in my > opinion, the C++ code for Projector. I would have blamed the unPROTECTed coerceVector()

[R] Fw: simulate time data

2012-12-16 Thread Jichun Chan
- Forwarded Message - From: Jichun Chan To: David Winsemius Sent: Friday, 14 December 2012 5:30 PM Subject: Re: [R] simulate time data Hi David, Thank you for replying my email. I have to apology that I haven't been very clear with my question. I am actually trying to simulate a s

Re: [R] non-numeric argument to binary operator

2012-12-16 Thread Duncan Murdoch
On 12-12-16 6:56 PM, Shrupa Sumaria wrote: Hello, I wish to carry out the following: factor_classes <- as.factor(sample(c("BM", "SM", "F"), 10, replace = TRUE)) C <- 5 k <- matrix(0, length(factor_classes), 1) for (i in length(factor_classes)) { k[i] <- C*factor_classes[i] } I get

Re: [R] non-numeric argument to binary operator

2012-12-16 Thread Rui Barradas
Hello, Try C*as.integer(factor_classes) And note that you don't need the loop. Hope this helps, Rui Barradas Em 16-12-2012 23:56, Shrupa Sumaria escreveu: > Hello, > > > I wish to carry out the following: > > > factor_classes <- as.factor(sample(c("BM", "SM", "F"), 10, replace = TRUE)) > > > C

[R] non-numeric argument to binary operator

2012-12-16 Thread Shrupa Sumaria
Hello, I wish to carry out the following: factor_classes <- as.factor(sample(c("BM", "SM", "F"), 10, replace = TRUE)) C <- 5 k <- matrix(0, length(factor_classes), 1) for (i in length(factor_classes)) { k[i] <- C*factor_classes[i] } I get the following error message: non-numeric ar

[R] nls for sum of exponentials

2012-12-16 Thread Diviya Smith
Hi there, I am trying to fit the following model with a sum of exponentials - y ~ Ae^(-md) + B e^(-nd) + c the model has 5 parameters A, b, m, n, c I am using nls to fit the data and I am using DEoptim package to pick the most optimal start values - fm4 <- function(x) x[1] + x[2]*exp(x[3] * -d

Re: [R] averaging X of specific Y (latitude)

2012-12-16 Thread Elaine Kuo
Thank you, David. Your answer reminded me of rearranging the order according to the latitude before running the calculation. One more question, please kindly help with the code to calculate the mean of the ranges of the same latitude? Or should any re-arrangement be noticed before the mean calcul

Re: [R] kruskalmc, significant differences while median values are the same

2012-12-16 Thread Thomas Lumley
On Sat, Dec 15, 2012 at 10:04 PM, Omphalodes Verna < omphalodes.ve...@yahoo.com> wrote: > Dear list! > > I work with multiple Kruskal-Wallis test (kruskalmc, package pgirmess), > which evaluates differences in medians among groups (5 groups). A result of > a test is significant differences among s

Re: [R] sweave and lessR

2012-12-16 Thread Scott Cushman
Thank you for the reply. With many calls to Density() I miss Sweave taking care of the naming of the files and the generating of the \includegraphics statements, but I guess this will work. On Dec 16, 2012, at 2:54 PM, Duncan Murdoch wrote: > On 12-12-16 12:42 PM, Scott Cushman wrote: >> >> H

Re: [R] sweave and lessR

2012-12-16 Thread Duncan Murdoch
On 12-12-16 3:12 PM, Scott Cushman wrote: Thank you for the reply. With many calls to Density() I miss Sweave taking care of the naming of the files and the generating of the \includegraphics statements, but I guess this will work. You (or the lessR author) could possibly write your own custo

Re: [R] sweave and lessR

2012-12-16 Thread Duncan Murdoch
On 12-12-16 12:42 PM, Scott Cushman wrote: Hello I am using sweave with the Density() function from lessR package. However, unlike the older color.density() function, Density() does not work with the standard graphic output functions in R, such as pdf. Is there away to include figures fgenera

Re: [R] averaging X of specific Y (latitude)

2012-12-16 Thread arun
Hi, You could also use ?ave(): dta$Lat1<-floor(dta$Latitude) # ?trunc(), ?round(), ?signif() could also replace ?floor() dta$Mean<-ave(dta$Range,dta$Species,dta$Lat1,FUN=mean) dta A.K. - Original Message - From: David L Carlson To: 'Elaine Kuo' ; r-help@r-project.org; 'r-sig-geo' Cc

[R] sweave and lessR

2012-12-16 Thread Scott Cushman
Hello I am using sweave with the Density() function from lessR package. However, unlike the older color.density() function, Density() does not work with the standard graphic output functions in R, such as pdf. Is there away to include figures fgenerated rom lessR in sweave documents? thank yo

Re: [R] interfacing with .Call

2012-12-16 Thread William Dunlap
The problem almost certainly lies in the parts of the code that you have not shown, the R-language code including the .Call or, more likely in my opinion, the C++ code for Projector. You can get different values in Projector's Lsum matrix if (a) Projector doesn't assign values to all of them (

Re: [R] interfacing with .Call

2012-12-16 Thread R. Michael Weylandt
On Sun, Dec 16, 2012 at 6:20 PM, Shangru Li wrote: > Hi > The function "Projector" works well and actually the interface with .C > works OK. > The question is that I can compile it in R, but ".Call" returns different > result each time with same inputs. Could anybody tell me why? Thanks! > I have

[R] interfacing with .Call

2012-12-16 Thread Shangru Li
Hi My code is as following: #include #include //* the Projector part *// void Projector(double *L, int *dimL, double *G, int *dimG, double *W, int *dimW, int *xymod, int *dimxy, double *modif, int *dimif, double *Lsum) { ...} //* the interface part *// #define getDim(A) INTEGER(coerceVector(

Re: [R] averaging X of specific Y (latitude)

2012-12-16 Thread David L Carlson
It is better to use dput() in R to create a text version of your data for us to work with. The aggregate command below gives you the mean ranges by butterfly species and latititude and saves the result as Bfly. The colnames() command simply renames the columns: > dta <- structure(list(Species = st

Re: [R] How to make a prior graph

2012-12-16 Thread Rui Barradas
Hello, I believe that you're talking about beta-binomial models and that the Jeffrey's prior you're talking about is a Beta(1/2, 1/2). If so, try the following. jeffrey <- function(x) dbeta(x, shape1 = 1/2, shape2 = 1/2) curve(dunif, from = 0, to = 1) curve(jeffrey, from = 0, to = 1, add = T