I got error msg when converting tex to pdf using texi2pdf function in Rstudio.
tools::texi2pdf('test.tex')
and the error msg I got:
Error in system(paste(shQuote(texi2dvi), if (quiet) "--quiet" else "", :
(converted from warning) running command '"C:\CTEX\MiKTeX\miktex\bin\texi2dvi.exe" --quiet --pdf "test.tex" --max-iterations=20 -I "C:/Program Files/R/R-3.5.1/share/texmf/tex/latex" -I "C:/Program Files/R/R-3.5.1/share/texmf/bibtex/bst"' had status 1
1: tools::texi2pdf("test.tex")
2: texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet, texi2dvi = texi2dvi, texinputs = texinputs, index = index)
3: system(paste(shQuote(texi2dvi), if (quiet) "--quiet" else "", if (pdf) "--pdf" else "", shQuote(file), extra), intern = TRUE, ignore.stderr = TRUE)
4: .signalSimpleWarning("running command '\"C:\\CTEX\\MiKTeX\\miktex\\bin\\texi2dvi.exe\" --quiet --pdf \"test.tex\" --max-iterations=20 -I \"C:/Program Files/R/R-3.5.1/share/texmf/tex/latex\" -I \"C:/Program Files/R/R
5: withRestarts({
.Internal(.signalCondition(simpleWarning(msg, call), msg, call))
.Internal(.dfltWarn(msg, call))
}, muffleWarning = function() NULL)
6: withOneRestart(expr, restarts[[1]])
7: doWithOneRestart(return(expr), restart)
I am running windows10, R version 3.5.1 , RStudio 1.1.463 and CTeX_2.9.2.164.
Anyone could help me with this problem? Thanks.
Related
I am creating my first R package. One of the functions will be taking in a vcf file and outputing it formatted into the R env for further use. Here's the code below!
enter image description here
After I install the package this is what I get:
> devtools::install()
── R CMD build ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔ checking for file 'C:\Users\raymu\OneDrive\Documents\R\LoF\myfirstpackage/DESCRIPTION' ...
─ preparing 'myfirstpackage':
E checking DESCRIPTION meta-information ...
Malformed maintainer field.
See section 'The DESCRIPTION file' in the 'Writing R Extensions'
manual.
Error in `(function (command = NULL, args = character(), error_on_status = TRUE, …`:
! System command 'Rcmd.exe' failed
---
Exit status: 1
stdout & stderr: <printed>
---
When I try to execute the function on a test vcf file there is no error but doesn't make anything in the environment
I tried devtools::check and got this but am unsure what it means
> devtools::check()
══ Documenting ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
ℹ Updating myfirstpackage documentation
ℹ Loading myfirstpackage
Warning: Skipping NAMESPACE
✖ It already exists and was not generated by roxygen2.
══ Building ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Setting env vars:
• CFLAGS : -Wall -pedantic
• CXXFLAGS : -Wall -pedantic
• CXX11FLAGS: -Wall -pedantic
• CXX14FLAGS: -Wall -pedantic
• CXX17FLAGS: -Wall -pedantic
• CXX20FLAGS: -Wall -pedantic
── R CMD build ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔ checking for file 'C:\Users\raymu\OneDrive\Documents\R\LoF\myfirstpackage/DESCRIPTION' (405ms)
─ preparing 'myfirstpackage':
E checking DESCRIPTION meta-information ...
Malformed maintainer field.
See section 'The DESCRIPTION file' in the 'Writing R Extensions'
manual.
Error in `(function (command = NULL, args = character(), error_on_status = TRUE, …`:
! System command 'Rcmd.exe' failed
---
Exit status: 1
stdout & stderr: <printed>
---
Type .Last.error to see the more details.
> .Last.error
<system_command_status_error/rlib_error_3_0/rlib_error/error>
Error in `(function (command = NULL, args = character(), error_on_status = TRUE, …`:
! System command 'Rcmd.exe' failed
---
Exit status: 1
stdout & stderr: <printed>
---
Backtrace:
1. devtools::check()
2. withr::with_envvar(pkgbuild::compiler_flags(FALSE), action = "prefix", …
3. base::force(code)
4. pkgbuild::build(pkg$path, tempdir(), args = build_args, quiet = quiet, …
5. withr::with_temp_libpaths(rcmd_build_tools(options$cmd, c(options$path, …
6. base::force(code)
7. pkgbuild::rcmd_build_tools(options$cmd, c(options$path, options$args), …
8. pkgbuild::with_build_tools({ …
9. withr::with_path(rtools_path(), code)
10. base::force(code)
11. base::withCallingHandlers(callr::rcmd_safe(..., env = env, spinner = FALSE, …
12. callr::rcmd_safe(..., env = env, spinner = FALSE, show = FALSE, …
13. callr:::run_r(options)
14. base::with(options, with_envvar(env, do.call(processx::run, c(list(bin, …
15. base::with.default(options, with_envvar(env, do.call(processx::run, …
16. base::eval(substitute(expr), data, enclos = parent.frame())
17. base::eval(substitute(expr), data, enclos = parent.frame())
18. callr:::with_envvar(env, do.call(processx::run, c(list(bin, args = real_cmdargs, …
19. base::force(code)
20. base::do.call(processx::run, c(list(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout), …
21. (function (command = NULL, args = character(), error_on_status = TRUE, …
22. base::throw(new_process_error(res, call = sys.call(), echo = echo, …
23. | base::signalCondition(cond)
24. (function (e) …
25. asNamespace("callr")$err$throw(e)
I am expecting a formatted table in the Rstudio environment that can be utilized further by the user.
I have a separate script that I have developed and works great but want to transform it into a package for ease of use and deployment for my thesis research
Please let me know if there is any other info that I missed.
Drop the save line at the end of your function. Put return(tmp_vcf_data) or even simply tmp_vcf_data as the last line of your function. This way your function will return your formatted vcf file.
Then call your function and assign the output to an object. For example output <- load_vcf(inline).
When I run the string below in my command line, it works fine. But when I run it from R, it does not.
I run this:
>cmd <- "python -c 'import sys; import pandas; import scrublet; df = pandas.read_csv(\"C:\\Users\\User\\AppData\\Local\\Temp\\RtmpOmMtOp\\file383068ca4fa\"); scrub = scrublet.Scrublet(df); doublet_scores, predicted_doublets = scrub.scrub_doublets(); pandas.DataFrame(doublet_scores).to_csv(\"C:\\Users\\User\\AppData\\Local\\Temp\\RtmpOmMtOp\\file383068ca4fa.doubletScores\");'"
tmp <- system(cmd, intern=T)
Warning message:
In system(cmd, intern = T) :
running command 'python -c 'import sys; import pandas; import scrublet; df = pandas.read_csv("C:\Users\User\AppData\Local\Temp\RtmpOmMtOp\file383068ca4fa"); scrub = scrublet.Scrublet(df); doublet_scores, predicted_doublets = scrub.scrub_doublets(); pandas.DataFrame(doublet_scores).to_csv("C:\Users\User\AppData\Local\Temp\RtmpOmMtOp\file383068ca4fa.doubletScores");'' had status 1
I installed rstan and when I call map2stan I get the error below:
> library(rstan)
> packageVersion("rstan", lib.loc = "C://TOOLS//R-3.4.0patched//library" )
[1] ‘2.16.2’
here's the call to map2stan
library(rethinking)
data(rugged)
d <- rugged
d$log_gdp <- log(d$rgdppc_2000)
dd <- d[ complete.cases(d$rgdppc_2000) , ]
dd.trim <- dd[ , c("log_gdp","rugged","cont_africa") ]
str(dd.trim)
m8.1stan <- map2stan(
alist(
log_gdp ~ dnorm( mu , sigma ) ,
mu <- a + bR*rugged + bA*cont_africa + bAR*rugged*cont_africa ,
a ~ dnorm(0,100),
bR ~ dnorm(0,10),
bA ~ dnorm(0,10),
bAR ~ dnorm(0,10),
sigma ~ dcauchy(0,2)
) ,
data=dd.trim )
here's the error
Warning message:
running command 'make -f "C:/TOOLS/R-34~1.0PA/etc/x64/Makeconf" -f "C:/TOOLS/R-34~1.0PA/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file29cc72047709.dll" WIN=64 TCLBIN=64 OBJECTS="file29cc72047709.o"' had status 127
ERROR(s) during compilation: source code errors or compiler configuration errors!
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! Warning message:
running command 'make -f "C:/TOOLS/R-34~1.0PA/etc/x64/Makeconf" -f "C:/TOOLS/R-34~1.0PA/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file344416f9304.dll" WIN=64 TCLBIN=64 OBJECTS="file344416f9304.o"' had status 127
In addition: Warning message:
running command 'C:/TOOLS/R-34~1.0PA/bin/x64/R CMD SHLIB file344416f9304.cpp 2> file344416f9304.cpp.err.txt' had status 1
Error in map2stan(alist(log_gdp ~ dnorm(mu, sigma), mu <- a + bR * rugged + :
Something went wrong, when calling Stan. Check any debug messages for clues, detective.
Compilation ERROR, function(s)/method(s) not created! Warning message:
running command 'make -f "C:/TOOLS/R-34~1.0PA/etc/x64/Makeconf" -f "C:/TOOLS/R-34~1.0PA/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file344416f9304.dll" WIN=64 TCLBIN=64 OBJECTS="file344416f9304.o"' had status 127
>
Hmm, I installed rethinking library via http://xcelab.net/rm/software/ (it was not on CRAN) and ran the same code and didn't get any errors in my case. What's the Rtools, R, and OS type/version? Have you followed all installation instructions, e.g. if your OS is Windows, on https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Windows? Can you check that their eight school example in https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started runs fine?
I'm trying to install qdap package in Azure ML. Rest of the dependent packages get installed without any issues. When it comes to qdapTools, I get this error , though the version that I try to install is 1.3.1 ( Verified this from the Decription file that comes with the R package)
package 'qdapTools' 1.1.0 was found, but >= 1.3.1 is required by 'qdap
The code in "Execute R Script" :
install.packages("src/qdapTools.zip", repos = NULL, verbose = TRUE)
install.packages("src/magrittr.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/stringi.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/stringr.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/qdapDictionaries.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/qdapRegex.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/RColorBrewer.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/qdap.zip", lib = ".", repos = NULL, verbose = TRUE)
library(stringr, lib.loc=".", verbose=TRUE)
library(qdap, lib.loc=".", verbose=TRUE)
And the log :
[ModuleOutput] End R Execution: 9/22/2016 6:44:44 AM
[Stop] DllModuleMethod::Execute. Duration = 00:00:16.7828106
[Critical] Error: Error 0063: The following error occurred during evaluation of R script:
---------- Start of error message from R ----------
package 'qdapTools' 1.1.0 was found, but >= 1.3.1 is required by 'qdap'
package 'qdapTools' 1.1.0 was found, but >= 1.3.1 is required by 'qdap'
----------- End of error message from R -----------
[Critical] {"InputParameters":{"DataTable":[{"Rows":2,"Columns":1,"estimatedSize":11767808,"ColumnTypes":{"System.String":1},"IsComplete":true,"Statistics":{"0":[2,0]}}],"Generic":{"bundlePath":"..\\..\\Script Bundle\\Script Bundle.zip","rLibVersion":"R310"},"Unknown":["Key: rStreamReader, ValueType : System.IO.StreamReader"]},"OutputParameters":[],"ModuleType":"LanguageWorker","ModuleVersion":" Version=6.0.0.0","AdditionalModuleInfo":"LanguageWorker, Version=6.0.0.0, Culture=neutral, PublicKeyToken=69c3241e6f0468ca;Microsoft.MetaAnalytics.LanguageWorker.LanguageWorkerClientRS;RunRSNR","Errors":"Microsoft.Analytics.Exceptions.ErrorMapping+ModuleException: Error 0063: The following error occurred during evaluation of R script:\r\n---------- Start of error message from R ----------\r\npackage 'qdapTools' 1.1.0 was found, but >= 1.3.1 is required by 'qdap'\r\n\r\n\r\npackage 'qdapTools' 1.1.0 was found, but >= 1.3.1 is required by 'qdap'\r\n----------- End of error message from R -----------\r\n at Microsoft.MetaAnalytics.LanguageWorker.LanguageWorkerClientRS.ExecuteR(NewRWorker worker, DataTable dataset1, DataTable dataset2, IEnumerable`1 bundlePath, StreamReader rStreamReader, Nullable`1 seed) in d:\\_Bld\\8831\\7669\\Sources\\Product\\Source\\Modules\\LanguageWorker\\LanguageWorker.Dll\\EntryPoints\\RModule.cs:line 287\r\n at Microsoft.MetaAnalytics.LanguageWorker.LanguageWorkerClientRS._RunImpl(NewRWorker worker, DataTable dataset1, DataTable dataset2, String bundlePath, StreamReader rStreamReader, Nullable`1 seed, ExecuteRScriptExternalResource source, String url, ExecuteRScriptGitHubRepositoryType githubRepoType, SecureString accountToken) in d:\\_Bld\\8831\\7669\\Sources\\Product\\Source\\Modules\\LanguageWorker\\LanguageWorker.Dll\\EntryPoints\\RModule.cs:line 207\r\n at Microsoft.MetaAnalytics.LanguageWorker.LanguageWorkerClientRS.RunRSNR(DataTable dataset1, DataTable dataset2, String bundlePath, StreamReader rStreamReader, Nullable`1 seed, ExecuteRScriptRVersion rLibVersion) in d:\\_Bld\\8831\\7669\\Sources\\Product\\Source\\Modules\\LanguageWorker\\LanguageWorker.Dll\\EntryPoints\\REntryPoint.cs:line 105","Warnings":[],"Duration":"00:00:16.7752607"}
Module finished after a runtime of 00:00:17.1411124 with exit code -2
Module failed due to negative exit code of -2
Record Ends at UTC 09/22/2016 06:44:44.
Editing the code to :
install.packages("src/qdapTools.zip",lib="." , repos = NULL, verbose = TRUE)
install.packages("src/qdapDictionaries.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/qdapRegex.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/RColorBrewer.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/qdap.zip", lib = ".", repos = NULL, verbose = TRUE)
library(qdapTools, lib.loc=".", verbose=TRUE)
library(qdap, lib.loc=".", verbose=TRUE)
throws the following error :-
[ModuleOutput] 4: package 'qdapTools' was built under R version 3.3.1
[ModuleOutput]
[ModuleOutput] End R Execution: 9/22/2016 7:11:05 AM
[Stop] DllModuleMethod::Execute. Duration = 00:00:17.0656414
[Critical] Error: Error 0063: The following error occurred during evaluation of R script:
---------- Start of error message from R ----------
package or namespace load failed for 'qdapTools'
package or namespace load failed for 'qdapTools'
----------- End of error message from R -----------
Not sure how to proceed, can someone help please.
Thanks!
This is kind of a shot in the dark, since I don't know the specifics of your system, but it could be that qdapTools 1.3.1 does not get installed to the location of the other packages, since the location specification also is missing from the first line of "Execute R Script" part where qdapTools gets installed:
lib="."
Which could result in R loading an older version of qdapTools (did you have an older version installed before?) that lies somewhere else.
Hi I'm trying to use R to control unzipping a file.
I've added 7z into PATH, and did
7z e hat.2015-09-26T01-10-02.gz
and it worked.
Now in R, i'm in the same directory, and i tried
> command1 = paste0('7z e ', drop.file)
> command1
[1] "7z e hat.2015-09-26T01-10-02.gz"
> system(command1, intern=T)
Error in system(command1, intern = T) : '7z' not found
> system2(command1)
Warning message:
running command '"7z e hat.2015-09-26T01-10-02.gz"' had status 127
> shell(command1)
'7z' is not recognized as an internal or external command,
operable program or batch file.
Warning messages:
1: running command 'C:\Windows\system32\cmd.exe /c 7z e hat.2015-09-26T01-10-02.gz' had status 1
2: In shell(command1) :
'7z e hat.2015-09-26T01-10-02.gz' execution failed with error code 1
It's little bit raw, but try this out (:
Only Windows. It's uses CMD
ZiparEm7zip = function(sQualPasta)
{
sWDTava = getwd()
setwd(dirname(sQualPasta))
sQuem = gsub("[/]", "\\\\", sQualPasta)
dirname(sQuem)
NomeArquivo = paste0("eufaco7zip",".bat")
sNomePasta7zip = basename(sQuem)
sArquivoSaida = basename(sQuem)
sQualPasta7zip = sQuem
if(dir.exists("C:/Program Files/7-Zip/"))
{
sTexto = "set PATH=%PATH%;C:\\Program Files\\7-Zip\\"
}else if(dir.exists("C:/Program Files (x86)/7-Zip/"))
{
sTexto = "set PATH=%PATH%;C:\\Program Files (x86)\\7-Zip\\"
}else
{
stop("Error, o 7zip not installed?")
}
sTexto2 = paste0("\npushd ",sQualPasta7zip)
sTexto3 = paste0("\n7z a -r ../",sArquivoSaida," *")
sTexto4 = '\n( del /q /f "%~f0" >nul 2>&1 & exit /b 0 )'
cat(sTexto,file=NomeArquivo,append = TRUE)
cat(sTexto2,file=NomeArquivo,append = TRUE)
cat(sTexto3,file=NomeArquivo,append = TRUE)
cat(sTexto4,file=NomeArquivo,append = TRUE)
shell.exec(NomeArquivo)
while(file.exists(NomeArquivo))
{
Sys.sleep(10)
}
setwd(sWDTava)
return(TRUE)
}
Try like:
ZiparEm7zip("F:/MYFOLDER")