0

This question has been asked a number of times, but my issue appears to be different.

I'm getting the error message "attempt to use non-zero variable name" whenever I click "Run Document" in R studio for a Shiny .Rmd file. This happens even when I attempt to run the default Shiny template in R studio. It also occurs if I comment out all code blocks except the shiny header (see image).

Knitting a .rmd without Shiny works fine. The same code was working fine last week. I've reinstalled the Shiny and Rmarkdown packages, to no effect.

Any help would be greatly appreciated. enter image description here

Zhaochen He
  • 610
  • 4
  • 12
  • > sessionInfo(NULL) R version 4.0.0 (2020-04-24) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18362) Matrix products: default locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_4.0.0 tools_4.0.0 packrat_0.5.0 – Zhaochen He Jul 15 '20 at 20:58

2 Answers2

0

I ran into this issue and created a brand new shiny shiny file, which worked. Not sure what the issue was.

  • I tried that; didn't work. However, I just discovered that if I move the file to a new directory, it works. However, I can't for the life of me get it to work in the old directory. I deleted the old .Rproj file and Rproj.user directory, but still no go. – Zhaochen He Jul 15 '20 at 21:24
0

I believe this has to do with the line error in source(global_r, local =FALSE), which is why moving it to another directory worked. Looks like some option is in this directory that is not set in the other directory. I assume you tried restarting your R session? The source is trying to read in a file or connection I believe that is not available.

this answer says to run this code to redefine your source, tbh not sure if this will help you, but thought it'd be worth a try. looks like alot, but just requires a copy/paste.

source = function (file, local = FALSE, print.eval = echo,
                   verbose = getOption("verbose"),
                   prompt.echo = getOption("prompt"), max.deparse.length = 150,
                   chdir = FALSE, encoding = getOption("encoding"),
                   continue.echo = getOption("continue"), skip.echo = 0,
                   keep.source = getOption("keep.source")) {
base::source(file, local, echo = FALSE, print.eval, verbose, prompt.echo,
               max.deparse.length, chdir, encoding, continue.echo, skip.echo,
               keep.source)
}
Daniel_j_iii
  • 3,041
  • 2
  • 11
  • 27