[R] Improving performance by rewriting for loops into apply functions

2016-07-22 Thread Aleš Grm
Hello, I have a slight performance issue that I'd like to solve by rewriting a short bit of code that uses for loops so that it would use apply in order to get some performance gains. My problem is that I can't modify the variables that are passed to apply function during apply functions

Re: [R] Using C library in R

2016-07-22 Thread Jeff Newmiller
You are entitled to your opinion, but apparently you have not read the Posting Guide either. -- Sent from my phone. Please excuse my brevity. On July 22, 2016 6:00:19 PM PDT, Dirk Eddelbuettel wrote: >Jeff Newmiller dcn.davis.ca.us> writes: >> 2) Interfacing R with other

Re: [R] Using C library in R

2016-07-22 Thread Dirk Eddelbuettel
Jeff Newmiller dcn.davis.ca.us> writes: > 2) Interfacing R with other languages is off-topic on this list. There are other lists where such issues are > on-topic. Your post is a bit like walking into a bowling alley and asking if anyone there can solve your > chess problem... someone might be

Re: [R] Using C library in R

2016-07-22 Thread Jeff Newmiller
Read the Posting Guide. This will tell you at least two important things: 1) Post using plain text. HTML mangles code. 2) Interfacing R with other languages is off-topic on this list. There are other lists where such issues are on-topic. Your post is a bit like walking into a bowling alley and

Re: [R] Turn character /string as variable/column name in summarize in dplyr

2016-07-22 Thread John Kane
It really might help to have a minimum working example Have a look at http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and/or http://adv-r.had.co.nz/Reproducibility.html John Kane Kingston ON Canada > -Original Message- > From:

Re: [R] Aggregate data to lower resolution

2016-07-22 Thread Miluji Sb
Dear Jean, Thank you so much for your reply and the solution, This does work. I was wondering is this similar to 'rasterFromXYZ'? Thanks again! Sincerely, Milu On Fri, Jul 22, 2016 at 3:06 PM, Adams, Jean wrote: > Milu, > > Perhaps an approach like this would work. In the

[R] Using C library in R

2016-07-22 Thread Ganz, Carl
Hello everyone, I am attempting to link to a C library named libxlsxwriter (http://libxlsxwriter.github.io/) that creates and styles XLSX files, but after several days of repeatedly reading "Writing R Extensions", and I am stuck and hoping someone can help me. The C library is easy to use and

Re: [R] Why the order of parameters in a logistic regression affects results significantly?

2016-07-22 Thread David Winsemius
> On Jul 21, 2016, at 3:04 PM, Qinghua He via R-help > wrote: > > Using the same data, if I ran > fit2 > <-glm(formula=AR~Age+LumA+LumB+HER2+Basal+Normal,family=binomial,data=RacComp1)summary(fit2)exp(coef(fit2)) > I obtained: exp(coef(fit2))(Intercept) Age

Re: [R] Why the order of parameters in a logistic regression affects results significantly?

2016-07-22 Thread Michael Dewey
Dear Peter Have you tried removing the intercept? Just put -1 at the end of your formula. On 21/07/2016 23:04, Qinghua He via R-help wrote: Using the same data, if I ran fit2 <-glm(formula=AR~Age+LumA+LumB+HER2+Basal+Normal,family=binomial,data=RacComp1)summary(fit2)exp(coef(fit2)) I

Re: [R] about interpolating data in r

2016-07-22 Thread William Dunlap via R-help
approx() has a 'rule' argument that controls how it deals with extrapolation. Run help(approx) and read about the details. Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Jul 22, 2016 at 8:29 AM, lily li wrote: > Thanks, Ismail. > For the gaps before 2009-01-05 and

Re: [R] about interpolating data in r

2016-07-22 Thread lily li
Thanks, Ismail. For the gaps before 2009-01-05 and after 2009-11-20, I use the year 2010 to fill in the missing values for column C. There is no relationship between column A, B, and C. For the missing values between 2009-01-05 and 2009-11-20, if there are any, I found this approach is very

Re: [R] PDF extraction with tm package

2016-07-22 Thread Jeff Newmiller
This is neither the Xpdf support forum nor the Windows Setup Program Reinvention support group... and you really need to read and follow the Posting Guide for the R mailing lists. FWIW I would guess that you need to learn about environment variables and in particular about the PATH variable.

Re: [R] Why the order of parameters in a logistic regression affects results significantly?

2016-07-22 Thread Greg Snow
Please post in plain text, the message is very hard to read with the reformatting that was done. Did you receive any warnings when you fit your models? The fact that the last coefficient is NA in both outputs suggests that there was some co-linearity in your predictor variables and R chose to

Re: [R] Aggregate data to lower resolution

2016-07-22 Thread Adams, Jean
Milu, Perhaps an approach like this would work. In the example below, I calculate the mean GDP for each 1 degree by 1 degree. temp$long1 <- floor(temp$longitude) temp$lat1 <- floor(temp$latitude) temp1 <- aggregate(GDP ~ long1 + lat1, temp, mean) long1 lat1GDP 1 -69 -55 0.90268640

Re: [R] about interpolating data in r

2016-07-22 Thread Jim Lemon
Hi lili, The problem may lie in the fact that I think you are using "interpolate" when you mean "extrapolate". In that case, the best you can do is spread values beyond the points that you have. Find the slope of the line, put a point at each end of your time data (2009-01-01 and 2009-12-31) and

Re: [R] installing the lubricate package

2016-07-22 Thread Hervé Pagès
also it's lubridate, not lubricate :-/ On 07/21/2016 05:44 PM, Ismail SEZEN wrote: You don't have to download and install from github. You can install lubridate package easly from cran repository. If you really intend to install from github, i advise you install devtools package first and use

Re: [R] Changing Index Labelling on x axis

2016-07-22 Thread Ivan Calandra
Hi Nick, If I understand you correctly, that should do it: plot(x=seq_along(data)+2, y=data) HTH, Ivan -- Ivan Calandra, PhD Scientific Mediator University of Reims Champagne-Ardenne GEGENAA - EA 3795 CREA - 2 esplanade Roland Garros 51100 Reims, France +33(0)3 26 77 36 89

[R] Changing Index Labelling on x axis

2016-07-22 Thread WRAY NICHOLAS
Hi I have a vector of data (for example c(2,3,4,5,4,3,2) data<-c(2,3,4,5,4,3,2) plot(data) I simply want to up the index values along the x axis by 2, so that instead of 1, I have 3, instead of 2 I have 4 etc etc. Despite ages playing around with the axis function I can't get it to work, and

Re: [R] How to plot marginal effects (MEM) in R?

2016-07-22 Thread David Winsemius
> On Jul 21, 2016, at 11:44 PM, Faradj Koliev wrote: > > Dear David Winsemius, > > Thank you! > > The sample make no sense, I know. The real data is too big. So, I only want > to understand how to plot marginal effects, to visualize them in a proper > way. > Before

Re: [R] readline issue with 3.3.1

2016-07-22 Thread Ralf Goertz
Am Thu, 21 Jul 2016 18:07:43 +0200 schrieb Martin Maechler : > Ralf Goertz on Wed, 20 Jul 2016 16:37:53 +0200 > writes: >> I installed readline version 6.3 and the issue is gone. So probably >> some of the recent changes in R's readline code are

Re: [R] C/C++/Fortran Rolling Window Regressions

2016-07-22 Thread Martin Maechler
> jeremiah rounds > on Thu, 21 Jul 2016 13:56:17 -0700 writes: > I appreciate the timing, so much so I changed the code to show the issue. > It is a problem of scale. > roll_lm probably has a heavy start-up cost but otherwise completely >

Re: [R] How to plot marginal effects (MEM) in R?

2016-07-22 Thread Faradj Koliev
Dear David Winsemius, Thank you! The sample make no sense, I know. The real data is too big. So, I only want to understand how to plot marginal effects, to visualize them in a proper way. Best, > 22 juli 2016 kl. 08:35 skrev David Winsemius : > >> >> On Jul 21,

Re: [R] How to plot marginal effects (MEM) in R?

2016-07-22 Thread David Winsemius
> On Jul 21, 2016, at 2:22 PM, Faradj Koliev wrote: > > Dear all, > > I have two logistic regression models: > > > • model <- glm(Y ~ X1+X2+X3+X4, data = data, family = "binomial") > > > > • modelInteraction <- glm(Y ~ X1+X2+X3+X4+X1*X4, data = data, family = >