Lapointe, Pierre
2007-Jan-16 16:37 UTC
[R] system(mysql... Does not recognize < as passing an attribute
Hi, This is my command line request: mysql -u root -ppassword -D quant <c:/cline.txt This line works from the command line in windows. In R, when I try to use the system function, it does not work,> system(paste('mysql -u root -ppassword -D quant<c:/cline.txt'),show.output.on.console = TRUE) ERROR 1102 (42000): Incorrect database name '<c:/cline.txt' It seems that the "<" caracter is not recognized as an attribute. Thanks, Pierre> version_ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 4.1 year 2006 month 12 day 18 svn rev 40228 language R version.string R version 2.4.1 (2006-12-18) ************************************************** AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}}
Prof Brian Ripley
2007-Jan-16 17:05 UTC
[R] system(mysql... Does not recognize < as passing an attribute
You are on Windows, and that is how system() works on Windows (not just in R, but in C, Perl ...). The help says command: the system command to be invoked, as a string. A command line is not a 'system command', and the < is interpreted by the shell you are running as your 'command line in WIndows'. Try shell() instead. On Tue, 16 Jan 2007, Lapointe, Pierre wrote:> Hi, > > This is my command line request: mysql -u root -ppassword -D quant > <c:/cline.txt > This line works from the command line in windows. > > In R, when I try to use the system function, it does not work, > >> system(paste('mysql -u root -ppassword -D quant > <c:/cline.txt'),show.output.on.console = TRUE) > ERROR 1102 (42000): Incorrect database name '<c:/cline.txt' > > It seems that the "<" caracter is not recognized as an attribute. > > Thanks, > > Pierre > >> version > _ > platform i386-pc-mingw32 > arch i386 > os mingw32 > system i386, mingw32 > status > major 2 > minor 4.1 > year 2006 > month 12 > day 18 > svn rev 40228 > language R > version.string R version 2.4.1 (2006-12-18) > > > ************************************************** > AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}} > > ______________________________________________ > R-help at 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 > and provide commented, minimal, self-contained, reproducible code. >-- Brian D. Ripley, ripley at 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, UK Fax: +44 1865 272595