Re: [R] Question about proxy setting of R
As far as I can see, the 'internal' method doesn't work for https mirrors (on my system, anyway). However, the http mirrors still exist (try " http://cloud.r-project.org/; for example) so why not just use one of those? Cheers, Carina On 5 December 2016 at 12:27, jim holtmanwrote: > You will probably have to check with your network folks to see what is > possible on your system. > > > Jim Holtman > Data Munger Guru > > What is the problem that you are trying to solve? > Tell me what you want to do, not how you want to do it. > > On Mon, Dec 5, 2016 at 6:33 AM, wrote: > > > Dear Jim, > > > > Thanks to your advice, "Proxy Authentification" window showed up, > however, > > I couldn't access to the internet. Error messages are as below. > > > > -- -- --- > > > update.packages(ask='graphics',checkBuilt=TRUE) > > --- Please select a CRAN mirror for use in this session --- > > Warning: failed to download mirrors file (scheme not supported in URL > > 'https://cran.r-project.org/CRAN_mirrors.csv'); using local file > > 'C:/PROGRA~1/R/R-33~1.2/doc/CRAN_mirrors.csv' > > Warning: unable to access index for repository > > https://cran.ism.ac.jp/src/contrib: > > scheme not supported in URL 'https://cran.ism.ac.jp/src/ > contrib/PACKAGES' > > > > Proxy authentication failed: > > please re-enter the credentials or hit Cancel > > -- -- --- > > > > I assume the proxy server is only available for "http", not "https". > > What should I do ? > > > > J J > > > > > > - Original Message - > > *From:* jim holtman > > *To:* qwertyui_per...@yahoo.co.jp > > *Date:* 2016/12/2, Fri 09:13 > > *Subject:* Re: [R] Question about proxy setting of R > > > > Try this option: > > > > options(download.file.method = "internal") > > > > > > > > > > > > Jim Holtman > > Data Munger Guru > > > > What is the problem that you are trying to solve? > > Tell me what you want to do, not how you want to do it. > > > > On Wed, Nov 30, 2016 at 10:37 PM, wrote: > > > > Hello, > > > > I use R 3.0.2 on Win 7 through proxy server using ".Rprofile" in home > > directory that includes "Sys.setenv(http_proxy=proxy_ server:port)". > > There has been no problem to access the internet for some years. > > In this situation, I installed R 3.3.1 and then entered "update.packages > > ()", however, "Proxy Authentification" window didn't show up and > > failed to access the internet. Error messages are as below. > > > > -- -- --- > > > update.packages(ask='graphics' ,checkBuilt=TRUE) > > --- Please select a CRAN mirror for use in this session --- > > Warning: failed to download mirrors file (cannot open URL > > 'https://cran.r-project.org/CRAN_mirrors.csv'); using local file > > 'C:/PROGRA~1/R/R-33~1.2/doc/ CRAN_mirrors.csv' > > Warning: unable to access index for repository > > https://cran.ism.ac.jp/src/contrib: > > cannot open URL 'https://cran.ism.ac.jp/src/contrib/PACKAGES' > > Warning: unable to access index for repository > > http://www.stats.ox.ac.uk/pub/RWin/src/contrib: > > cannot open URL 'http://www.stats.ox.ac.uk/ > pub/RWin/src/contrib/PACKAGES > > ' > > Warning message: > > In download.file(url, destfile = f, quiet = TRUE) : > > cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv': HTTP > > status was '407 Proxy Authentication Required' > > > > -- -- --- > > > > Strange to say, R 3.0.2 is able to access to the internet, and R 3.3.1 > > shows collect proxy setting in ".Rprofile" by "Sys.getenv("http_proxy")" > > From internet information, I added "http_proxy_user=ask" to ".Rprofile", > or > > " --internet2" to the desktop icon of R 3.3.1, ending up in the same > > result. > > > > Please show me the way of proxy setting of R 3.3.1. > > > > __ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.r-project.org/ > > posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > > > > > > > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/ > posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide
[R] Use of 'by' function with FUN=mean
Hi everybody I'm having some unexpected errors from the 'by' function when using it to apply the mean function (by a factor) to a dataframe of numerical variables. The following piece of toy code demonstrates: myDataF-warpbreaks myDataF$X-runif(54) # creating an additional numerical variable in warpbreaks for purposes of this demo by(myDataF[,c(X,breaks)],myDataF[,tension],FUN=mean) In R3.0.1 R3.0.2 (run on Windows 7) this gives the following error myDataF[, tension]: L [1] NA - myDataF[, tension]: M [1] NA - myDataF[, tension]: H [1] NA Warning messages: 1: In mean.default(data[x, , drop = FALSE], ...) : argument is not numeric or logical: returning NA 2: In mean.default(data[x, , drop = FALSE], ...) : argument is not numeric or logical: returning NA 3: In mean.default(data[x, , drop = FALSE], ...) : argument is not numeric or logical: returning NA In R2.15.2 (again run on Windows 7) the works but gives a warning about a depreciated function : L X breaks 0.5705876 36.389 - : M X breaks 0.5370582 26.389 - : H X breaks 0.3908149 21.667 Warning messages: 1: mean(data.frame) is deprecated. Use colMeans() or sapply(*, mean) instead. 2: mean(data.frame) is deprecated. Use colMeans() or sapply(*, mean) instead. 3: mean(data.frame) is deprecated. Use colMeans() or sapply(*, mean) instead. I *think* that in older versions of R (which I no longer have installed) the use of 'by' in this way worked fine (it seems to appear in old code of mine, anyway). This would be consistent with the behavior being caused by a depreciated function, I guess. However, the help page for 'by' suggests that the above code should work, as far as I can tell, so I'm a bit confused - anybody got any ideas what I'm doing wrong here, please? Cheers, Carina [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fwd: Use of 'by' function with FUN=mean
Hi everybody Sorry guys, please ignore my previous email regarding the problem I was having using the 'by' function with FUN=mean. Just read the given error properly and realised my (silly) mistake in that you can no longer apply the mean function to a dataframe regardless of whether its wrapped within 'by' or not, as its depreciated in this context - I'm obviously a bit too ready for the weekend!! ;-) Cheers, Carina [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Adding Proxy information in 'R' application
Hi Jose I faced the same problem at my workplace too - the solution (at least for us) was to insert the following function into the Rprofile.ste file in the etc folder in the R install folder - or, if the .First function already exists, you could just insert the line beginning Sys.setenv( .) into that function. The bit in the speech marks needs to be a suitable web proxy address and port, and the 'http_proxy_user=ask' bit is telling R to ask for a username and password. .First - function() { Sys.setenv(http_proxy=http://webproxy:8080 http_proxy_user=ask) } Hope this works for you! Cheers, Carina On 8 November 2013 17:10, Batista, Jose jose.bati...@nb.com wrote: R-Help Mailing List, I'm currently working with a user who is actively trying to download install libraries for 'R' on her office PC. While using install.packages(packageName, dependencies = TRUE) works without a problem on our home PCs, we use a proxy at the firm and therefore it doesn't let the application go directly out of the network on port 80. Is there a way to manually set proxy information within the application so that it can, indeed, reach the internet when we're trying to download and install libraries (and necessary dependencies) from within the application? I've gone through some of the options but there's nothing there for it. Regards, José Emmanuel Batista If you are not an intended recipient of this e-mail, you are not authorized to duplicate, copy, retransmit or redistribute it by any means. Please delete it and any attachments immediately and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Neuberger Berman. Any views or opinions presented are solely those of the author and do not necessarily represent those of Neuberger Berman. This e-mail is subject to terms available at the following link: www.nb.com/disclaimer/usa.html. By messaging with Neuberger Berman you consent to the foregoing. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] survfit number of variables != number of variable names
Hi - I've seen a similar issue going on with survfit when using strata in the model, although I get a different error message from ge. If it helps to track down the problem (rather than confusing things further) here is some code that should reproduce the issue I've seen. I'm running R 2.15.2, with survival version 2.36-14 . Cheers, Carina ## library(survival) # use aml dataset from survival create 3 imaginary possible stratas - strat3 has 3 levels, strat4 has 4 levels, strat5 has 5 levels aml$strat3-as.factor(rep(c(1:3),length=nrow(aml))) aml$strat4-as.factor(rep(c(1:4),length=nrow(aml))) aml$strat5-as.factor(rep(c(1:5),length=nrow(aml))) # create a counting process format dataset from aml - call this aml2 aml2-survSplit(aml,cut=c(5,10,50),end=time,start=start,event=status,episode=i,id=indiv) # create a dataset of 4 'new' observations - call this aml.new aml.new-aml[1:4,] aml.new$time-c(30,50,70,100) aml.new$status-1 aml.new$x[1:4]-c(rep(Maintained,2),rep(Nonmaintained,2)) aml.new$strat3[1:4]-1 aml.new$strat4[1:4]-1 aml.new$strat5[1:4]-1 # create a counting process format dataset from aml.new - call this aml2.new aml2.new-survSplit(aml.new,cut=c(5,10,50),end=time,start=start,event=status,episode=i,id=indiv) # First a model using no strata - survfit works fine on new dataset myModel-coxph(Surv(start, time, status) ~ x,data = aml2) plot(survfit(myModel,aml2.new,id=indiv)) # Now a model using strata = strat4 (which has 4 levels) - survfit again works fine on new dataset (which has 4 new individuals) myModel-coxph(Surv(start, time, status) ~ x+strata(strat4),data = aml2) plot(survfit(myModel,aml2.new,id=indiv)) # Now a model using strata = strat3 (which has 3 levels) - survfit works here too myModel-coxph(Surv(start, time, status) ~ x+strata(strat3),data = aml2) plot(survfit(myModel,aml2.new,id=indiv)) # Now a model using strata = strat5 (which has 5 levels) - survfit now does not work, with error saying # Error in survfitcoxph.fit(y, x, wt, x2, risk, newrisk, strata, se.fit, : # 'names' attribute [5] must be the same length as the vector [4] myModel-coxph(Surv(start, time, status) ~ x+strata(strat5),data = aml2) plot(survfit(myModel,aml2.new,id=indiv)) # Now recreate aml.new but with 3 rather than 4 'new' observations rm(aml.new) aml.new-aml[1:3,] aml.new$time-c(30,50,70) aml.new$status-1 aml.new$x[1:3]-c(rep(Maintained,2),rep(Nonmaintained,1)) aml.new$strat3[1:3]-1 aml.new$strat4[1:3]-1 aml.new$strat5[1:3]-1 # create a counting process format dataset from aml.new aml2.new-survSplit(aml.new,cut=c(5,10,50),end=time,start=start,event=status,episode=i,id=indiv) # Survfit on model using strat3 still works myModel-coxph(Surv(start, time, status) ~ x+strata(strat3),data = aml2) plot(survfit(myModel,aml2.new,id=indiv)) # But Survfit on model using strat4 doesn't work now myModel-coxph(Surv(start, time, status) ~ x+strata(strat4),data = aml2) plot(survfit(myModel,aml2.new,id=indiv)) # Survfit on strat5 model doesn't work either myModel-coxph(Surv(start, time, status) ~ x+strata(strat5),data = aml2) plot(survfit(myModel,aml2.new,id=indiv)) On 19 November 2012 17:01, Terry Therneau thern...@mayo.edu wrote: I can't reproduce the problem. Tell us what version of R and what version of the survival package. Create a reproducable example. I don't know if some variables are numeric and some are factors, how/where the surv object was defined, etc. Terry Therneau On 11/17/2012 05:00 AM, r-help-requ...@r-project.org wrote: This works ok: cox = coxph(surv ~ bucket*(today + accor + both) + activity, data = data) fit = survfit(cox, newdata=data[1:100,]) but using strata leads to problems: cox.s = coxph(surv ~ bucket*(today + accor + both) + strata(activity), data = data) fit.s = survfit(cox.s, newdata=data[1:100,]) Error in model.frame.default(data = data[1:100, ], formula = ~bucket + : number of variables != number of variable names Note that the following give rise to the same error: fit.s = survfit(cox.s, newdata=data) Error in model.frame.default(data = data, formula = ~bucket + today + : number of variables != number of variable names but if I use data implicitly, all is working fine: fit.s = survfit(cox.s) Any idea on how I could solve this? Best, and thank you, ge __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and
[R] Using method = aic with pspline survreg (survival library)
Hi everybody. I'm trying to fit a weibull survival model with a spline basis for the predictor, using the survival library. I've noticed that it doesn't seem to be possible to use the aic method to choose the degrees of freedom for the spline basis in a parametric regression (although it's fine with the cox model, or if the degrees of freedom are specified directly by the user), and I was wondering if there is some reason for this? Simple example: library(survival) attach(cancer) # cox model with specified degs of freedom - works fine fit1 - coxph(Surv(time, status) ~ ph.ecog + pspline(age,3), cancer) # cox model with aic - works fine fit1 - coxph(Surv(time, status) ~ ph.ecog + pspline(age,method=aic), cancer) # weibull model with specified degs of freedom - works fine fit1 - survreg(Surv(time, status) ~ ph.ecog + pspline(age,3), cancer, dist=weibull) # weibull model with aic - gives an error fit1 - survreg(Surv(time, status) ~ ph.ecog + pspline(age,method=aic),dist=weibull, cancer) Error in (cfun[[1]])(parmlist[[1]], iter, iterlist[[1]], n.eff, pdf[1], : object 'loglik' not found I also get a similar error about object 'loglik' not found if I try to use method=aic in the specification of a frailty term in a survreg model. Thanks for your help - apologies in advance if I'm missing something very obvious. I'm using R2.13.0 btw, with survival v2.39-9. Regards Carina [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.