You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Brilliant package which I am trying to use in Window 7 environment.
Code sample round the issue based on your package documentation, it's about the rp$sys function
library("repo")
openPDF <- function(f) {
os <- .Platform$OS.type
if (os=="windows")
shell.exec(normalizePath(f))
else {
pdf <- getOption("pdfviewer", default='')
if (nchar(pdf)==0)
stop("The 'pdfviewer' option is not set. Use options(pdfviewer=...)")
system2(pdf, args=c(f))
}
}
path<-'C:/Users/nolascofx/Documents/repo'
rp_path <- file.path(path, "example_repo")
rp <- repo_open(rp_path, TRUE)
## Not run:
## Creating a PDF file with a figure.
pdf("afigure.pdf")
## Drawing a random plot in the figure
plot(runif(100), runif(100))
dev.off()
## Attaching the PDF file to the repo
rp$attach("afigure.pdf", "A plot of random numbers", "repo_sys")
## don't need the PDF file anymore
file.remove("afigure.pdf")
## Opening the stored PDF with Evince document viewer
rp$sys("afigure.pdf", "evince")
R version is:
Windows 7
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 4.3
year 2017
month 11
day 30
svn rev 73796
language R
version.string R version 3.4.3 (2017-11-30)
nickname Kite-Eating Tree
Repo package is:
repo 2.1.2
Rstudio is:
1.1.414
PDF Preview in RStudio is
I want to use "Sumatra" pdf which is pre-configured in RStudio and available on path
C:/Program Files/RStudio/bin/sumatra/SumatraPDF.exe
ISSUE
How do I manage to change "evince" Linux-based PDF to "sumatra"?
Opening the stored PDF with Evince document viewer
rp$sys("afigure.pdf", "evince")
Thank you, Fede
The text was updated successfully, but these errors were encountered:
The pdf file in question is located in repo : "C:\Users\nolascofx\Documents\repo\example_repo/kq/9g/6d/kq9g6dj0i0dor65iymejezwq"
Usually I call shell.exec as in above function openPDF to open the default pdf editor based on file extension. Here I guess the function rp$sys takes care of normalizing the path and opening the file with specified pdfviewer. I am not familiar with rp$sys process. Did youy test this in Windows OS?
Hi Fede,
The sys command is a simple shortcut to the system command of R: it just calls it passing your command and the position of the file on the disk. Here "evince" is not a function, but a shell command. If you pass "SumatraPDF.exe", it should be correctly used to open the file (if the command is in the system search path).
If you want a more complex management of the file types, than you could write an executable script (for example a .bat file) implementing your openPDF and then pass it to sys.
Brilliant package which I am trying to use in Window 7 environment.
Code sample round the issue based on your package documentation, it's about the rp$sys function
R version is:
Windows 7
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 4.3
year 2017
month 11
day 30
svn rev 73796
language R
version.string R version 3.4.3 (2017-11-30)
nickname Kite-Eating Tree
Repo package is:
repo 2.1.2
Rstudio is:
1.1.414
PDF Preview in RStudio is
I want to use "Sumatra" pdf which is pre-configured in RStudio and available on path
C:/Program Files/RStudio/bin/sumatra/SumatraPDF.exe
ISSUE
How do I manage to change "evince" Linux-based PDF to "sumatra"?
Opening the stored PDF with Evince document viewer
rp$sys("afigure.pdf", "evince")
Thank you, Fede
The text was updated successfully, but these errors were encountered: