Re: [R] Establishing dates in Time Series Data

2016-09-21 Thread David Winsemius
> On Sep 21, 2016, at 7:20 PM, Jeff Reichman wrote: > > R-Help Forum > > > > I'm working with a time series data set whose times periods are days of the > year. While it's pretty straight forward of how, for example, to start my > series on (say) January 2015,but

[R] Establishing dates in Time Series Data

2016-09-21 Thread Jeff Reichman
R-Help Forum I'm working with a time series data set whose times periods are days of the year. While it's pretty straight forward of how, for example, to start my series on (say) January 2015,but how do I write the code such that my time series starts on (say) the 3rd of Jan 2015? >

Re: [R] Problem Mixstock in R

2016-09-21 Thread Nordlund, Dan (DSHS/RDA)
Googling "mixstock CRAN" I found the following: Package 'mixstock' was removed from the CRAN repository. Formerly available versions can be obtained from the archive. Archived on 2014-08-30 as long-term memory-access errors were not corrected. You might want to contact the maintainer of the

Re: [R] Problem Mixstock in R

2016-09-21 Thread Marc Girondot via R-help
Le 19/09/2016 à 10:53, FIORAVANTI TATIANA a écrit : Dear members of the R-project I am doing a mixed stock analysis with the Mixstock Package in R, at the end of the analysis I would summarize all my results (mean, standard deviation, median, percentile, etc...) using the mysum(x, name=NULL)

Re: [R] "invalid argument to unary operator" while selecting rows by name

2016-09-21 Thread William Dunlap via R-help
The OP cannot be entirely blamed for thinking that x[,-"ColName"] would omit x's "ColName" from the result. Base R and many packages have commonly used functions that do context-sensitive (aka 'nonstandard') evaluation. E.g. subset() evaluates each argument in a different way: >

Re: [R] if/else help

2016-09-21 Thread David Winsemius
> On Sep 21, 2016, at 8:26 AM, MacQueen, Don wrote: > > Hopefully this is not a homework question. > > The other responses are fine, but I would suggest the simplest way to do > exactly what you ask is > > > if (!exists('r4')) r4 <- data.frame(a=0, b=0, c=0, d='x') > >

[R] FW: Why removing the (Intercept) from lm is done by adding -1?

2016-09-21 Thread S Ellison
> Subject: Re: [R] Why removing the (Intercept) from lm is done by adding -1? > > And in R, - means omit, as in > mydataframe[, -1] > right? Not really, no. In the specific interpretation of an R model formula, '-' means 'remove the _term_ following '-' ...'. As below: > This is all in the

Re: [R] Help with PCA data file prep and R code

2016-09-21 Thread Sarah Stinson
Hello DRUGs, I'm new to R and would appreciate some expert advice on prepping files for, and running, PCA... My data set consists of aquatic invertebrate and zooplankton count data and physicochemical measurements from an ecotoxicology study. Four chemical treatments were applied to mesocosm

Re: [R] if/else help

2016-09-21 Thread MacQueen, Don
Hopefully this is not a homework question. The other responses are fine, but I would suggest the simplest way to do exactly what you ask is if (!exists('r4')) r4 <- data.frame(a=0, b=0, c=0, d='x') The exists() function requires a character string for its first argument, i.e., the name of the

Re: [R] if/else help

2016-09-21 Thread William Dunlap via R-help
If you write your code as functions you can avoid the nasty 'if(exists("x"))x<-...' business this by writing default values for arguments to your function. They will be computed only when they are used. E.g., analyzeData <- function(a=0, b=0, c=0, d="x", r4 = data.frame(a, b, c, d)) {

Re: [R] "invalid argument to unary operator" while selecting rows by name

2016-09-21 Thread Bert Gunter
No, Rui, your example misses the point. Your initial sentence hits it. The OP needs to carefully read ?"[" and/or spend some time with a suitable R tutorial to learn proper syntax for subscripting. Asking foolish questions in lieu of doing her homework seems wrongheaded to me. Others may

Re: [R] Why removing the (Intercept) from lm is done by adding -1?

2016-09-21 Thread Sarah Goslee
Linear regression is of the form y = mx + b right? And in R, - means omit, as in mydataframe[, -1] right? But when you specify a formula within lm(), the intercept is implicit. That is, you write: y ~ x and m and b are fitted. So if you want to omit the intercept, you use 1 as a

[R] Why removing the (Intercept) from lm is done by adding -1?

2016-09-21 Thread mviljamaa
So I found out that to remove the (Intercept) term from lm's model one can add -1 to the predictors. I.e. do lm(resp ~ x1 + x2 - 1) Another way is to add 0, e.g. lm(resp ~ 0 + x1 + x2). Adding (or setting the (Intercept) term) zero seems more logical than subtracting one, but why is there the

Re: [R] Help with PCA data file prep and R code

2016-09-21 Thread David L Carlson
It was not acceptable. Files with a .csv extension are stripped by the list. If you rename it as .txt it should survive. It appears that you have a controlled experimental design with explanatory and response variables, so why are you using pca which lumps them together? Alternatives might be

Re: [R] "invalid argument to unary operator" while selecting rows by name

2016-09-21 Thread S Ellison
> > Works like a charm, thanks! Still don't know what that error message > > means though. Any idea? You tried to negate a character string. -"601" '-' can't do that. [-x] relies on negative _numbers_ to remove elements, not on separate interpretation of '-' and 'x'. S Ellison

Re: [R] about data problem

2016-09-21 Thread Martin Maechler
> Joe Ceradini > on Tue, 20 Sep 2016 17:06:17 -0600 writes: > read.csv("your_data.csv", stringsAsFactors=FALSE) > (I'm just reiterating Jianling said...) If you do not have very many columns, and want to become more efficient and knowledgeable, I

Re: [R] Query on the R of free soft version 3

2016-09-21 Thread John Kane
What is your operating system? Please do not post in HTML. John Kane Kingston ON Canada > -Original Message- > From: kkam-...@echigo.ne.jp > Sent: Wed, 21 Sep 2016 09:30:15 +0900 > To: r-help@r-project.org > Subject: [R] Query on the R of free soft version 3 > > Dear > > > >

Re: [R] "invalid argument to unary operator" while selecting rows by name

2016-09-21 Thread ruipbarradas
Hello, The error message means exactly what it says. The operator '-' is unary and cannot be followed by a non-numeric atomic object (a vector). Try for instance x <- list(a=1:10, b=rnorm(5)) -x Rui Barradas   Citando Pauline Laïlle : > Works like a charm, thanks!

Re: [R] mgcv: bam(), error in models with random intercepts and random slopes

2016-09-21 Thread Simon Wood
Any chance you could send me the data and exact code that produces this (I'll only use the data for investigating this issue of course - often data with the predictor replaced by noise will produce the same error, if sending the raw data is a problem)? best, Simon (mgcv maintainer) On

Re: [R] Query on the R of free soft version 3

2016-09-21 Thread PIKAL Petr
Hi > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Kamin > Kyuji > Sent: Wednesday, September 21, 2016 2:30 AM > To: R-help@r-project.org > Subject: [R] Query on the R of free soft version 3 > > Dear > > > > Although I can install the new version of

Re: [R] Query on the R of free soft version 3

2016-09-21 Thread David Winsemius
> On Sep 20, 2016, at 5:30 PM, Kamin Kyuji wrote: > > Dear > > > > Although I can install the new version of the R, I can not open the soft. > > > > How do I do it? Surely you will need to tell us more than that. This just tells us you are having problems but

Re: [R] if/else help

2016-09-21 Thread David Winsemius
> On Sep 20, 2016, at 12:31 PM, Crombie, Burnette N wrote: > > If a data.frame (r4) does not exist in my R environment, I would like to > create it before I move on to the next step in my script. How do I make that > happen? Here is what I want to do from a code

Re: [R] if/else help

2016-09-21 Thread Jeff Newmiller
Get rid of the commas? Get rid of the get() function call? Get rid of the cbind() function call? Post using plain text format so the HTML doesn't screw up code? Read the Posting Guide? All of these ideas have merit IMHO... -- Sent from my phone. Please excuse my brevity. On September 20, 2016

Re: [R] Issue on LGP solving

2016-09-21 Thread PIKAL Petr
Hi > -Original Message- > From: Dr. Debasis Ghosh [mailto:d...@debasis.in] > Sent: Tuesday, September 20, 2016 3:59 PM > To: PIKAL Petr ; R-help@r-project.org > Subject: RE: [R] Issue on LGP solving > > Thanks Petr!! However, I found in the goalprog package I found

Re: [R] Run a fixed effect regression and a logit regression on a national survey that need to be "weighted"

2016-09-21 Thread laura roncaglia
Thank you for the answer but I had already tried that way; when I introduce weights in the glm appears the error: Warning: non-integer #successes in a binomial glm! I tried to run the glm regression using the family quasibinomial: eq <- glm(pip ~ men + age_pr + age_c + I(age_pr^2) + I(age_c^2),

[R] Query on the R of free soft version 3

2016-09-21 Thread Kamin Kyuji
Dear Although I can install the new version of the R, I can not open the soft. How do I do it? Kyuzi Kamoi, MD. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

[R] if/else help

2016-09-21 Thread Crombie, Burnette N
If a data.frame (r4) does not exist in my R environment, I would like to create it before I move on to the next step in my script. How do I make that happen? Here is what I want to do from a code perspective: if (exists(r4)) { is.data.frame(get(r4)) } else { a <- 0, b <- 0, c <- 0, d <- "x",

[R] Help with PCA data file prep and R code

2016-09-21 Thread Sarah Stinson
Hello DRUGs, I'm new to R and would appreciate some expert advice on prepping files for, and running, PCA... My data set consists of aquatic invertebrate and zooplankton count data and physicochemical measurements from an ecotoxicology study. Four chemical treatments were applied to mesocosm