Unable to run markdown - error for code with ggplot - r

I was trying out a set of codes from the book R for Data Science, which seem to be running perfectly fine in the console. However , when I try to compile it as a markdown, I'm unable to proceed & am getting the following error :
Error in -title: invalid argument to unary operator Calls: ... handle -> withCallingHandlers -> withVisible -> eval -> eval Execution halted

Related

Error in enforcePackage(name, curVersion) : The shiny package was not found in the library

I'm trying to deploy a shiny app to shinyapps server. the app works just fine locally and when deploying using rsconnect::deployApp() I can see the message Application successfully deployed to in the console but actually on browser is not working and showing the following:
Error in enforcePackage(name, curVersion) : The shiny package was not found in the library. Calls: local ... eval -> eval -> eval -> <Anonymous> -> enforcePackage. Execution halted
Shiny package is loaded of course.
Also when trying to run rsconnect::appDependencies() the following error pop-up :
Error in [.data.frame(deps, , "Package") : undefined columns selected
Thank you all in advance for your help

How to stop R shiny session or R script without stack trace?

I have complex code and I have two withCallingHandlers that handle errors. and I want to call stop() to stop R or shiny session but I have a long stacktrace. I've tried:
invokeRestart("abort")
but then I've got error:
Error in execCallbacks(timeoutSecs, all, loop$id) :
Calls: <Anonymous> ... ..stacktracefloor.. -> serviceApp -> service -> run_now -> execCallbacks
Execution halted
is it possible to stop R without stack trace? Note that I can't call quit(), since this will stop all shiny sessions.

How do I save imported data from R studio so that I can knit?

My program runs exactly how I want it to run. All I need to do now is knit the program. How do I save my data that I have imported through R studio so that I can call it in my program and knit?
I have tried save(), save.image(), knitting directly using code that supposedly should have knitted using what was in the environment, and importing data directly using code(this left me with even more problems so I gave up).
This is my latest effort:
dir()
[1] "airline.Rdata" "airline.Rds" "cheesedata.Rdata"
[4] "cheesedata.Rds" "desktop.ini" "myEnvironment.RData"
load('cheesedata.Rds')
load('airline.Rds')
The rest of the code should be fine
Quitting from lines 3-47 (HW3.spin.Rmd)
Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
Calls: ... withCallingHandlers -> withVisible -> eval -> eval -> load -> readChar
Execution halted

R error SQLSatellite cannot read data chunk

I have an SSIS 2015 package that calls a Stored Proc in SQL Server 2016.
When I run the SSIS package I get these two messages:
Error: A 'R' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.
Error: STDERR message(s) from external script:
Error in eval(expr, envir, enclos) : bad allocation
Calls: source -> withVisible -> eval -> eval -> .Call
Execution halted
So I ran the stored proc in SSMS but get these messages.
A 'R' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.
STDERR message(s) from external script:
SqlSatellite cannot read data chunk. Error code:0x80004004.
Error in eval(expr, envir, enclos) : SqlSatellite cannot read data chunk. Error code:0x80004004.
Calls: source -> withVisible -> eval -> eval -> .Call
I have run the R scripts input query in SSMS which returns data, I do not believe I am missing any columns in the R script which I believe was working previously.
But being new to R I have no idea how to diagnose what may be causing the problem.
I did some more research on the errors and found some information at http://www.nielsberglund.com/2017/11/11/microsoft-sql-server-r-services-internals-xiii/.
The suspicion was that it may not be a code issue, more a data issue. A considerable amount of testing indicated it was the amount of data I was analyzing with the R script, I was able to restrict the amount of data using some date parameters and finished the data loads.
Hope this helps others.
I had the same error using Python in SQL Server 2017. I figured out it was because my WITH RESULT SETS statement did not fit my OutputDataSet.

knitr returns error on read.csv, works fine on console

I am trying to knit a document but I am getting an error on the read.csv function which works fine if I run it from the RMarkdown or from the console.
I have searched but could only find solutions related to reading a csv from a URL.
R read.csv from URL error in knitr
```{r}
# This analysis uses the National Names dataset
national_names_raw <- read.csv("NationalNames.csv")
```
This is the error I get...
Quitting from lines 33-35 (Popularity_of_Kier.Rmd)
Error in file(file, "rt") : cannot open the connection
Calls: <Anonymous> ... withVisible -> eval -> eval -> read.csv -> read.table -> file
Execution halted
Any help is appreciated.

Resources