Re: [R] Compressing code help in a loop

2014-11-12 Thread PIKAL Petr
Hi slightly more general if first number is quarter and last two are year index - c(406, 107, 207, 307, 407, 108, 208, 308, 408, 109, 209, 309, 409, + 110, 210, 310, 410, 111, 211) year-substr(as.character(index), 2,3) qrt-substr(as.character(index), 1,1) as.numeric(factor(paste(year, qrt,

[R] factor levels numeric values

2014-11-12 Thread David Studer
Hi everybody, I have another question (to which I could not find an answer in my r-books. I am sure, it's not a great issue, but I simply lack of a good idea how to solve this: One of my variables gets imported as a factor instead of a numeric variable. Now I have a... Factor w/ 63 levels

Re: [R] factor levels numeric values

2014-11-12 Thread Gerrit Eichner
Hello, David, take a look at the beginning of the Warning section of ?factor. Hth -- Gerrit Hi everybody, I have another question (to which I could not find an answer in my r-books. I am sure, it's not a great issue, but I simply lack of a good idea how to solve this: One of my variables

Re: [R] Submodel selection using dredge and gam (mgcv)

2014-11-12 Thread Arnaud Mosnier
Hi Kamil, Thanks for your answer. In fact, I already tried something with operators in such a way you advise, but it seems more complicated due to the use of the s() and ti() operators. Can you provide a solution for the following example ? library(mgcv) set.seed(2) dat -

Re: [R] factor levels numeric values

2014-11-12 Thread David L Carlson
Also look at the Frequently Asked Questions document that comes with your R installation: 7.10 How do I convert factors to numeric? It may happen that when reading numeric data into R (usually, when reading in a file), they come in as factors. If f is such a factor object, you can use

Re: [R] R memory issues

2014-11-12 Thread ce
you may try to increase virtual memory : http://windows.microsoft.com/en-us/windows/change-virtual-memory-size#1TC=windows-7 -Original Message- From: eliza botto [eliza_bo...@hotmail.com] Date: 11/11/2014 02:35 PM To: r-help@r-project.org r-help@r-project.org Subject: [R] R memory issues

Re: [R] factor levels numeric values

2014-11-12 Thread Ivan Calandra
I have not completely followed the discussion, so excuse me if it was already pointed out. If numeric data are read as factors, this means that there are not only numeric data in the column. It could be an empty space somewhere, or some character that should be NA, or... I think it is worth

[R] Compilation error: Rcpp and related packages - record-gcc-switches missing

2014-11-12 Thread Antti Simola
Hello, I encountered problem with Linux machine (openSUSE, 3.1.1. version of R) while I tried to update the packages with update.packages(). Rcpp, RcppArmadillo and RcppEigen refused to compile because record-gcc-swtiches was missing. I don't know much about compiling and such so I didn't get any

Re: [R] factor levels numeric values

2014-11-12 Thread Jeff Newmiller
Another approach is to re-import your data using options that do not put the data into a factor in the first place. For example you can use the colClasses parameter in the read.table family of functions to specify numeric for that column. If you need to give special handling to that column

Re: [R] R memory issues

2014-11-12 Thread Prof Brian Ripley
On 12/11/2014 15:18, ce wrote: you may try to increase virtual memory : http://windows.microsoft.com/en-us/windows/change-virtual-memory-size#1TC=windows-7 That is a very low plausibility for the error. See the discussion in the FAQ:

[R] tapply error svyby function survey package

2014-11-12 Thread Martin Canon
Hi. I'm trying to calculate the weighted mean score of a quality of life measure (ovt) in patients with irritable bowel syndrome by their marital status (d7). This is a summary of the structure of the dataset: str(sii.tesis) 'data.frame':1063 obs. of 75 variables: $ id : int 51

Re: [R] tapply error svyby function survey package

2014-11-12 Thread Anthony Damico
try resetting your levels? if that doesn't work, please dput() an example data set that we can test with :) thanks! sii.design - update( sii.design , d6 = factor( d6 ) ) On Wed, Nov 12, 2014 at 7:59 AM, Martin Canon martin.ca...@gmail.com wrote: Hi. I'm trying to calculate the

Re: [R] Submodel selection using dredge and gam (mgcv)

2014-11-12 Thread Kamil Bartoń
Hi Arnaud, please read ?dredge - Details - Subsetting, where this is explained. On 2014-11-12 15:19, Arnaud Mosnier wrote: Hi Kamil, Thanks for your answer. In fact, I already tried something with operators in such a way you advise, but it seems more complicated due to the use of the s() and

Re: [R] tapply error svyby function survey package

2014-11-12 Thread Anthony Damico
hi martin, sending the first 25 rows does not help if it does not re-create the problem.. when i run the data you have provided, i do not encounter your problem (see below). someone else may be able to guess the issue, but this would be a lot easier to solve if you can create a minimal

Re: [R] Is it possible to define another kind of NA

2014-11-12 Thread MacQueen, Don
Along the lines of what Bert Gunter said, the ideal way to represent LDL results depends on the functions used later to analyze them. I deal with such data on a daily basis and have never found it necessary to incorporate that information in the same variable as the results. What would you do if

Re: [R] Synthestic Control Methods for Causal Inference

2014-11-12 Thread Peter Maclean
I am interested in conducting causal inference using synthetic control method using R where there are multiple treated units/regions. The current synth package allows only one treated unit to be compared to other (several) synthetic units. In my case, I have 5 treated units and 35 untreated

Re: [R] Submodel selection using dredge and gam (mgcv)

2014-11-12 Thread Arnaud Mosnier
Argh ! Ok ... my fault ... the use of back-ticks was the solution !!! Thanks, Arnaud 2014-11-12 14:19 GMT-05:00 Kamil Bartoń kamil.bar...@o2.pl: Hi Arnaud, please read ?dredge - Details - Subsetting, where this is explained. On 2014-11-12 15:19, Arnaud Mosnier wrote: Hi Kamil, Thanks

Re: [R] tapply error svyby function survey package

2014-11-12 Thread Martin Canon
Anthony, thanks for your reply. Resetting the levels didn't work. These are the first 25 rows of the dataset: structure(list(id = c(51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L, 73L, 74L, 75L, 76L), stratum = structure(c(1L, 4L, NA, 4L,

[R] subset drops S3 classes?

2014-11-12 Thread Murat Tasan
Hi all --- I've stumbled upon some pretty annoying behavior, and I'm curious how others may have gotten around it. When using subset(...) on a data frame that contains a custom S3 field, the class is dropped in the result: MyClass - function(x) structure(x, class = MyClass) df - data.frame(x =

Re: [R] subset drops S3 classes?

2014-11-12 Thread Murat Tasan
And as a follow-up, I implemented a barebones as.data.frame.MyClass(...). It works when dealing with non-subsetted data frames, but fails upon a subset(...) call: as.data.frame.MyClass - function(x, ...) as.data.frame.vector(x, ...) This works for a single column, e.g.:

Re: [R] subset drops S3 classes?

2014-11-12 Thread Murat Tasan
... nd nevermind, figured it out (from the final example on the Extract.data.frame page): `[.MyClass` - function(x, i, ...) { NextMethod([) mostattributes(RV) - attribute(x) RV } cheers, -m On Wed, Nov 12, 2014 at 11:02 PM, Murat Tasan mmu...@gmail.com wrote: And as a

[R] problem when using gmailr

2014-11-12 Thread PO SU
Dear expeRts, Hi, when i using gmailr through Rscript  got the following error : oauth_listener() needs an interactive environment But when i using the Rstudio it worked. Does the function gmail_auth(filepath,full) support the Rscript way ?? I need run it in a windows schdual task. TKS  --