R Debugger activated but not working in VSCode - r

I created a new folder, inside which is a very simple .R file. I load the folder into VSCode and run debugger. The pane showing icons of step over, step into, and step out is activated. However, when clicking step over icon, errors are prompted: "Error in body[[i]][1] : object of type 'symbol' is not subsettable". I cannot find solutions in Google. A screenshot is atttached for referene. What is going wrong here? Thx.

Related

Rshiny publish error: inferAppPrimaryDoc Execution halted

I created an Rshiny APP on my Mac and tried to upload to shinyapps.io
However, when I press 'Publish' button at the top right corner, it shows an error.
Preparing to deploy application...DONE
Uploading bundle for application: 609021...Error in inferAppPrimaryDoc(appPrimaryDoc = appPrimaryDoc, appFiles = appFiles, :
Application mode static requires at least one document.
Calls: <Anonymous> ... withStatus -> force -> bundleApp -> inferAppPrimaryDoc
Execution halted
This problem has been solved. See the first answer.
But now, I have another problem.
I can publish it, but the app cannot show the graphs.
I check the log and it says,
Warning: Error in : Aesthetics must be either length 1 or the same as the data (1): x, y, label, vjust, fill
Also, there is another warning,
Warning in Ops.factor(Year, start) : ‘>=’ not meaningful for factors.
It is pretty strange because when I run the app on my own laptop, it works super well. Please help...
Thanks,
Weichen
You don't have to split your code to ui.R and server.R.
Here is how I solved it on Rstudio:
I created a new Shiny app.R file.
This creates a new folder inside the working directory. I copied all data files I use inside my app into that folder.
I copied and pasted my whole code into the new app.R file on Rstudio.
I clicked Publish and I chose all the data files I use together with the app.R for upload.
It worked. I am not sure why it wasn't working before even though I was still choosing the right files together; I guess because they weren't in the right folder for the Shiny app.
edit: don't forget to Save the app.R file before publishing
Solved.
At first, I simply execute the shiny.R (the whole code) Wrong!
Try this. Create two r files under the same directory.
ui.R
server.R
and then executive shiny.R
You would see an amazing thing happen.
Solved the second problem.
Change the type of 'Year' to numeric by as.numeric
However, I still cannot understand because I can run app on my own laptop.
BTW, the logs in shinyapps.io help me target the problem.

gzfile error when publishing Shiny app

I'm trying to publish an R Shiny app. It works when run locally, but once published to shinyapps.io produces the following error.
Warning in gzfile(file, "wb") :
cannot open compressed file '/key.rda', probable reason 'Permission denied'
Error in value[[3L]](cond) : cannot open the connection
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
You can also see the actual page with the error here: https://povertylab.shinyapps.io/ACS-Map-Dashboard/
Though I have tried to reproduce this error it doesn't appear when I publish other apps, and my searches haven't turned up anything. Other things I've tried: publishing from other computers, publishing only global.R, server.R, and ui.R files, and copying files to a new project and publishing from there.
You can find all code for the app here: https://github.com/Poverty-Lab/ACS-Map-Dashboard
I would appreciate any input, even if it's just guidance on what gzfile is and what the error message could mean. Thank you!
Where is the key.rda file supposed to be? I've looked through your repo and I don't see it, which is probably causing the "cannot open the connection" error.
As a side note, you should probably ignore the .Renviron file; right now anyone can use see and use your key. Make sure you remove it from the history as well.
Thanks all. Turns out this was a problem with the way we were handing the api key for the acs package. We were using api.key.install to install the api key inside the app, and one of api.key.install's default arguments is file = "key.rda", and that file apparently could not be found. I'm still not sure why this problem only came up when we published the app, but we got around it by supplying the actual api key to the acs.fetch function in server.R.

Could not Publish (TypeError): null is not and object (evaluating b.g.) - Rmarkdown

I'm trying to publish an RMarkdown document to my RPubs account, but I get the next error when clicking on "Publish":
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
cannot open file 'C:/Users/.../File.Rmd': No such file or directory
It also pops up a window saying the next two warnings:
First pop up: "Could not Publish - Error ocurred while executing method"
Second pop up: "Could not Publish - (TypeError): null is not an object evaluating 'b.g.')
My R version is 3.4.2, RStudio version is 1.1.383, knitr version is 1.17.
I have also checked is the working directory contains the files I'm using at the script, and all seems properly set.
This error only happens when I click on Publish. If I try to knit to HTML or to PDF it works. I have tried to restart and reinstall also both R and RStudio but the error persists.
Has anyone had the same error and knows how to solve it?
Thank you very much!
Is the file saved? Are you in the correct directory?
Please check getwd().
I managed to solve it. The problem was that the path of the working directory contained an accent. I changed the path to another folder without accents and it worked.

New Rmd document: knitr: Error in library("rstudio") : there is no package called 'rstudio'

firing up "RStudio" V1.0.136 on my Mac, just as usual, creating a new file, a Rmd, and trying--as I've done countless time before--knitr it just as is, but this time a strange error message occurs:
Error in library("rstudio") : there is no package called 'rstudio'
Never ever have seen this before, and I haven't got the faintest clue as why this has popped into existence, and how to remedy it.
Funny enough, after wiping my whole RStudio and R installation, with a subsequent re-installation thereof, all is working fine again.

Execute IPyWidgets in Google Cloud Datalab

For a project we try to expand the Google Cloud Datalab with IPyWidgets. When we try out IPyWidgets in jupyter notebook (not in google-cloud-datalab) locally, everything run as expected (i.e. we tried to show a Text field, which worked). When we try to execute the same code in Google Cloud Datalab, it fails. In the web console we see following error:
Error 1:
Error message: "Class ipython.widget not found in registry "
Error stack: "load_class/<#http://localhost:8081/static/notebook/js/main.min.js:12751:28load_class#http://localhost:8081/static/notebook/js/main.min.js:12736:1CommManager.prototype.comm_open#http://localhost:8081/static/notebook/js/main.min.js:21802:31.proxy/i#http://localhost:8081/static/notebook/js/main.min.js:89:5486Kernel.prototype._handle_iopub_message#http://localhost:8081/static/notebook/js/main.min.js:23101:20Kernel.prototype._finish_ws_message#http://localhost:8081/static/notebook/js/main.min.js:22936:1Kernel.prototype._handle_ws_message/this._msg_queue<#http://localhost:8081/static/notebook/js/main.min.js:22926:39"
Error 2:
Message: Could not open comm
Error message: "Couldn't process kernel message"
Error stack: "WrappedError#http://localhost:8081/static/notebook/js/main.min.js:12706:19reject/<#http://localhost:8081/static/notebook/js/main.min.js:12785:33"
The strange thing is, is when google-cloud-datalab is running and we go to the jupyter notebook (on port 9000), and we execute the code over there it works.
Do we need to make changes to nb.html, and/or static.ts to make this work?
Question: Is there a way to execute IPyWidgets on Google Cloud Datalab?
Greetings, Brecht
Edit: I can now load the js and the css files from IPyWidgets in google-cloud-datalab (you need to change static.ts, for those who wonder). The only remaining issue (hopefully), is that we get following error:
"Error: Could not determine where the display message was from. Widget will not be displayed".
This is because
var cell = this.get_msg_cell(msg.parent_header.msg_id);
is null (line 556, of ipywidgets/widgets/js/manager.js). I assume that changing static.ts is not enough?
The:
"Error: Could not determine where the display message was from. Widget will not be displayed".
issue can be fixed by changing this line in datalab.js:
originalExecute.apply(this, [ code, callbacks, options ]);
to:
return originalExecute.apply(this, [ code, callbacks, options ]);

Resources