Re: [R] shell scripts in R
Marc Schwartz <[EMAIL PROTECTED]> 10/13/05 06:07PM >>> >On Fri, 2005-10-14 at 00:39 +0200, Benedict P. Barszcz wrote: >> Dnia piatek, 14 pazdziernika 2005 00:13, Sundar Dorai-Raj napisal: >> >> > Don't you mean system("ls")? See ?system. >> > >> > Arguments: >> > >> > command: the system command to be invoked, as a string. >> >> This is the kind of obstacles a newbie has to overcome. Whoeve is writing the >> documentation for R, please do not attempt to save on bytes. Life would be so >> much more pleasureable if only it would say "as a quoted string". Jee. > >The phrase "quoted string" in my mind is redundant. It is also inaccurate, after all you could do the following: > tmp <- paste(letters[ c(12,19)], collapse='') > system(tmp,show=T) here tmp is a string and works, but quoting it would break things. Greg Snow, Ph.D. Statistical Data Center, LDS Hospital Intermountain Health Care [EMAIL PROTECTED] (801) 408-8111 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] shell scripts in R
Le ven 14/10/2005 à 00:39, Benedict P. Barszcz a écrit : > Dnia piÄ tek, 14 października 2005 00:13, Sundar Dorai-Raj napisaÅ: > > > Don't you mean system("ls")? See ?system. > > > > Arguments: > > > > command: the system command to be invoked, as a string. > > This is the kind of obstacles a newbie has to overcome. > Whoeve is writing the > documentation for R, please do not attempt to save on bytes. Life would be so > much more pleasureable if only it would say "as a quoted string". Jee. > obviously, you're a newbie in informatic. In most of informatic language, you use quoted string to distinguish it from variable of your environnement. if not quoted, string is interpreted like a variable and you must declared your variable previously, otherwise, you have a message error... like you had. best. Yves [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] shell scripts in R
But, > foo <- 'ls' > system(foo) is valid. Is foo a "string" or a "quoted string"? Without a doubt, it is the former. But I don't see any quote marks in system(foo) -Don At 12:39 AM +0200 10/14/05, Benedict P. Barszcz wrote: >Dnia piàtek, 14 paêdziernika 2005 00:13, Sundar Dorai-Raj napisa½: > >> Don't you mean system("ls")? See ?system. >> >> Arguments: >> >> command: the system command to be invoked, as a string. > >This is the kind of obstacles a newbie has to overcome. Whoeve is writing the >documentation for R, please do not attempt to save on bytes. Life would be so >much more pleasureable if only it would say "as a quoted string". Jee. > > >-- >Benedict > >Cyfrowy klucz publiczny / Digital public key >http://agrypa1.atspace.com/klucze/kb2qzv_wp.pl-public.asc > >__ >R-help@stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] shell scripts in R
First I have to correct myself; there probably is an ls object in your workspace, but it's a function. Second I have to suggest you should try to run the example code in the help file. Surely this would clarify that the string has to be quoted? t1 <- system("who", TRUE) I'm not so sure that it's a question of saving bytes as a question of assuming that people will try reasonable avenues. Cheers Andrew On Fri, Oct 14, 2005 at 12:39:59AM +0200, Benedict P. Barszcz wrote: > Dnia pi?tek, 14 pa?dziernika 2005 00:13, Sundar Dorai-Raj napisa?: > > > Don't you mean system("ls")? See ?system. > > > > Arguments: > > > > command: the system command to be invoked, as a string. > > This is the kind of obstacles a newbie has to overcome. Whoeve is writing the > documentation for R, please do not attempt to save on bytes. Life would be so > much more pleasureable if only it would say "as a quoted string". Jee. > > > -- > Benedict > > Cyfrowy klucz publiczny / Digital public key > http://agrypa1.atspace.com/klucze/kb2qzv_wp.pl-public.asc > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Andrew Robinson Senior Lecturer in Statistics Tel: +61-3-8344-9763 Department of Mathematics and StatisticsFax: +61-3-8344-4599 University of Melbourne, VIC 3010 Australia Email: [EMAIL PROTECTED]Website: http://www.ms.unimelb.edu.au __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] shell scripts in R
On Fri, 2005-10-14 at 00:39 +0200, Benedict P. Barszcz wrote: > Dnia piątek, 14 października 2005 00:13, Sundar Dorai-Raj napisał: > > > Don't you mean system("ls")? See ?system. > > > > Arguments: > > > > command: the system command to be invoked, as a string. > > This is the kind of obstacles a newbie has to overcome. Whoeve is writing the > documentation for R, please do not attempt to save on bytes. Life would be so > much more pleasureable if only it would say "as a quoted string". Jee. The phrase "quoted string" in my mind is redundant. If you had taken the time to review the 3 examples provided on the same page, you would have seen that all three show the use of quotes around the command and indeed two of the three use the 'ls' command specifically. Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] shell scripts in R
Le 13 Octobre 2005 18:39, Benedict P. Barszcz a écrit : > Dnia piątek, 14 października 2005 00:13, Sundar Dorai-Raj napisał: > > Don't you mean system("ls")? See ?system. > > > > Arguments: > > > > command: the system command to be invoked, as a string. > > This is the kind of obstacles a newbie has to overcome. Whoeve is writing > the documentation for R, please do not attempt to save on bytes. Life would > be so much more pleasureable if only it would say "as a quoted string". > Jee. In 'system(ls)', 'ls' would be any object, whereas in 'system("ls")', it is a string. Specifying "quoted string" would be redundant. (True R wizard can correct me if I,m not accurate.) When I first encountered R's man pages, I thought they were rather sparse compared to those of S-Plus. Now I find they are just to the point and so much easier to consult! -- Vincent Goulet, Professeur agrégé École d'actuariat Université Laval, Québec [EMAIL PROTECTED] http://vgoulet.act.ulaval.ca __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] shell scripts in R
Dnia piątek, 14 października 2005 00:13, Sundar Dorai-Raj napisał: > Don't you mean system("ls")? See ?system. > > Arguments: > > command: the system command to be invoked, as a string. This is the kind of obstacles a newbie has to overcome. Whoeve is writing the documentation for R, please do not attempt to save on bytes. Life would be so much more pleasureable if only it would say "as a quoted string". Jee. -- Benedict Cyfrowy klucz publiczny / Digital public key http://agrypa1.atspace.com/klucze/kb2qzv_wp.pl-public.asc __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] shell scripts in R
Benedykt, No, there is no ls object in your workspace. Try this: system("ls", intern = FALSE, ignore.stderr = TRUE) Andrew On Fri, Oct 14, 2005 at 12:04:52AM +0200, Benedykt P. Barszcz wrote: > Dnia czwartek, 13 pa?dziernika 2005 23:25, Andrew Robinson napisa?: > > Marco, > > > > use the system command. > > > > ?system > > > > I hope that this helps, > > system(ls, intern = FALSE, ignore.stderr = TRUE) > Error in as.character(args[[i]]) : cannot coerce to vector > > In fact it ignores the stderr ! > -- > pozdrawiam, > Benedykt > > Cyfrowy klucz publiczny / Digital public key > http://agrypa1.atspace.com/klucze/kb2qzv_onet-public.asc > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Andrew Robinson Senior Lecturer in Statistics Tel: +61-3-8344-9763 Department of Mathematics and StatisticsFax: +61-3-8344-4599 University of Melbourne, VIC 3010 Australia Email: [EMAIL PROTECTED]Website: http://www.ms.unimelb.edu.au __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] shell scripts in R
On Fri, 2005-10-14 at 00:04 +0200, Benedykt P. Barszcz wrote: > Dnia czwartek, 13 października 2005 23:25, Andrew Robinson napisał: > > Marco, > > > > use the system command. > > > > ?system > > > > I hope that this helps, > > system(ls, intern = FALSE, ignore.stderr = TRUE) > Error in as.character(args[[i]]) : cannot coerce to vector > > In fact it ignores the stderr ! As per ?system: command the system command to be invoked, as a string. Thus, system("ls", intern = FALSE, ignore.stderr = TRUE) HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] shell scripts in R
Benedykt P. Barszcz wrote: > Dnia czwartek, 13 października 2005 23:25, Andrew Robinson napisał: > >>Marco, >> >>use the system command. >> >>?system >> >>I hope that this helps, > > > system(ls, intern = FALSE, ignore.stderr = TRUE) > Error in as.character(args[[i]]) : cannot coerce to vector > > In fact it ignores the stderr ! Don't you mean system("ls")? See ?system. Arguments: command: the system command to be invoked, as a string. --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] shell scripts in R
Dnia czwartek, 13 października 2005 23:25, Andrew Robinson napisał: > Marco, > > use the system command. > > ?system > > I hope that this helps, system(ls, intern = FALSE, ignore.stderr = TRUE) Error in as.character(args[[i]]) : cannot coerce to vector In fact it ignores the stderr ! -- pozdrawiam, Benedykt Cyfrowy klucz publiczny / Digital public key http://agrypa1.atspace.com/klucze/kb2qzv_onet-public.asc __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] shell scripts in R
Marco, use the system command. ?system I hope that this helps, Andrew On Thu, Oct 13, 2005 at 05:14:38PM -0400, Marco Grazzi wrote: > > Hi, > > How can I execute some scripts from within R. > I have a large data file which I process (for instance with gawk, but not > only) before performing some statistics. > I would like to do this in R, so that I do not have to save many data files > and then making analysis on them (which proved to be unefficient) > > Thank you > > Marco Grazzi > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Andrew Robinson Senior Lecturer in Statistics Tel: +61-3-8344-9763 Department of Mathematics and StatisticsFax: +61-3-8344-4599 University of Melbourne, VIC 3010 Australia Email: [EMAIL PROTECTED]Website: http://www.ms.unimelb.edu.au __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] shell scripts in R
Look at the example that uses gawk and pipe in: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/59815.html On 10/13/05, Marco Grazzi <[EMAIL PROTECTED]> wrote: > > Hi, > > How can I execute some scripts from within R. > I have a large data file which I process (for instance with gawk, but not > only) before performing some statistics. > I would like to do this in R, so that I do not have to save many data files > and then making analysis on them (which proved to be unefficient) > > Thank you > > Marco Grazzi > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] shell scripts in R
Hi, How can I execute some scripts from within R. I have a large data file which I process (for instance with gawk, but not only) before performing some statistics. I would like to do this in R, so that I do not have to save many data files and then making analysis on them (which proved to be unefficient) Thank you Marco Grazzi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html