Since I started using breakpoints, I experience that setting breakpoints in an R file sometimes works and somestimes doesn't, in a seemingly unsystematic way. My most recent observation was that switching the filepath of an R file can influence the possibility to set breakpoints. More specifically, I was already debugging some files in filepath A where I was able to set breakpoints. In another file, which was in filepath B, I was not able to set breakpoints (I get the warning message that the package should be build and reloaded although I am not building a package. Nothing happens if I source the file). However, when I put that file from filepath B to filepath A, I could magically set breakpoints all of a sudden without any problems. I am really struggling to find systematic behavior in when setting breakpoints works and when not. Any help if much appreciated.
Related
I have installed the R extension for VS Code. I am creating a book with bookdown, which is an extension of RMarkdown.
There is a Knit option (Ctrl + Shift + K). By default, it runs
rmarkdown::render("path/to/current/file", encoding = 'UTF-8').
[#CarlosLuisRivera pointed out that I had render_site here, rather than render before.]
In order to make bookdown work, I just need it to run
rmarkdown::render_site() or bookdown::render_book().
The encoding is the default, so that isn't needed. bookdown. Importantly, though, there shouldn't be a filename. I can't for the life of me work out how to adjust the settings to stop it from putting the filename in.
There is a setting r.rmarkdown.knit.command. This doesn't seem to do anything when the active file is called index.Rmd. Otherwise, whatever I write there gets appended with (path/to/current/file, encoding = 'UTF-8').
Even if I could get this fixed, I wanted to use VS Code for its preview—the RStudio in-built one is poor. When I try to preview, it can't compile anything, throwing an error:
The path C:/Users/USERNAME/Documents/Maths/Teaching/ST333/LectureNotes/libs/jquery-3.6.0 does not appear to be a descendant of C:/Users/USERNAME/vscode-R/tmp/.
The log also includes
output file: C:/Users/USERNAME/.vscode-R/tmp/index.knit.md
so I guess it's trying to make it in the wrong place.
Any help would be appreciated!
I have been using RDCOMClient for a while now to interact with vendor software. For the most part it has worked fine. Recently, however, I have the need to loop through many operations (several hundred). I am running into problems with the RDCOM.err file growing to a very large size (easily GBs). This file is put in C: with no apparent option to change that. Is there some way that I can suppress this output or specify another location for the file to go? I don't need any of the output in the file so suppressing it would be best.
EDIT: I tried to add to my script a file.remove but R has the file locked. The only way I can get the lock released is to restart R.
Thanks.
Setting the permissions to read only was going to be my suggested hack.
A slightly more elegant approach is to edit one line of the C code in the package in src/RUtils.h from
\#define errorLog(a,...) fprintf(getErrorFILE(), a, ##__VA_ARGS__); fflush(getErrorFILE());
to
\#define errorLog(a, ...) {}
However, I've pushed some simple updates to the package on github that add a writeErrors() function that one can use to toggle whether errors are written or not. So this allows this to be turned on and off dynamically.
So
library(RDCOMClient)
writeErrors(FALSE)
will turn off the error logging to the file.
I found a work around for this. I created the files C:\RDCOM.err and C:\RDCOM_server.err and marked them both as read-only. I am not sure if there is a better way to accomplish this, but for now I am running without logging.
Despite numerous searches, I can't seem to find a clear explanation as to what "Source on Save" means in RStudio.
I have tried ?source and the explanation there isn't clear, either.
As far as I can tell, it seems to run the script when I hit Save, but I don't understand the relevance/significance of it.
In simple terms, what exactly does Source on Save do and why would/should I use it?
This is kind of a shortcut to save and execute your code. You type something, save the script and it will be automatically sourced.
Very useful for short scripts but very annoying for time consuming longer scripts.
So sourcing is basically running each line of your file.
EDIT:
SO thinking of a scenario where this might be useful...
You developing a function which you will later put into a package... So you write this function already in an extra file but execute the function for testing in the command line...
Normally, you have to execute the whole function again, when you changed something. While using "Source on Save" the function will be executed and you can use Ctrl + 2 to jump into command line and test the function directly.
Since I am working with R, my datasets are much bigger. But I am remembering starting coding in python and vi, I updated my setting in a way to execute the code on save, since these little scripts where done in less then 10 seconds...
So maybe it is just not standard to work with small datasets... But I can still recommend it, for development, to use only 10% of a normal dataset. It will speed up the graphics creation and a lot of other things as well. Test it with the complete dataset every now and then.
The .xnb files that the Monogame pipeline creates are way too big. I have a folder of images that makes up 8 mb. When passed through the pipeline and published for installing creates 2 gb of .xnb files... that's a little bit of a problem.
Example: An image (png) is 32,6 kB, gets turned into a .xnb.deploy worth 10,1 MB.
I'm not sure what to do about this. There must be something obvious I'm missing because I feel it shouldn't be this way at all, am I missing some compression setting in the pipeline and if so where do I find it? Thanks
Edit: Tried in both Debug and release, same result.
Edit 2: I've tried many of the solutions that I've found on the internet without any luck. I've tried to set the content pipeline settings to Compress - True but that did nothing.
I've tried to go through every image(around 500) and turning the TextureFormat to DxtCompressed, I had an error that I needed to have the ResizeToPower set as True, so I did that and tried again. This gave me the error "processor textureprocessor had unexpected failure" and I could not find a solution to that... so I gave up on that idea.
I also tried following this link http://rbwhitaker.wikidot.com/forum/t-904011/xnb-compression but could not find the "compress content pipeline output files" option anywhere.
I am attempting to automate the insertion of JPEG images into Powerpoint. I have a macro done for that already, except using R would be infinitely better for my purposes.
The package R2PPT should do this, I understand. However, I cannot use it. For example, when I try to use PPT.Open, I understand I can do it two different ways by calling method = "rcom" or method = "RDCOMClient". Using the latter, R will always crash, sending an error report to windows. Using the former, it tells me I need to install statconnDCOM , before giving the error:
Error in PPT.Open(x) : attempt to apply non-function.
I cannot install statconnDCOM freely, as I wouldn't call this work non-commercial. So if there isn't a way to get around this issue, are there at least some free alternatives to R2PPT so that I can save several hours of manual work with a simple R code? If there is a way for me to use R2PPT, that would be ideal.
Thanks!
Edit:
I'm using R version 2.15 and downloaded the most recent version of R2PPT. Powerpoint is 2007.
Do you have administrative privileges on this machine?
There is an issue with package RDCOMClient. It needs permissions to write file rdcom.err in the root of drive C:. If you don't have privileges to write to c:, there is a rather cumbersome workaround:
Close R
Create "c:\temp" folder if it doesn't exist.
Locate on your hard drive file rdcomclient.dll. It usually placed in \R\library\RDCOMClient\libs\i386\ and in \R\library\RDCOMClient\libs\x64\ (you need to patch file which corresponds your Windows version - 32 bit or 64 bit). It's recommended to make backup copy of this files before patching.
Open rdcomclient.dll in text editor (Notepad++, for example -http://notepad-plus-plus.org/)
Find in file string c:\rdcom.err - it occurs only once.
Go into overwrite mode (usually by pressing "Ins" key). It is very important that new path will have the same number of characters as original one. Type C:\temp\e.rr instead of c:\rdcom.err
Save the file.
Now all should work fine.
Arguably not an answer, but have you looked at using Sweave/knitr to render your presentations in LaTeX using something like Beamer? (As discussed on slide 17 here.)
Wouldn't help any with getting JPGs into a PowerPoint, but would certainly make putting R-output (numerical or graphical) into a presentation much easier!
Edit: if you want to use knitr (which I recommend), here's another reference.