I have set ~/.slackr based on the given manual and run the following code.
library(slackr)
slackr_setup()
slackr("iris info", head(iris), str(iris))
Then I got the following error message.
Error: x and y don't share the same src. Set copy = TRUE to copy y into x's source (this may be time consuming).`
Please let me know if you have any idea on this. It would be great help. Thanks!
I've solved it by myself.
The reason was that I wasn't fill out 'api_token' field in ~/.slackr.
'api_token' field is a mandatory.
So you should get the token from slack.
I've tried with 'test token'. You can get your own from the following url.
https://api.slack.com/docs/oauth-test-tokens
Related
I'm having an issue where if I execute several lines of code at once and one of them has an error, the lines below don't get executed.
For example if I have:
table(data$AGE)
table(dataREGION)
table(date$SEXE)
I get the table for the first line, and then
Error in table(dataREGION) : object 'dataREGION' not found
>
And the last line does not execute.
Does anyone know why it does that and how to fix it?
(I work with R 4.2.2 and RStudio 2022.12.0+353 "Elsbeth Geranium" Release)
Thanks!
Have a nice day,
Cassandra
Fixed: In Global Options > Console, under "Execution" uncheck the "Discard pending console input on error"
It seems like you want to use try().
try(table(data$AGE), silent = F, outFile = T)
try(table(dataREGION)) # also works without any params
try(table(date$SEXE))
You can also use tryCatch() if you want more control but it doesn't seem necessary for your purpose.
__
As for why your dataREGION doesn't exectue:
Hazarding a guess it might be because you forgot the $ between data and REGION
The function blogdown::new_post() recently stopped working for me with the parameter date="".
here's the line of code:
blogdown:::new_post("home", kind = "default-frontpage", open=F, date="", subdir="", ext = ".Rmd")
it gives this error:
Error in if (tryCatch(date > Sys.Date(), error = function(e) FALSE)) warning("The date of the post is in the future: ", :
missing value where TRUE/FALSE needed
Someone else who works in the lab has tried to reproduce this error on their computer, but wasn't able to. All of my R packages are up to date, according to RStudio.
When I call Sys.Date(), it returns today's date as: "2020-11-29"
I can specify a date in new_post(), but it would require re-writing a substantial amount of our code, and it seems like this changes the automatically generated title of the post.
Could anyone suggest a next step?
Thanks a bunch!
Caleb
I just fixed this issue on Github, and you may try
remotes::install_github('rstudio/blogdown')
Thanks for the report!
I am trying to plot a small rectangle of a map:
library(OpenStreetMap)
upper_left <- c(47.413, 8.551);
lower_right <- c(47.417, 8.556);
map_osm <- openmap(upper_left, lower_right, type = 'osm' );
plot(map_osm );
When I run that, the openmap function gives me the error Error in osmtile(x%%nX, y, zoom, type) : could not obtain tile: 540 298 10.
The documentation of OpenStreetMap seems to indicate that I need to add an API key. However, I am not sure how exactly I would do that (because I use type='osm', not type = url) and I am also unclear where I'd get such an API key from.
The java.lang.NullPointerException and the following R-error (Error in osmtile(...)) seem to come from an older version of OpenStreetMap.
By updating OpenStreetMap to the latest version (0.3.4 currently), the error disappears and the example code of OP should work as it is, without needing an API key.
The accepted answer is not adequate as the error can occur even with the most recent package version.
Sometimes if a particular area is not available in a specific style, you get an error similar to the one mentioned above independent of the package version. The solution would be to try the function with a different style. This is mentioned in the following blog post
As an example, the following modification may solve the issue:
library(OpenStreetMap)
upper_left <- c(47.413, 8.551);
lower_right <- c(47.417, 8.556);
map_osm <- openmap(upper_left, lower_right, type = 'opencyclemap');
plot(map_osm)
I am trying to plot some points on a map in R following instructions found here
http://rpsychologist.com/working-with-shapefiles-projections-and-world-maps-in-ggplot
When I get to the line where I use the rgdal:project function though I get an error message
places_robin_df <- project(cbind(places_df$LONGITUDE, places_df$LATITUDE), proj="+init=ESRI:54030")
Error in project(cbind(places_df$LONGITUDE, places_df$LATITUDE), proj = "+init=ESRI:54030") :
no system list, errno: 2
I find that changing the ESRI:54030 to random gibberish gives me the same error message which suggests to me that it can't find the ESRI:54030 information. What do I need to do to get things working?
Note I am running R in Ubuntu 14.04.
I ended up finding the following link that suggested that ESRI is case sensitive in Linux and should be lower-case.
http://lists.osgeo.org/pipermail/mapserver-users/2011-October/070334.html
changing the code to
places_robin_df <- project(cbind(places_df$LONGITUDE, places_df$LATITUDE), proj="+init=esri:54030")
fixes things
When I want to create the map using the gvisGeoMap() from googleVis, I get error:
## Using the google visualization API with R
library(googleVis)
input<- read.csv("data.csv")
select<- input[which(input$Subgroup=="Total 5-14"),]
select<- input[which(input$Subgroup=="Total 5-14 yr"),]
Map<- data.frame(select$Country.or.Area, select$Value)
names(Map)<- c("Country", "Percentage")
Geo=gvisGeoMap(Map, locationvar="Country", numvar="Percentage",
options=list(height=350, dataMode='regions'))
plot(Geo)
#starting httpd help server ... done
#Error in ifelse(interactive(), getOption("browser"), "false") :
#replacement has length zero
The above is the error in the "RGui". The error message in "RStudio" is differet:
#object of type 'closure' is not subsettable
and the browser does not fire at all. The HTTP server works fine since I can simply call help pages.( for example ?googleVis will fire up the browser and give the help page). The "Geo" object in the code above is fine and contains the html code only that the plot() does not do what it is supposed to do (I can manually run the html file in the temp folder and see the results). The example above is available here.
I would appreciate your clues.
Thank you
This is the result of correspondance with the the Authors of the packages. It seems that there was a bug that prevented the plot to work properly. The released a new version. You can find the link below.
TQ
.....
Yesterday evening I realised that with version 0.3.0 of googleVis I unfortunately introduced a bug in RStudio and R on Windows.
The bug has been fixed already and a new version (0.3.1) is available from our project site (here is the link), but not on CRAN yet.
I have put a note on my blog (here is the link) to inform others as well.
I hope this helps.
Best regards
Markus