cl <- parallelly::makeClusterPSOCK(2, autoStop = TRUE)
Error:
Error in system(test_cmd, intern = TRUE, input = input) :
'CreateProcess' failed to run 'C:\Users\xxx~1\ONEDRI~1\DOCUME~1\R\R-40~1.3\bin\x64\Rscript.exe -e "try(suppressWarnings(cat(Sys.getpid(),file=\"C:/Users/LOCAL_~1/Temp/RtmpIP7vSI/worker.rank=1.parallelly.parent=19988.4e147c0a5082.pid\")), silent = TRUE)" -e "file.exists(\"C:/Users/LOCAL_~1/Temp/RtmpIP7vSI/worker.rank=1.parallelly.parent=19988.4e147c0a5082.pid\")"'
I was trying to create the clusters for parallel execution. But does not work and throws the above error.
Related
I am trying to use getopt package to open my file but the codes seem not working:
> library(getopt)
args <- commandArgs(trailingOnly = FALSE)
spec = matrix(c(
'help' , 'h', 0, "character",
'input' , 'i', 1, "file",
'output' , 'o', 1, "character"), byrow=TRUE, ncol=4)
opt = getopt(spec)
if(opt$input){
file <- read.table(args[1])
}
print(file)
I am trying to use command line to run the codes like:
Rscript --slave filename.R -i file.txt
The error information is:
Error in storage.mode(peek.optstring) <- mode : invalid value
Calls: getopt ... tryCatch -> tryCatchList -> tryCatchOne -> doTryCatch
Execution halted
Can someone help me out?
You need to test the components, and if -i filename.txt is given then opt$file is what you use to access it.
A repaired version is
#!/usr/bin/Rscript
library(getopt)
spec <- matrix(c(
'help' , 'h', 0, "character",
'input' , 'i', 1, "character",
'output' , 'o', 1, "character"),
byrow=TRUE, ncol=4)
opt <- getopt(spec)
if ( !is.null(opt$input) ) {
file <- read.table(opt$input)
}
print(file)
I used to use this package quite a bit, but these days I much prefer docopt which is even easier to use and more featureful.
In case others run into this same problem, I got the same error message
Error in getopt_options(object, args) :
Error in storage.mode(this.argument) <- mode : invalid value
Calls: parse_args -> parse_options -> getopt_options
My error turned out to be from accidentally misspelling my type argument:
make_option(c("--chr_len"), type = 'chaqracter', default = NULL, help = "file path: length of all chromosomes")
This error was resolved when I fixed the spelling
make_option(c("--chr_len"), type = 'character', default = NULL, help = "file path: length of all chromosomes")
I have this windows-batchfile which I'm calling from R using the shell() command. This batchfile does some calculations and writes them on the disk but also on the screen. I'm interested in the disk-output, only. I cannot change the batchfile.
The batchfile might be something silly like:
#echo off
echo 1 + 2
#echo 1 + 2 > C:\TEMP\batchoutput.txt
exit
I tried
shell("batchfile.bat", invisible = TRUE)
1 + 2
shell("batchfile.bat", show.output.on.console = FALSE)
Error in system(cmd, intern = intern, wait = wait | intern, show.output.on.console = wait, :
formal argument "show.output.on.console" matched by multiple actual arguments
system("batchfile.bat", invisible = T)
1 + 2
system("batchfile.bat", show.output.on.console = F)
Warning message:
running command 'C:\TEMP\batchfile.bat' had status 1
Is there a way of supressing the console-output on R?
options(warn = -1)
shell("You command")
options(warn = 0)
I want to generate random string and have installed the random package.
However, I couldn't run my code and received this error:
Error in url(urltxt, ..., method = "libcurl") : cannot open connection
In addition: Warning message: In url(urltxt, ..., method = "libcurl")
: URL 'https://www.random.org/strings/?num=7&len=6&digits=on&upperalpha=on&loweralpha=off&unique=on&format=plain&rnd=new'
: status was 'SSL connect error'
Here's my code:
library("random")
String<-randomStrings(n=7, len = 6, digits = TRUE, upperalpha = TRUE, loweralpha = FALSE, unique = TRUE, check = FALSE)
Anybody knows what's the source of this error?
I am trying to run dssp function using bio3d package in R. But I am getting error.
library("bio3d")
pdb <- read.pdb("1CRN")
x <- dssp(pdb, exepath="C:/dssp/dssp.exe")
Error in file(con, "r") : cannot open the connection
Any suggestions please.
To solve it you need to fix the dssp function paramenters:
fix(dssp)
rewrite the following line:
system(paste(exepath, "dssp -c ", infile, " ", outfile, sep = ""), ignore.stderr = TRUE)
"-i" istead of "-c" and "-o" intead of " "
chears
The scheme I am trying to evaluate is:
weka.classifiers.meta.AttributeSelectedClassifier -E "weka.attributeSelection.CfsSubsetEval " -S "weka.attributeSelection.BestFirst -D 1 -N 5" -W weka.classifiers.functions.SMOreg -- -C 1.0 -N 0 -I "weka.classifiers.functions.supportVector.RegSMOImproved -L 0.0010 -W 1 -P 1.0E-12 -T 0.0010 -V" -K "weka.classifiers.functions.supportVector.PolyKernel -C 250007 -E 1.0"
i.e. I am trying to run an AttributeSelectedClassifier with an SMOreg classifier inside. Every other parameter is the default value of the respective classifier.
So the R code is:
optns <- Weka_control(W = "weka.classifiers.functions.SMOreg")
ASC <- make_Weka_classifier("weka/classifiers/meta/AttributeSelectedClassifier")
model <- ASC(class ~ ., data = as.data.frame(dat), control = optns)
evaluation <- evaluate_Weka_classifier(model, numFolds = 10)
evaluation
When I run the above R code I get this error:
Error in .jcall(evaluation, "D", x, ...) : java.lang.NullPointerException
The above error happens in RWeka's evaluate.R where it tries to call the WEKA methods: "pctCorrect", "pctIncorrect", "pctUnclassified", "kappa", "meanAbsoluteError","rootMeanSquaredError","relativeAbsoluteError","rootRelativeSquaredError"
I also tried manually specifying the default values using the Weka_control object like so:
optns <- Weka_control(E = "weka.attributeSelection.CfsSubsetEval ",
S = list("weka.attributeSelection.BestFirst", D = 1,N = 5),
W = list("weka.classifiers.functions.SMOreg", "--",
C=1.0, N=0,
I = list("weka.classifiers.functions.supportVector.RegSMOImproved",
L = 0.0010, W=1,P=1.0E-12,T=0.0010,V=TRUE),
K = list("weka.classifiers.functions.supportVector.PolyKernel",
C=250007, E=1.0)))
ASC <- make_Weka_classifier("weka/classifiers/meta/AttributeSelectedClassifier")
model <- ASC(class ~ ., data = as.data.frame(dat), control = optns)
evaluation <- evaluate_Weka_classifier(model, numFolds = 10)
evaluation
and I get this error:
Error in .jcall(classifier, "V", "buildClassifier", instances) :
java.lang.Exception: Can't find class called: weka.classifiers.functions.SMOreg -- -C 1 -N 0 -I weka.classifiers.functions.supportVector.RegSMOImproved -L 0.001 -W 1 -P 1e-12 -T 0.001 -V -K weka.classifiers.functions.supportVector.PolyKernel -C 250007 -E 1
I tried your example but got a different error (where dat is my own data frame)
Error in model.frame.default(formula = class ~ ., data = dat) :
object is not a matrix
Your error may be not directly related to syntax of calling this Weka function but some issues with path setup.