[R] Using Rscript in version 3.0.0
Greetings, I have just installed version 3.0.0. I am trying to use code that I have used numerous times in previous versions of R. My code executes correctly until I try to call makePSOCKcluster. I issue the following command and get the following error: cluster - makePSOCKcluster(nodes, port=10191, useXDR=FALSE) bash: /usr/local/lib64/R/bin/Rscript: No such file or directory I look in /usr/local/lib64/R/bin and there is indeed a file named Rscript and I have permissions to execute it. As a check, I reran my code with R 2.15.2 and it runs as expected. Any thoughts? Kenneth G. Weiss Department of Human Genetics The University of Michigan For I know the plans I have for you, declares the LORD, plans to prosper you and not to harm you, plans to give you hope and a future. - Jeremiah 29:11 Check out the website http://www.amazingfacts.org/ for answers to Bible questions that will change your life. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Using Rscript in version 3.0.0
On 07/05/13 02:10, Ken Weiss wrote: Greetings, I have just installed version 3.0.0. I am trying to use code that I have used numerous times in previous versions of R. My code executes correctly until I try to call makePSOCKcluster. I issue the following command and get the following error: cluster - makePSOCKcluster(nodes, port=10191, useXDR=FALSE) bash: /usr/local/lib64/R/bin/Rscript: No such file or directory I look in /usr/local/lib64/R/bin and there is indeed a file named Rscript and I have permissions to execute it. As a check, I reran my code with R 2.15.2 and it runs as expected. Any thoughts? My main thought is that you should supply a reproducible example (as the footer at the bottom of every r-help message reminds you) and explain where TF the function makePSOCKcluster() comes from. cheers, Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Using Rscript to read from a file
Hello, I have this script which will be invoked as Rscript a.r a.r a.r follows #!/usr/bin/Rscript --vanilla f=file(stdin) while(TRUE){ y=readLines(f,n=1,warn=TRUE) if(length(y)==0) break else print(y) } But it only reads one line from a.r How can I read line by line from standard input? Thank you Saptarshi __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Using Rscript to read from a file
On 14 October 2010 at 08:49, Saptarshi Guha wrote: | Hello, | I have this script which will be invoked as | | Rscript a.r a.r | | a.r follows | | #!/usr/bin/Rscript --vanilla | f=file(stdin) | while(TRUE){ | y=readLines(f,n=1,warn=TRUE) | if(length(y)==0) break else print(y) | } | | | But it only reads one line from a.r | How can I read line by line from standard input? If you can substitute in r (from littler) for Rscript, then you get proper behaviour. Here is an old example from littler: $ ls -l /usr/bin | awk '!/^total/ {print $5}' | \ r -e 'fsizes - as.integer(readLines()); print(summary(fsizes))' | \ tail -2 Min. 1st Qu. Median Mean 3rd Qu. Max. 1 172010900 10800039200 1110 $ This uses awk to get the file size from ls, and then runs R's summary() over it. For some reason, readLines() now echos back to the screen which is why I added the 'tail -2' at the end. Dirk -- Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Using Rscript to read from a file
On 14 October 2010 at 11:21, Dirk Eddelbuettel wrote: | On 14 October 2010 at 08:49, Saptarshi Guha wrote: | | Hello, | | I have this script which will be invoked as | | | | Rscript a.r a.r | | | | a.r follows | | | | #!/usr/bin/Rscript --vanilla | | f=file(stdin) | | while(TRUE){ | | y=readLines(f,n=1,warn=TRUE) | | if(length(y)==0) break else print(y) | | } | | | | | | But it only reads one line from a.r | | How can I read line by line from standard input? | | If you can substitute in r (from littler) for Rscript, then you get proper | behaviour. Here is an old example from littler: | |$ ls -l /usr/bin | awk '!/^total/ {print $5}' | \ |r -e 'fsizes - as.integer(readLines()); print(summary(fsizes))' | \ |tail -2 | Min. 1st Qu. Median Mean 3rd Qu. Max. |1 172010900 10800039200 1110 |$ | | This uses awk to get the file size from ls, and then runs R's summary() over | it. For some reason, readLines() now echos back to the screen which is why I | added the 'tail -2' at the end. Got it. We changed something since we first created this example in 2006, and we now need to set the -i flags. So with that: $ ls -l /usr/bin | awk '!/^total/ {print $5}' | \ r -i -e 'fsizes - as.integer(readLines()); print(summary(fsizes))' Min. 1st Qu. Median Mean 3rd Qu. Max. 1 172010900 10800039200 1110 $ Dirk -- Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Using Rscript to read from a file
Dirk, thanks. On Thu, Oct 14, 2010 at 9:42 AM, Dirk Eddelbuettel e...@debian.org wrote: On 14 October 2010 at 11:21, Dirk Eddelbuettel wrote: | On 14 October 2010 at 08:49, Saptarshi Guha wrote: | | Hello, | | I have this script which will be invoked as | | | | Rscript a.r a.r | | | | a.r follows | | | | #!/usr/bin/Rscript --vanilla | | f=file(stdin) | | while(TRUE){ | | y=readLines(f,n=1,warn=TRUE) | | if(length(y)==0) break else print(y) | | } | | | | | | But it only reads one line from a.r | | How can I read line by line from standard input? | | If you can substitute in r (from littler) for Rscript, then you get proper | behaviour. Here is an old example from littler: | | $ ls -l /usr/bin | awk '!/^total/ {print $5}' | \ | r -e 'fsizes - as.integer(readLines()); print(summary(fsizes))' | \ | tail -2 | Min. 1st Qu. Median Mean 3rd Qu. Max. | 1 1720 10900 108000 39200 1110 | $ | | This uses awk to get the file size from ls, and then runs R's summary() over | it. For some reason, readLines() now echos back to the screen which is why I | added the 'tail -2' at the end. Got it. We changed something since we first created this example in 2006, and we now need to set the -i flags. So with that: $ ls -l /usr/bin | awk '!/^total/ {print $5}' | \ r -i -e 'fsizes - as.integer(readLines()); print(summary(fsizes))' Min. 1st Qu. Median Mean 3rd Qu. Max. 1 1720 10900 108000 39200 1110 $ Dirk -- Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Using Rscript in combination with eval() results in error
Dear List, I'm having trouble running a .bat file which calls an R-Script via the command line (using Rscript). I put the following line in a file called test.bat: Rscript --vanilla test.R Then I tried to launch test.bat via Windows' CMD (I plan to make this a scheduled Windows task). The actual R-script (test.R) is executed just fine until it gets to a line containing an eval() expression: eval(parse(file=C:/temp/another.script.R)) and R (or Windows' CMD, respectively) throws the following error Error in if (file == ) - stdin() else { : Argument is of length 0 Calls: source - eval.with.vis - eval.wtih.vis - source Execution stopped Usually such eval() expressions work just fine in my scripts. I tried the following already: 1) to.load.file - file(C:/temp/another.script.R, open=rt); eval(parse(file=to.load.file): No luck 2) Running test.R within a Rterm session: Works fine. 3) Calling the following from within a Rterm session: system(Rscript C:/temp/test.R, wait=TRUE, invisible=FALSE) That works too! Is there something one needs to be aware of regarding eval() or source() when launching a script via a CMD call to a .bat file? Im running Windows XP and R-2.10.1 Any hints greatly appreciated! Thanks, Janko __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Using Rscript
Dear List, Hopefully someone will point me to a piece of documentation that I have overlooked. I am running Rscript successfully to read and execute an R program, but have failed to find the correct syntax to route the output to a file using the Rscript command that invokes the job. I tried Rscript -e 'sink(outputfile)' script.R , but it then ignored the scriptfile. I know that pipes would solve the problem in unix, but I have no idea how the windows equivalent works. I am running R.2.8.0 on windows, Many thanks, Philip This message should be regarded as confidential. If you have received this email in error please notify the sender and destroy it immediately. Statements of intent shall only become binding when confirmed in hard copy by an authorised signatory. The contents of this email may relate to dealings with other companies within the Detica Group plc group of companies. Detica Limited is registered in England under No: 1337451. Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Using Rscript
You use the facilities of your command-line shell. Rscript infile.R outfile works in every one I have seen in recent years, including Windows' cmd.exe (although many people prefer more capable shells on that platform such as tcsh or bash). On Fri, 30 Jan 2009, Philip Whittall wrote: Dear List, Hopefully someone will point me to a piece of documentation that I have overlooked. I am running Rscript successfully to read and execute an R program, but have failed to find the correct syntax to route the output to a file using the Rscript command that invokes the job. I tried Rscript -e 'sink(outputfile)' script.R , but it then ignored the scriptfile. I know that pipes would solve the problem in unix, but I have no idea how the windows equivalent works. I am running R.2.8.0 on windows, Many thanks, Philip This message should be regarded as confidential. If you have received this email in error please notify the sender and destroy it immediately. Statements of intent shall only become binding when confirmed in hard copy by an authorised signatory. The contents of this email may relate to dealings with other companies within the Detica Group plc group of companies. Detica Limited is registered in England under No: 1337451. Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.