Reputation: 77
I would like to set the working directory of the command prompt using the function system2
in R and I got the following error:
system2("cmd.exe", args = paste("cd", "Users/AKatherine/Downloads", sep = " "))
'Akatherine' is not recognized as an internal or external command, operable program or batch file.
Also, I tried to run this
system2("cmd.exe", args = "java -mx150m -cp "*;" edu.stanford.nlp.parser.lexparser.LexicalizedParser -outputFormat "penn,typedDependencies" -outputFormatOptions "basicDependencies" edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ./Test/input.txt")
and got the following error:
Error: unexpected ';' in "system2("cmd.exe", args = "java -mx150m -cp "*;"
Do anyone know why? Can anyone help me with this?
Upvotes: 0
Views: 435
Reputation: 77
For the second part of my question, I tried using the shell
function instead of the system2
function and I got the same output that I observe when I type in the same command in the command prompt. I used:
shell(cmd = "java -mx150m -cp \"*;\" edu.stanford.nlp.parser.lexparser.LexicalizedParser -outputFormat \"penn,typedDependencies\" -outputFormatOptions \"basicDependencies\" edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ./Test/input.txt", shell = "cmd.exe")
instead of
system2("cmd.exe", args = "java -mx150m -cp \"*;\" edu.stanford.nlp.parser.lexparser.LexicalizedParser -outputFormat \"penn,typedDependencies\" -outputFormatOptions \"basicDependencies\" edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ./Test/input.txt")
Upvotes: 1