I am trying to collect some data online, however R studio is unwilling to execute my command:
pop_uk_2011_2 <- read.csv("http://www.nomisweb.co.uk/api/v01/dataset/NM_144_1.data.csv?date=latest&geography=1237321209...1237321232,1237326502...1237326564,1237321121...1237321160,1237326565...1237326631,1237321161...1237321208,1237320728...1237320838,1237321276...1237321319,1237327043...1237327140,1237321233...1237321275,1237322311...1237322476,1237320313...1237320527,1237324154...1237324261,1237326984,1237326985,1237324262...1237324409,1237320528...1237320578,1237320595...1237320616,1237320579...1237320594,1237320617...1237320638,1237321343...1237321368,1237321320...1237321342,1237321369...1237321422,1237325041...1237325213,1237320639...1237320680,1237327368,1237320681,1237320682,1237327369,1237320683...1237320727,1237321002...1237321048,1237326991,1237321049...1237321053,1237326992,1237326993,1237321054...1237321061,1237326994,1237321062,1237326995,1237321063...1237321120,1237321423...1237321461,1237321478...1237321497,1237321462...1237321477,1237322477...1237322481,1237326959,1237322482,1237322483,1237326960,1237322484,1237322485,1237326961,1237322486,1237322487,1237326962,1237322488...1237322490,1237326963,1237322491...1237322633,1237327242...1237327256,1237324410...1237324722,1237324926...1237324989,1237326982,1237324990...1237324995,1237326983,1237324996...1237325001,1237327257...1237327289,1237325002...1237325028,1237327028,1237325029...1237325032,1237327029,1237325033...1237325035,1237327030,1237325036...1237325038,1237327031,1237325039,1237325040,1237325214...1237325296,1237327290...1237327325,1237325297...1237325349,1237321498...1237321537,1237326632...1237326694,1237327147...1237327183,1237321538...1237321570,1237325586...1237325759,1237326141...1237326194,1237327018,1237326195,1237326497,1237327019,1237326196,1237326498,1237326197,1237327020,1237326198,1237326199,1237326499,1237327021,1237326500,1237326200...1237326204,1237327022,1237326205...1237326207,1237327023,1237326208...1237326210,1237326501,1237327024...1237327027,1237326211...1237326230,1237320839...1237321001,1237326376...1237326496,1237327184...1237327241,1237321820...1237321838,1237321796...1237321819,1237321839...1237321875,1237322206...1237322265,1237326964,1237322266,1237326965,1237326966,1237327009,1237322267,1237327010,1237322268,1237326967,1237322269,1237322270,1237326968,1237327011,1237327012,1237326969,1237322271,1237327013,1237322272,1237327014,1237322273,1237326970,1237327015,1237322274,1237327016,1237322275,1237326971,1237327017,1237326972,1237322276...1237322280,1237322282...1237322299,1237322301...1237322310,1237322281,1237322300,1237323052...1237323293,1237327141,1237327142,1237323294...1237323302,1237327143,1237323303,1237323304,1237327144,1237323305,1237323306,1237327145,1237323307,1237327146,1237323308...1237323312,1237323687...1237323875,1237324723...1237324846,1237326989,1237324847...1237324871,1237326990,1237324872...1237324925,1237325760...1237325934,1237319791...1237319808,1237319681...1237319688,1237319894...1237319947,1237320029...1237320062,1237320079...1237320117,1237320138...1237320157,1237320197...1237320217,1237320236...1237320252,1237320273...1237320312,1237319689...1237319790,1237319809...1237319893,1237319948...1237320028,1237320063...1237320078,1237320118...1237320137,1237320158...1237320196,1237320218...1237320235,1237320253...1237320272,1237321898...1237321915,1237322047...1237322067,1237326920...1237326958,1237321876...1237321897,1237322024...1237322046,1237322068...1237322081,1237321946...1237321975,1237322082...1237322097,1237321916...1237321945,1237321976...1237322023,1237322098...1237322205,1237322951...1237323051,1237323442,1237323443,1237323449,1237323444...1237323448,1237323450...1237323602,1237327365,1237323603,1237323604,1237327366,1237327367,1237323605...1237323686,1237323876...1237323996,1237326986,1237323997...1237324005,1237326987,1237324006...1237324011,1237326988,1237324012...1237324115,1237326973,1237324116...1237324124,1237326974,1237324125...1237324153,1237325350...1237325486,1237325935...1237326140,1237326231...1237326375,1237321571...1237321607,1237321740...1237321757,1237321608...1237321642,1237326695...1237326821,1237327034,1237327035,1237321643...1237321653,1237327036,1237327037,1237321654...1237321663,1237327038,1237327039,1237321664,1237327040,1237321665...1237321667,1237327041,1237321668,1237327042,1237321669,1237321705...1237321724,1237321758...1237321773,1237321670...1237321704,1237321774...1237321795,1237321725...1237321739,1237326822...1237326919,1237322634...1237322647,1237326975,1237326976,1237322648...1237322651,1237326977,1237322652...1237322659,1237326978,1237322660...1237322679,1237326979,1237322680...1237322692,1237326980,1237322693...1237322700,1237326981,1237322701...1237322757,1237327032,1237322758...1237322764,1237327033,1237322765...1237322950,1237323313...1237323433,1237326996...1237326998,1237323434,1237326999...1237327001,1237323435,1237327002,1237323436,1237327003,1237323437,1237327004,1237323438,1237327005,1237327006,1237323439,1237327007,1237323440,1237323441,1237327008,1237325487...1237325520,1237327326...1237327348,1237325521...1237325585,1237327349...1237327364,1237327370...1237327380,1237328174,1237327381...1237327383,1237328175,1237327384,1237328176,1237327385...1237327388,1237328177,1237327389...1237327391,1237328178,1237327392...1237327396,1237328179,1237327397...1237327399,1237328180,1237327400...1237327481,1237328205,1237327482,1237328206,1237327483...1237327495,1237328207,1237327496...1237327499,1237328208,1237328209,1237327500...1237327503,1237328210,1237327504...1237327595,1237328195,1237327596,1237328196,1237328197,1237327597...1237327600,1237328198,1237327601...1237327603,1237328199,1237327604,1237327605,1237328200,1237327606...1237327608,1237328201,1237327609...1237327615,1237328202,1237327616...1237327624,1237328203,1237327625...1237327628,1237328204,1237327629...1237327668,1237328185,1237327669...1237327692,1237328186,1237327693...1237327740,1237328238...1237328240,1237327741,1237328241,1237327742,1237328242...1237328244,1237327743...1237327747,1237328245,1237328246,1237327748...1237327750,1237328247,1237327751...1237327753,1237328248,1237327754...1237327756,1237328249,1237327757...1237327777,1237328250,1237327778...1237327927,1237328188,1237327928,1237327929,1237328189,1237327930...1237327934,1237328190,1237327935...1237327948,1237328191,1237327949...1237327965,1237328224,1237327966...1237327968,1237328225,1237327969...1237327971,1237328226,1237327972...1237327976,1237328227,1237327977,1237328148...1237328168,1237328192,1237328169...1237328171,1237328193,1237328172,1237328194,1237328173,1237327978...1237327995,1237328181,1237328182,1237327996...1237328005,1237328183,1237328006...1237328011,1237328184,1237328012...1237328035,1237328187,1237328036...1237328042,1237328211,1237328043,1237328212,1237328044...1237328046,1237328213...1237328215,1237328047...1237328050,1237328216...1237328219,1237328051,1237328220,1237328221,1237328052,1237328222,1237328223,1237328053...1237328056,1237328228...1237328235,1237328057,1237328058,1237328236,1237328237,1237328059...1237328147&rural_urban=0&cell=0,6,7&measures=20100&select=date_name,geography_name,geography_code,rural_urban_name,cell_name,measures_name,obs_value,obs_status_name")
The console does not spit out any error, it simply has a + which would suggest that the code has not been run. I have already followed the advice here to avoid truncation.
Can someone suggest a solution?
Edit: It does run in R, but not in R Studio, so it may be an issue with the parameters in R Studio
There seems to be a bug in RStudio, where it cannot read long lines of code (can someone confirm this?). I found an ugly solution which is to cut it into two objects and then paste them together.
link <- "http://www.nomisweb.co.uk/api/v01/dataset/NM_144_1.data.csv?date=latest&geography=1237321209...1237321232,1237326502...1237326564,1237321121...1237321160,1237326565...1237326631,1237321161...1237321208,1237320728...1237320838,1237321276...1237321319,1237327043...1237327140,1237321233...1237321275,1237322311...1237322476,1237320313...1237320527,1237324154...1237324261,1237326984,1237326985,1237324262...1237324409,1237320528...1237320578,1237320595...1237320616,1237320579...1237320594,1237320617...1237320638,1237321343...1237321368,1237321320...1237321342,1237321369...1237321422,1237325041...1237325213,1237320639...1237320680,1237327368,1237320681,1237320682,1237327369,1237320683...1237320727,1237321002...1237321048,1237326991,1237321049...1237321053,1237326992,1237326993,1237321054...1237321061,1237326994,1237321062,1237326995,1237321063...1237321120,1237321423...1237321461,1237321478...1237321497,1237321462...1237321477,1237322477...1237322481,1237326959,1237322482,1237322483,1237326960,1237322484,1237322485,1237326961,1237322486,1237322487,1237326962,1237322488...1237322490,1237326963,1237322491...1237322633,1237327242...1237327256,1237324410...1237324722,1237324926...1237324989,1237326982,1237324990...1237324995,1237326983,1237324996...1237325001,1237327257...1237327289,1237325002...1237325028,1237327028,1237325029...1237325032,1237327029,1237325033...1237325035,1237327030,1237325036...1237325038,1237327031,1237325039,1237325040,1237325214...1237325296,1237327290...1237327325,1237325297...1237325349,1237321498...1237321537,1237326632...1237326694,1237327147...1237327183,1237321538...1237321570,1237325586...1237325759,1237326141...1237326194,1237327018,1237326195,1237326497,1237327019,1237326196,1237326498,1237326197,1237327020,1237326198,1237326199,1237326499,1237327021,1237326500,1237326200...1237326204,1237327022,1237326205...1237326207,1237327023,1237326208...1237326210,1237326501,1237327024...1237327027,1237326211...1237326230,1237320839...1237321001,1237326376...1237326496,1237327184...1237327241,1237321820...1237321838,1237321796...1237321819,1237321839...1237321875,1237322206...1237322265,1237326964,1237322266,1237326965,1237326966,1237327009,1237322267,1237327010,1237322268,1237326967,1237322269,1237322270,1237326968,1237327011,1237327012,1237326969,1237322271,1237327013,1237322272,1237327014,1237322273,1237326970,1237327015,1237322274,1237327016,1237322275,1237326971,1237327017,1237326972,1237322276...1237322280,1237322282...1237322299,1237322301...1237322310,1237322281,1237322300,1237323052...1237323293,1237327141,1237327142,1237323294...1237323302,1237327143,1237323303,1237323304,1237327144,1237323305,1237323306,1237327145,1237323307,1237327146,1237323308...1237323312,1237323687...1237323875,1237324723...1237324846,1237326989,1237324847...1237324871,1237326990,1237324872...1237324925,1237325760...1237325934,1237319791...1237319808,1237319681...1237319688,1237319894...1237319947,1237320029...1237320062,1237320079...1237320117,1237320138...1237320157,1237320197...1237320217,1237320236...1237320252,1237320273...1237320312,1237319689...1237319790,1237319809...1237319893,1237319948...1237320028,1237320063...1237320078,1237320118...1237320137,1237320158...1237320196,1237320218...1237320235,1237320253...1237320272,1237321898...1237321915,1237322047...1237322067,1237326920...1237326958,1237321876...1237321897,1237322024...1237322046,1237322068...1237322081,1237321946...1237321975,1237322082...1237322097,1237321916...1237321945,1237321976...1237322023,1237322098...1237322205,1237322951...1237323051,1237323442,1237323443,1237323449,1237323444...1237323448,1237323450...1237323602,1237327365,1237323603,1237323604,1237327366,1237327367,1237323605...1237323686,1237323876...1237323996,1237326986,1237323997...1237324005,1237326987,1237324006...1237324011,1237326988,1237324012...1237324115,1237326973,1237324116...1237324124,1237326974,1237324125...1237324153,1237325350...1237325486,1237325935...1237326140,1237326231...1237326375,1237321571...1237321607"
link2 <- ",1237321740...1237321757,1237321608...1237321642,1237326695...1237326821,1237327034,1237327035,1237321643...1237321653,1237327036,1237327037,1237321654...1237321663,1237327038,1237327039,1237321664,1237327040,1237321665...1237321667,1237327041,1237321668,1237327042,1237321669,1237321705...1237321724,1237321758...1237321773,1237321670...1237321704,1237321774...1237321795,1237321725...1237321739,1237326822...1237326919,1237322634...1237322647,1237326975,1237326976,1237322648...1237322651,1237326977,1237322652...1237322659,1237326978,1237322660...1237322679,1237326979,1237322680...1237322692,1237326980,1237322693...1237322700,1237326981,1237322701...1237322757,1237327032,1237322758...1237322764,1237327033,1237322765...1237322950,1237323313...1237323433,1237326996...1237326998,1237323434,1237326999...1237327001,1237323435,1237327002,1237323436,1237327003,1237323437,1237327004,1237323438,1237327005,1237327006,1237323439,1237327007,1237323440,1237323441,1237327008,1237325487...1237325520,1237327326...1237327348,1237325521...1237325585,1237327349...1237327364,1237327370...1237327380,1237328174,1237327381...1237327383,1237328175,1237327384,1237328176,1237327385...1237327388,1237328177,1237327389...1237327391,1237328178,1237327392...1237327396,1237328179,1237327397...1237327399,1237328180,1237327400...1237327481,1237328205,1237327482,1237328206,1237327483...1237327495,1237328207,1237327496...1237327499,1237328208,1237328209,1237327500...1237327503,1237328210,1237327504...1237327595,1237328195,1237327596,1237328196,1237328197,1237327597...1237327600,1237328198,1237327601...1237327603,1237328199,1237327604,1237327605,1237328200,1237327606...1237327608,1237328201,1237327609...1237327615,1237328202,1237327616...1237327624,1237328203,1237327625...1237327628,1237328204,1237327629...1237327668,1237328185,1237327669...1237327692,1237328186,1237327693...1237327740,1237328238...1237328240,1237327741,1237328241,1237327742,1237328242...1237328244,1237327743...1237327747,1237328245,1237328246,1237327748...1237327750,1237328247,1237327751...1237327753,1237328248,1237327754...1237327756,1237328249,1237327757...1237327777,1237328250,1237327778...1237327927,1237328188,1237327928,1237327929,1237328189,1237327930...1237327934,1237328190,1237327935...1237327948,1237328191,1237327949...1237327965,1237328224,1237327966...1237327968,1237328225,1237327969...1237327971,1237328226,1237327972...1237327976,1237328227,1237327977,1237328148...1237328168,1237328192,1237328169...1237328171,1237328193,1237328172,1237328194,1237328173,1237327978...1237327995,1237328181,1237328182,1237327996...1237328005,1237328183,1237328006...1237328011,1237328184,1237328012...1237328035,1237328187,1237328036...1237328042,1237328211,1237328043,1237328212,1237328044...1237328046,1237328213...1237328215,1237328047...1237328050,1237328216...1237328219,1237328051,1237328220,1237328221,1237328052,1237328222,1237328223,1237328053...1237328056,1237328228...1237328235,1237328057,1237328058,1237328236,1237328237,1237328059...1237328147,1946157057...1946157404&rural_urban=0&cell=0,7&measures=20100&select=date_name,geography_name,geography_code,rural_urban_name,cell_name,measures_name,obs_value,obs_status_name"
link3 <- paste(link, link2, "")
pop_uk_2011 <- read.csv(link3)
Related
here are my console output examples
as you see, there are no output values when using r studio console.
Actually, there are many related issues about this, but no clear solutions. Only a temporal or Adhoc solution like: restart R or using r notebook script.
Anyway, this phenomenon happens just 1 day ago, with the same code, same operations.
At the first time, console works and a few minutes later it doesn't work.
It is so annoying me to restart or run r notebook script...
Is anybody have the same issues as me?
(I cannot give reproducible data, because it works well the other's computer)
Click on the gear icon beside knit and make sure that "chunk output in console" is enabled.
I'd need to be able to grab data straight from into R without going through using its GUI. I've found that the RSAP package seems to be exactly what I'm looking for.
I followed the steps recommended by Piers and Alvaro Tejada Galindo (made it work on windows environment) and here is where I'm stuck:
managed to compile the RSAP package
managed to install it
everything is looking in good shape when I run library(RSAP)
whatever i try in the RSAPConnect command, my R session crashes without any log or tools to be able to debug.
Of course I've tried a few combinations of arguments in this command, but in every single case it still crashed without me knowing why. It does not matter whether i enter a valid ashost or just aaa for instance, still crashes...
Here is the code I was thinking would work (of course I added stars in there):
conn <- RSAPConnect(ashost = "*****.****.com", sysnr = "00", client = "410",
user = "*****", passwd = "*********", TRACE = "3")
Has anyone experienced something similar ? I don't even know in which direction to look to try and make this work. In fact I'd have expected some error message like "server could not be reach" for instance should the ashost not be right, but none of that happens.
I'd appreciate any assistance on this.
Thanks ahead for your support.
Kind regards
After some talking with Piers Harding, it appears that the segfault happens because of some code changes between previous version and version 3.x, which I use.
M. Alvaro Tejada Galindo also tried to use RSAP on a windows machine like me, but if you read his post, you'll see that he was using R 2.15.0 at the time.
Unfortunately I do not have the skills to locate these changes and make the required adjustments within the RSAP code.
Piers did confirm though that RSAP is still working great using R latest build for linux.
Lastly, for those like me who struggled to find the NW RFC library, you can find it on GitHub.
If this can help anyone...
Well I thought I'd add this as another answer.
It is possible to code some vba embedded in an excel file to go fetch stuff into SAP. The interesting part is that I just ran into some code to run a specific vba macro from a specific excel file, all from R :
# Open a specific workbook in Excel:
xlApp <- COMCreate("Excel.Application")
xlWbk <- xlApp$Workbooks()$Open("C:\\Excel_file.xlsm")
# Run the macro called "MyMacro"
vxlApp$Run("MyMacro")
# Close the workbook (and save it) and quit the app:
xlWbk$Close(TRUE)
vxlApp$Quit()
# Release resources:
rm(xlWbk, xlApp)
So in the end, if your macro is set up to grab and store the SAP data, all you have to do next is just read this file using XLConnect or any other package as you'd normally do, and you're all set !
I am using plyr to rename the columns of a large data set to a shorter aliases. The from names are very long with occasional unusual symbols (i.e. Â) This code works in in R Studio when I manually (i.e. Ctrl+R) execute the code. No errors.
However, when it is run using source in another script and/or in the standard Rgui (even using Ctrl+R), it recognizes some of the names in the from statement, but not others, which are identified in the error:
The following from values were not present in x
32/64 bit doesn't seem to make a difference. Can't identify character or value that is producing the error. Any solutions?
Should this be posted as an issue on the plyr Github?
I have prepared a dummy replica of the data set here.
The program that works in R Studio, but not in standard Rgui is here.
The code for the "source" call that produces errors is
source("dftest.R")
All software and packages updated on 3/18/2016.
See similar but unrelated question here.
Looks like copying the code from R Studio text editor and pasting into native client text editor, and then saving, solved both the source problem and the native client problem.
The problem is that when I run the code, there's no return in the console; I mean it does run the code, but does not return any output.
For example, if I write
v <- c(1, 2, 3, 4, 5)
v
I would expect in return
[1] 1 2 3 4 5
But it's not working.
I have version RStudio Version 0.98.1079 and R Version 3.1.1
Possibility 1 (until the + sign was mentioned): I was wondering if you had been doing a tutorial where they were demonstrating the sink function and you hadn't gotten to the point where it was reversed.
> sink('out.txt') # diverts all output to a disk file
> v <- c(1,2)
> v # output went to file
> sink() # sets the output back to the console
> v
[1] 1 2
Another way would be to call closeAllConnections:
> sink('out.txt')
> v
> v
> closeAllConnections()
> v
[1] 1 2
Possibility 2: To address the lack of response with a "+" showing at the Rstudio console ... that is a sign that the R parser "thinks" the entered text has not completed a full R command. It may indicate that you haven't typed a closing bracket or parenthesis. If typing one or two of those is unsuccessful and you keep getting mor +'s then you may be successful with typing the [esc]-key. If it is showing up immediately after a restart then you should check your code for correctness and make sure that the .Rdata file is deleted from your working directory. If you don't know what that means then you may need to search for the methods appropriate to your operating system. You could also have an error in the code of one of your .rprofile files.
In any case these two possibilities have nothing to do with Rstudio per se and everything to to with the typical behavior of an R console session in pretty much any IDE.
Do the lines still start with a "+"? It is also possible you forgot to close the brackets of a function. Try "}".
I had the same issue and none of the tips mentioned here were working.
Session > Restart R did the trick for me, possibly suggesting that I had a similar problem as andrewH but was not patient enough to wait for R to behave again.
This is a very old question, but I just had the same problem with a different cause, so I thought I would describe it here case it should be useful to someone else. I was getting the regular command prompt, with nothing more, no matter what I typed at the command line. I tried multiple returns, escape, sink, traceback, closeAllConnections (which did give me a response, "error: unexpected ) in (), but then went back to the command prompt and ignored a second traceback).
Anyway after half an hour or so of pulling my hair out, up pops "View(Mid2)". Mid2 is a tibble with 8.5 million observations of 88 numeric variables. I must have tapped it in the environment pane accidentally. I suppose it just took that long for the viewer to render it. I assume that all the other things I did hit at once, because RStudio crashed immediately thereafter.
The interesting thing about this particular version of the problem is what didn't happen. The red stop sign in the upper right of the console window, that lights when R is busy, didn't light. That is unfortunate -- but understandable, if the RStudio viewer is a different process. But also, when my computer is working hard on a really big computation or IO task, the fan usually starts, but it didn't. Don't know why. . I took its absence, incorrectly, to mean no such computation was underway.
If the lines in console are starting with "+".
Save your work and close the 'RStudio' or other tool which you are using and Start it again, it worked for me.
If you are using R Studio Cloud, refresh or re-opening won't work.
Only clue from the above posts or answers is your console will always start with '+'
In my case I tried all possibilities of closing braces.
And ")" worked for me when I typed that into the console and press enter.
sink() function did nothing in R Studio Cloud
A simple mistake might have also caused this problem:
A rather lengthy command left abandoned in the console is blocking the appearance of the result line.
Thus, the console only shows that line, but the result from any code run from the source, will not appear.
To solve this, just switch to the console, remove any remaining command and try again.
Experiencing something like that explained here as an unresponsive console to the R-Code running was just devastating for me when I experienced it. But luckly although I tried every trick explained in this page, it did not work for me. At last I clicked on the "To console" option available just below the Environment, History, Connections, Tutorial Tab on the R Studio. It solved the puzzle for me just now.
The best solution I've found is closeAllConnections and/or sink which almost always work
But as a stop gap measure, View()'ing always works. It's sort of a pain but whatever you wanted to print out, surround by View and you can see it
In Linux bash, I can use something like
history | egrep "df"
and it will list all instances of my history that have the pattern "df" in them.
I am trying to find a similar syntax for R software. I found something similar here (history search backward in R), however, the suggestion in the first answer did not seem to work.
Based off that answer, I tried the following in R:
> history(pattern="df\\(")
> history(pattern="df(")
> history(pattern="df")
But got no history commands with pattern "df" outputted to console (or outputted to anywhere else I could see).
Thank you...
This alternate version works for me:
grep("df", readLines(".Rhistory"), value=T)
The history version also did not work for me. The docs mention that the history functions are somewhat implementation dependent. For example, in Rstudio, history() returns nothing.
Also, you may need to run savehistory() before the grep because your console may buffer the history for a while before actually writing it to file.