Displaying 20 results from an estimated 10000 matches similar to: "How to wait for a user response in Rscript?"
2009 Sep 06
2
How to pop up the graphics window from Rscript?
Hi,
I am wondering how to pop up the graphics window from Rscript. I run
the following code, but I don't see the graphics window, even
transiently.
Regards,
Peng
$ Rscript plot.R
> x=1:10
> y=1:10
> plot(x,y)
>
2010 Jan 01
5
How to not to terminate read.table if the input file is empty?
read.table terminates the program if the input file is empty. Is there
way to let the program continue and return me a NULL instead of
terminating the program?
$ Rscript read_empty.R
> read.table("empty_data.txt")
Error in read.table("empty_data.txt") : no lines available in input
Execution halted
$ cat read_empty.R
read.table("empty_data.txt")
$ cat
2009 Sep 05
1
Is 'history' recorded in Rscript?
Hi,
I run the following command and try to save the commands that have
been run in the script. But it seems that no history is recorded. Is
it because that the history is not recorded in Rscript?
Regards,
Peng
$ Rscript savehistory.R
> f=tempfile()
> f
[1] "/tmp/Rtmp7WBjGG/file327b23c6"
> history()
Error in savehistory(file) : no history available to save
Calls: history ->
2009 Oct 27
2
Why I get this error? Error in close.connection(f) : invalid connection
I don't understand why I can not close 'f'. This may be very simple,
but I don't see why. Could somebody let me know?
$ cat gzfile.csv
"","V1","V2","V3","V4","V5"
"1",1,5,9,13,17
"2",2,6,10,14,18
"3",3,7,11,15,19
"4",4,8,12,16,20
$ Rscript gzfile.R
> f =
2009 Aug 28
1
How to convert a string passed as an argument to a vector?
Hi,
$ cat commandArgs.R
args=commandArgs(trailingOnly=TRUE)
args[1]+10
I have the above code. But the following command line gives me an error. I
am wondering what is the correct way to convert a string to a vector?
$ Rscript commandArgs.R 1:3
> args=commandArgs(trailingOnly=TRUE)
> args[1]+10
Error in args[1] + 10 : non-numeric argument to binary operator
Execution halted
Regards,
Peng
2009 Sep 07
1
Why this statement does not print anything in an if-statement that includes 'q()'?
Hi,
I run the following script. I don't understand why the second
'length(args)' does not show anything but the first one shows '0'. Is
it because the command 'q()' affects anything in the if-statement.
However, if I change the second 'length(args)' to
'print(length(args))', the script will print the length of 'args'. Can
somebody let me know
2009 Sep 16
1
How to convert a frame to a matrix while maintaining that a number is still a number?
Hi,
See the code below.
'x' is a frame. x$C1 are all numbers 1, 2 and 3.
'as.matrix(x)' convert x$C1 to strings "1", "2" and "3". I'm wondering
how to maintain that the first column of 'as.matrix(x)' still numbers.
Regards,
Peng
$ cat read.csv
"C1","C2"
"1","x"
"2","y"
2009 Sep 22
1
How to get the current script file name in the script?
Hi,
Right now, I hardcode the file name in the script. But when I change
the script name, I have to change the file name in the script to make
sure the file name inside the script is synchronized with the script
name. I am wondering if there is an automatic way to get the script
file name in a script.
Regards,
Peng
$ Rscript get_file_name.R
> print('get_file_name.R')
[1]
2018 Feb 01
1
Error message: 'Rscript' should not be used without a path
Dear R-devel members,
recently, I ran into the following error message (R-devel 2018-01-31):
'Rscript' should not be used without a path -- see par. 1.6 of the manual
I would like to know more about it, why is it required to run Rscript with
a path, and where is that par. 1.6 of the manual.
I get this error message during Travis r-devel build of my package for
generating makefiles. I
2010 Jan 21
1
How to write '"' to a csv with the default setting of write.csv?
Please see the following example. I can not write '"' to a csv file
successfully. Could somebody let me if it is possible to write '"' to
a csv file with the default setting of write.csv?
my_home$ Rscript main_quote.R
> x=rbind(
+ "\"A\""
+ , "\"B\""
+ )
> x
[,1]
[1,] "\"A\""
[2,]
2009 Aug 20
1
Command line option to an R script running through Rscript
Hi,
I know that I can use the following script to get the command line
options for an R script. But the output shows two many irrelevant
arguments. For example, I only want to pass "a", "b" and "c" to the
script. The first 5 elements in the variable 'args' are not what I
want. I am wondering what is the correct way to pass command line
options to an R script.
2009 Aug 10
5
Example scripts for R Manual
Hi,
I am wondering if some experienced users would help put the
ready-to-run code of the examples in the manuals. It would help new
users learn R faster by putting all the examples in an ready-to-run R
script file. Can somebody help do so sometime and post the code along
with the pdf manuals?
http://cran.r-project.org/manuals.html
Regards,
Peng
2009 Dec 18
4
How to print to file?
I don't find a function to print a string to file. Would somebody let
me know what function I should use?
2010 Feb 03
5
How to export the examples in help(something) to a file?
Some examples in the help page are too long to be copied from screen.
Could somebody let me know some easy way on how to extract the example
to a file so that I can play with them?
2009 Oct 27
1
How to change a slot by a method?
In the following code, 'multiply' doesn't multiply a at x by 2. I'm
wondering how to define a method that can change the slot of a class.
$ Rscript setGeneric.R
> setClass(
+ Class='A',
+ representation=representation(
+ x='numeric'
+ )
+ )
[1] "A"
>
> setMethod(
+ f='initialize',
+
2010 May 20
1
Use of R and Rscript in configure/Makevars in packages
We have seen problems with a number of packages which use R/Rscript to
run R code in configure or makefiles.
(a) You must give a full path: there need be no version of R in the
path, and if there is it might not be the version/build of R under
which package installation is being done. So the general form is to
use
${R_HOME}/bin/R
to select the right version. And since ${R_HOME} might
2009 Aug 29
3
Sequence generation
Hey guys,
I was wondering how to create this sequence: 1, 2, 3, 1, 2, 3, 1, 2, 3, 1,
2, 3... with the '1, 2, 3' repeated over 10 times.
Also, is there a simple method to generate 1, 1, 1, 2, 2, 2, 3, 3, 3?
Anyways, any help with be greatly appreciated!
--
View this message in context: http://www.nabble.com/Sequence-generation-tp25205593p25205593.html
Sent from the R help mailing list
2010 Jan 21
3
Anova unequal variance
I found this paper on ANOVA on unequal error variance. Has this be
incorporated to any R package? Is there any textbook that discuss the
problem of ANOVA on unequal error variance in general?
http://www.jstor.org/stable/2532947?cookieSet=1
2008 Oct 16
1
Rscript -e, Sweave and tempdir()
Hello R-Help
I have a question about the "behind the scenes" behaviour of the Rscript -e command and particularly its interaction with Sweave and tempdir().
We are trying to deploy R as a web service to do water quality analyses and have been writing software to call Sweave via Rscript eg:
cmd> Rscript -e Sweave('sweavefile.Rnw')
One problem we have been having is that
2012 Dec 30
4
[LLVMdev] git repository of the tutorial
Hi,
I'm learning the tutorial.
http://llvm.org/docs/tutorial/
I'm wondering if there is already a git repository of the examples in
the tutorial so that I don't have to copy the code from the webpage.
Thanks!
--
Regards,
Peng