You are on page 1of 3

signup

StackOverflowisaquestionandanswersiteforprofessionalandenthusiastprogrammers.It's100%free,no
registrationrequired.

login

tour

ProxysettingforRStackOverflow

4/16/2015

help

stackoverflowcareers

Takethe2minutetour

ProxysettingforR
IamfacingproblemwhileconectingRwithinternetinmyoffice.MaybethisduetoLANsettings.ItriedthealmostallpossiblewaysIcome
acrossintheweb(seebelow)butstillinvain.
Method1:InvokingRusinginternet2
Method2:InvokingRbysetting"~/Rgui.exe" http_proxy=http:/999.99.99.99:8080/http_proxy_user=ask
Method3:SettingSetinternet2=TRUE
Method4:
curl<getCurlHandle()
curlSetOpt(.opts=list(proxy='999.99.99.99:8080'),curl=curl)
Res<getURL('http://www.cricinfo.com',curl=curl)

InaboveallmethodsIcanabletoloadpackagesdirectlyfromCRANalsoabletodownloadfilesusingdownload.filecommand
Butusing getURL(RCurl) , readHTMLTable(XML) , htmlTreeParse(XML) commandsIamunabletoextractwebdata.Iamgetting ~
<HEAD>\n<TITLE>AccessDenied</TITLE>\n</HEAD>~ error.
HowtosetLANproxysettingsforXMLpackageinR?
r

editedJun27'11at6:11

askedJun24'11at11:43
user813966
331

11

Ifyou'vetriedeverythinganditstilldoesn'twork,thenspeaktoyournetworkadministratortheymayneed
tosetupafirewallexceptiontoallowtrafficthroughfromyourmachine.RichieCottonJun28'11at13:39

6Answers

OnMacOS,Ifoundthebestsolutionhere.Quotingtheauthor,twosimplestepsare:
1)OpenTerminalanddothefollowing:
exporthttp_proxy=http://staffproxy.ul.ie:8080
exportHTTP_PROXY=http://staffproxy.ul.ie:8080

2)RunRanddothefollowing:
Sys.setenv(http_proxy="http://staffproxy.ul.ie:8080")

doublecheckthiswith:
Sys.getenv("http_proxy")

Iambehinduniversityproxy,andthissolutionworkedperfectly.Themajorissueistoexportthe
itemsinTerminalbeforerunningR,bothinupperandlowercase.
answeredNov28'11at14:56
GeekOnAcid
3,467

15

40

1 AndifrunningRStudio,thenopenitfromtheTerminalafterstep1,perhapsvia"open
/Applications/RStudio.app".GlennOct10'13at1:34
Hi,howcanIsetitbacktodefault.Itriedyoursolution,andnowIamusingwifiwithnoproxybutIcan't
installapackageanymoreinRStudio.Itried Sys.setenv(http_proxy="") ,alsoIrunthestep1againin
theterminalsettingittoemptystring "" .Doublecheckitanditreturns "" ,butstillcan'tinstall.
AlthoughIcaninstallapackageinterminal,butnotinRStudioanymore.AlAhmadgaidAsaadFeb11at
13:55
1 @AlAhmadgaidAsaadStrange,thebehaviourindicatestheproblemonRstudiosidebutIguessyou
shouldloosethoseproxychangeswhenyouquitRstudiowithoutsavingthesession.Haveyoutriedthat?
OtherwiseI'mnotsure...GeekOnAcidFeb11at20:30
Ididwhatyousuggest,cleareverythingfrommyworkspace.Andnowitworks!Thanks!

http://stackoverflow.com/questions/6467277/proxysettingforr

1/3

4/16/2015

ProxysettingforRStackOverflow

AlAhmadgaidAsaadFeb12at3:29

Theproblemiswithyourcurloptionsthe RCurl packagedoesn'tseemtouse internet2.dll .


Youneedtospecifytheportseparately,andwillprobablyneedtogiveyouruserlogindetailsas
networkcredentials,e.g.,
opts<list(
proxy="999.999.999.999",
proxyusername="mydomain\\myusername",
proxypassword="mypassword",
proxyport=8080
)
getURL("http://stackoverflow.com",.opts=opts)

Remembertoescapeanybackslashesinyourpassword.YoumayalsoneedtowraptheURLin
acallto curlEscape .
editedOct28'11at9:47

answeredJun24'11at12:24
RichieCotton
42.4k

74

169

iftheoptionsspecifiedaregloballysetwith curlSetOpt(.opts=opts) arethesealsousedforother


connectionssuchaswithconnectionsfrom XML packagee.g.: htmlTreeParse() orhowdoIforcethem
tousetheproxy?thanks!SebNov20'12at13:23

IhadthesameproblematmyofficeandIsolveditaddingtheproxyinthedestinationoftheR
shortcutclikonrightbuttonoftheRicon,preferences,andinthedestinationfieldadd
"C:\ProgramFiles\R\your_R_version\bin\Rgui.exe"
http_proxy=http://user_id:passwod@your_proxy:your_port/

BesuretoputthedirectorywhereyouhavetheRprograminstalled.Thatworksforme.Hope
thishelp.
editedNov3'11at13:00

answeredNov2'11at15:57
ManuelRamn
1,231

17

1 howdoesthisworkforRStudio?jsutdothesame?HattrickNZJul7'14at23:11

IfyoustartRfromadesktopicon,youcanaddtheinternetflagtothetargetline(rightclick,
properties)e.g."C:\ProgramFiles\R\R2.8.1\bin\Rgui.exe"internet2
answeredOct5'12at6:14
Jack
170

OnWindows7Isolvedthisbygoingintomyenvironmentsettings(trythislinkforhow)and
addinguservariables http_proxy and https_proxy withmyproxydetails.
answeredAug7'13at16:54
jtromans
704

12

19

Triedalloftheseandalsothesolutionsusingnetsh,winhttpetc.GeekOnAcid'sanswerhelped
medownloadpackagesfromtheserverbutnoneofthesesolutionsworkedforusingthe
packageIwantedtorun(twitteRpackage).
Thebestsolutionistouseasoftwarethatlet'syouconfiguresystemwideproxy.
FreeCap(free)andProxifier(trial)workedperfectlyformeatmycompany.
Pleasenotethatyouneedtoremoveproxysettingsfromyourbrowserandanyotherappsthat
youhaveconfiguredtouseproxyasthesetoolsprovidesystemwideproxyforallnetworktraffic
fromyourcomputer.
answeredJun14'13at2:52
RishiDua
1,550

20

http://stackoverflow.com/questions/6467277/proxysettingforr

2/3

4/16/2015

http://stackoverflow.com/questions/6467277/proxysettingforr

ProxysettingforRStackOverflow

3/3

You might also like