Re: [R] RMySQL install on windows
Sorry for not taking care of this... If anyone would like to take over maintainership of RMySQL I'm sure the R community would greatly appreciate it. I just don't have the time these days. Jeff [[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.
[R] [R-pkgs] Rook: software and specification for R web applications and servers
Dear useRs, Rook version 1.0-3 has been submitted to CRAN. In the mean time you can get it here: https://github.com/jeffreyhorner/rRack/blob/master/Rook_1.0-3.tar.gz The latest release contains support for deployment with rApache. Please see 3.6.5 and 3.6.6 under section 'Configuring rApache' in the manual: http://www.rapache.net/manual.html#Configuring_rapache What is Rook? A package that does three things: - It provides a way to run R web applications on your desktop with the new internal R web server named Rhttpd. Please see the Rhttpd help page. - It provides a set of reference classes you can use to write you R web applications. The following help pages provide more information: Brewery, Builder, File, Middleware, Redirect, Request, Response, Static, URLMap, and Utils. Also see the example web applications located in 'system(exampleApps,package=Rook)'. - It provides a specification for writing your R web applications to work on any web server that supports the Rook specification. You may not see the need for web applications written in R, but consider using Rook to build a statistical engine that complements a front-end web system, or consider creating elegant ggplot2 graphics on-demand from a fresh data stream. Also, consider creating dynamic instructional content for the classroom. If you have other examples or ideas, please join in the discussion on R-help or here: http://groups.google.com/group/rrook -- Jeffrey Horner ___ R-packages mailing list r-packa...@r-project.org https://stat.ethz.ch/mailman/listinfo/r-packages __ 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] [R-pkgs] Rook: software and specification for R web applications and servers
Dear useRs, Rook is a new package that does three things: - It provides a way to run R web applications on your desktop with the new internal R web server named Rhttpd. Please see the Rhttpd help page. - It provides a set of reference classes you can use to write you R web applications. The following help pages provide more information: Brewery, Builder, File, Middleware, Redirect, Request, Response, Static, URLMap, and Utils. Also see the example web applications located in 'system(exampleApps,package=Rook)'. - It provides a specification for writing your R web applications to work on any web server that supports the Rook specification. Currently, only Rhttpd implements it, but rApache is close behind. See the Rook help page for more information. You may not see the need for web applications written in R, but consider using Rook to build a statistical engine that complements a front-end web system, or consider creating elegant ggplot2 graphics on-demand from a fresh data stream. Also, consider creating dynamic instructional content for the classroom. If you have other examples or ideas, please join in the discussion on R-help or here: http://groups.google.com/group/rrook -- Jeffrey Horner (author of rApache and brew) ___ R-packages mailing list r-packa...@r-project.org https://stat.ethz.ch/mailman/listinfo/r-packages __ 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] Plotting to stdout
Gábor Csárdi wrote: On Fri, Aug 28, 2009 at 1:33 PM, Gabor Grothendieckggrothendi...@gmail.com wrote: [...] I could have used this functionality in a previous project as well; however, for Oliver's application just pass the filename to the python program use that in the img src=... tag (or have the python program pass the filename to the R program). If there is some aspect of this problem that has not been explained that truly does make passing the graphic file contents to the python program desirable then have R write out the graphic file and then have R read it back in. Unfortunately, this is not always a good solution. For example, I am running Rserve with connections from untrusted users. The Rserve process is not allowed to write to the disk at all, but then there is no easy way to create plots. The patch Romain mentioned above looks like a good solution. The R connections patch worked well on Unix at the time, but it was never tested on the other R supported platforms. I believe this was R core's complaint about not considering it as a patch. There's yet another option, although someone would need knowledge of converting raw image data to PNG (or other) format in memory: the Cairo package allows access to the raw image data from R itself, although it's undocumented and experimental. The functions are defined in R/imgtools.R within the Cairo source package. Jeff __ 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] Adobe FLEX interacting with R for rich visualization over the Web
Harsh wrote on 04/23/2009 09:49 AM: Hi R users, I am looking to create a rich internet application using R as the analytical back-end with a GUI written entirely in Adobe FLEX. I have come across this paper http://www.bioconductor.org/packages/2.3/bioc/vignettes/RWebServices/inst/doc/RelatedWork.pdf which provides relevant information. From what I understand, FLEX can read xml files. The StatDataML library in R creates xml files which can be read by FLEX. Since I would need to implement the GUI on a web server and the R server would be on a different system, I felt using StatDataML to write xml files would be the best approach. I have also heard of the RSOAP library which possibly can be another alternative to the above library. I am trying to create a way for users to be able to visualize the results of regressions and other statistical functions in an interactive manner over the web. If anyone has worked with the above tools or related scenarios, I would greatly appreciate your feedback. You will be interested in the following links then: http://blog.revolution-computing.com/2009/04/find-a-safer-place-in-the-bay-area.html http://blog.revolution-computing.com/2009/04/comparing-baseball-pitcher-styles-with-lattice-graphics.html They provide examples of building web dashboards with R, which probably falls in the category of rich internet applications. Best, Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] Template Engine Package for R?
Jason Rupert wrote: Related to the posting below, by any chance is there a Template Engine package for R? Indeed there is. It's called brew: http://cran.r-project.org/web/packages/brew/index.html Jeff http://en.wikipedia.org/wiki/Template_processor This may make this type of editing much easier? Maybe... Thanks again. --- On Wed, 4/8/09, Jason Rupert jasonkrup...@yahoo.com wrote: From: Jason Rupert jasonkrup...@yahoo.com Subject: Re: [R] R File I/O Capability - Writing output to specific lines of existing file To: jim holtman jholt...@gmail.com Cc: R-help@r-project.org Date: Wednesday, April 8, 2009, 11:26 PM Darn. I was afraid of this. Always kind of weak when it comes to file I/O approaches, so I guess I will have to stretch and try to put something together. Yeah. The input flat text file is about 600 lines long. I will be replacing about 200. I already have the template for those 200 lines. I guess I will just need to read down to line 400 and replace until line 600. Thanks again for all the insights regarding this. --- On Wed, 4/8/09, jim holtman jholt...@gmail.com wrote: From: jim holtman jholt...@gmail.com Subject: Re: [R] R File I/O Capability - Writing output to specific lines of existing file To: jasonkrup...@yahoo.com Cc: R-help@r-project.org Date: Wednesday, April 8, 2009, 8:02 PM You can always read in the initialization file, make the updates to it and then write it back out. If it is a text file, it would be very hard to write into the middle of it since there is no structure to the file. You can read it in as a table (read.table) or just as lines (readLines) and the make any changes you want. You can use regular expressions if you want to put something in the middle of one of the lines you have read in. On Wed, Apr 8, 2009 at 10:13 AM, Jason Rupert jasonkrup...@yahoo.com wrote: Currently I am using the R writecommand to output results to a *.txt file and then copying those results into an initialization file. In an attempt to continue to automate the process I would like to have R write to the location in the existing initialization file, instead of me copying the data over. By any chance are there any R commands to help? Primarily, I will be using Windows, and the initialization file is a simple flat file, i.e. not XML or binary. I looked at: (a) http://www.stat.ucl.ac.be/ISdidactique/Rhelp/library/R.io/html/00Index.html (b) http://search.r-project.org/cgi-bin/namazu.cgi?query=File+I%2FOmax=100result=normalsort=scoreidxname=functionsidxname=Rhelp08 But, this did not appear to provide the functionality to edit an existing file by adding information to the middle of the file. Thank you again for any help and insight. __ 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. -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] [R-pkgs] New R graphics package targeting HTML 5 canvas element
Hi, canvas is a new R package implementing a graphics device that emits javascript code conforming to the HTML 5 CanvasRenderingContext2D interface. Available on CRAN soon, but you can get it here immediately: http://www.rforge.net/canvas If you have access to a beta web browser like Firefox 3.1 or later, you can see example plots here: http://www.rforge.net/canvas/plots/index.html Clicking on one of the plots will take you to a comparator page where the plot is rendered twice, once with the canvas package and once with the png(type='cairo') function. The implementation is almost complete, however there are some parts that need work like font metrics and dotted/dashed lines. If anyone is interested in helping flesh out the remaining bits, I'd be much obliged. Best, Jeff ___ R-packages mailing list r-packa...@r-project.org https://stat.ethz.ch/mailman/listinfo/r-packages __ 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] RMySQL compile
Try this: PKG_CPPFLAGS=-I/usr/mysql/5.0/include/mysql -I/opt/csw/include -I/usr/sfw/include -I/usr/X11/include-I/usr/lib/gtk-2.0/include -I/usr/local/include PKG_LIBS=-L/usr/sfw/lib -L/usr/lib -L/usr/local/lib -L/opt/csw/lib -lmysqlclient R CMD INSTALL RMySQL I had to refresh my memory from the inst/INSTALL file on how to do this. You might have to tweak it a bit, and also please send the full output of the command next time. Best, Jeff sten...@go.com wrote: I am trying to install RMySQL on OpenSolaris and need to pass some options to configure. Tried the 3 recommended ways of doing it and nothing works, configure cannot find the headers and the libs. I ran configure manually and that worked fine ./configureCC=ccCFLAGS=-dalign-KPIC-xlic_lib=sunperf LDFLAGS=-L/usr/sfw/lib -L/usr/lib -L/usr/local/lib -L/opt/csw/lib CPPFLAGS=-I/usr/local/lib/R/include-I/usr/mysql/5.0/include/mysql -I/opt/csw/include-I/usr/sfw/include-I/usr/X11/include -I/usr/lib/gtk-2.0/include -I/usr/local/include --with-mysql-inc=/usr/mysql/include/mysql --with-mysql-lib=/usr/mysql/lib/mysql checking mysql.h usability... yes checking mysql.h presence... yes checking for mysql.h... yes configure: creating ./config.status config.status: creating src/Makevars but then there is no makefile. Pls advise how to run make manually or help with the syntax: I tried with quotes after the second = and the first = and neither worked R CMD INSTALL --configure-args=CC=cc --configure-args=CFLAGS=-dalign -KPIC -xlic_lib=sunperf --configure-args=LDFLAGS=-L/usr/sfw/lib -L/usr/lib -L/usr/local/lib -L/opt/csw/lib --configure-args=CPPFLAGS=-I/usr/local/lib/R/include -I/usr/mysql/5.0/include/mysql -I/opt/csw/include -I/usr/sfw/include -I/usr/X11/include -I/usr/lib/gtk-2.0/include -I/usr/local/include --configure-args=--with-mysql-inc=/usr/mysql/include/mysql --configure-args=--with-mysql-lib=/usr/mysql/lib/mysql RMySQL_0.7-3.tar.gz ## does not work Stephen C. Bond __ 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. -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] RMySQL compile
sten...@go.com wrote on 03/31/2009 08:11 AM: Jeff, Thank you so much for responding. I am ready to do a lot of tweaking. From your message it looks like you are asking me to provide assignments on the same line as R CMD but precede the command. I am using bash and the usual thing would be to export those variables and then run R CMD. I tried that and configure ignores the variables. If you know where is the actual makefile then I could try to finish this without using R CMD. calling ./configure directly works ( R CMD INSTALL is the problem and I do not know how to look into that) bash is perfectly capable of running commands preceded with shell variables. Show the output, please. Otherwise I'm of no help. Best, Jeff Stephen C. Bond On Mar 31, 2009, *jeff.hor...@vanderbilt.edu* wrote: Try this: PKG_CPPFLAGS=-I/usr/mysql/5.0/include/mysql -I/opt/csw/include -I/usr/sfw/include -I/usr/X11/include-I/usr/lib/gtk-2.0/include -I/usr/local/include PKG_LIBS=-L/usr/sfw/lib -L/usr/lib -L/usr/local/lib -L/opt/csw/lib -lmysqlclient R CMD INSTALL RMySQL I had to refresh my memory from the inst/INSTALL file on how to do this. You might have to tweak it a bit, and also please send the full output of the command next time. Best, Jeff sten...@go.com wrote: I am trying to install RMySQL on OpenSolaris and need to pass some options to configure. Tried the 3 recommended ways of doing it and nothing works, configure cannot find the headers and the libs. I ran configure manually and that worked fine ./configureCC=ccCFLAGS=-dalign-KPIC -xlic_lib=sunperf LDFLAGS=-L/usr/sfw/lib -L/usr/lib -L/usr/local/lib -L/opt/csw/lib CPPFLAGS=-I/usr/local/lib/R/include -I/usr/mysql/5.0/include/mysql -I/opt/csw/include-I/usr/sfw/include -I/usr/X11/include -I/usr/lib/gtk-2.0/include -I/usr/local/include --with-mysql-inc=/usr/mysql/include/mysql --with-mysql-lib=/usr/mysql/lib/mysql checking mysql.h usability... yes checking mysql.h presence... yes checking for mysql.h... yes configure: creating ./config.status config.status: creating src/Makevars but then there is no makefile. Pls advise how to run make manually or help with the syntax: I tried with quotes after the second = and the first = and neither worked R CMD INSTALL --configure-args=CC=cc --configure-args=CFLAGS=-dalign -KPIC -xlic_lib=sunperf --configure-args=LDFLAGS=-L/usr/sfw/lib -L/usr/lib -L/usr/local/lib -L/opt/csw/lib --configure-args=CPPFLAGS=-I/usr/local/lib/R/include -I/usr/mysql/5.0/include/mysql -I/opt/csw/include -I/usr/sfw/include -I/usr/X11/include -I/usr/lib/gtk-2.0/include -I/usr/local/include --configure-args=--with-mysql-inc=/usr/mysql/include/mysql --configure-args=--with-mysql-lib=/usr/mysql/lib/mysql RMySQL_0.7-3.tar.gz ## does not work Stephen C. Bond __ 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. -- http://biostat.mc.vanderbilt.edu/JeffreyHorner -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] popular R packages
Dirk Eddelbuettel wrote: On 8 March 2009 at 13:27, Duncan Murdoch wrote: | But we don't even have that data, since CRAN is distributed across lots | of mirrors. On 8 March 2009 at 19:01, Emmanuel Charpentier wrote: | As far as I can see (but I might be nearsighted), I see no model linking | package download to package use(s). Data may or may not become available Which is why Debian (and Ubuntu) use the _opt-in package_ popularity-contest that collects data on packages used and submits that to a host collecting the data. This drives the so-called 'popcon' statistics. Yes, and there are many ways in which one can criticise this data collection process. But I fail to see how __not having any data__ leads to more informed decisions. Once you have data, you have an option of using or discarding it. But if you have no data, you have no option. How is that better? I've also created a package named PopCon here: http://biostat.mc.vanderbilt.edu/twiki/pub/Main/JeffreyHorner/PopCon_0.1.tar.gz I provided it to the list many months ago and got no response on it's implementation or use. I encourage anyone to download it and understand how it can be used to implement a popularity contest for both packages and even functions and such. Maybe R can sponsor a Popularity Contest day where everyone is encouraged to download the package and push some data to r-project.org or even crantastic.org that notes what useRs currently have loaded on their search path... Best, Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] Problem with library(RMySQL), registry pointer problem?
Yakub wrote: I have the following error: library(RMySQL) Error in fun(...) : A MySQL Registry key was found but the folder C:\Program Files\MySQL\MySQL Tools for 5.0\/. doesn't contain a bin or lib/opt folder. That's where we need to find libmySQL.dll. Error : .onLoad failed in 'loadNamespace' for 'RMySQL' Error: package/namespace load failed for 'RMySQL' This happens after I install MySQL Tools. Seems that R is pointing to the wrong registry. Can anyone help? You need to install the client programs and libraries when you install the MySQL distribution. Just re-run the MySQL installer again and be sure to read the steps carefully. Best, Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] Help with R and MySQL
Aaron Barzilai wrote: Hello, This forum has been very helpful to me in the past, and I've run out of ideas on how to solve my problem. I had been using R and MySQL (and Perl) together for quite some time successfully on my Windows XP machine. However, I recently had some problems with MySQL (the ibdata file had become 35GB on my hard drive, turns out it's a known bug with InnoDB), and ultimately the way I fixed my problem with MySQL was to upgrade it. It's working fine now, I can use MySQL however I'd like. I'm sticking to MyISAM tables for now, though. However, I had set up my system so I did a linear regression in R. Originally, this was done in R 2.5.0, I would load in the tables from MySQL to R and then conduct the regression in R. However, after solving my MySQL problem, I ran into a strange error in R (and DBI/RMySQL). R connected to the database just fine, and I could even show the tables in the database and load two of them into R. However, the tables I loaded successfully were only a single column. Every time I tried to load in a recordset that was multiple columns, I got a relatively nondescript Windows error(R for Windows terminal front-end has encountered a problem and needs to close. We are sorry for the inconvenience.). To verify that it wasn't a memory issue, I even tried rs - dbSendQuery(con, select 'a', 'b'). This statement causes the error as well. I tried upgrading the packages, and upgrading R from 2.5.0 to 2.8.1. However, I still get the same errors. Has anyone run into this problem before? Any suggestions on how to solve it? Hi Aaron, Be sure to read the details of the RMySQL web page: http://biostat.mc.vanderbilt.edu/RMySQL You need to make sure and match the version of your MySQL client library (not the running MySQL server) with the RMySQL binary that you choose from the web page above. Best, Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] [R-pkgs] RMySQL 0.7-3
Dear R users, RMySQL 0.7-3 has been released. Expect it to hit the CRAN mirrors shortly, but in the mean time please get it here: http://biostat.mc.vanderbilt.edu/RMySQL From the NEWS file: Version 0.7-3 * Added mysqlClientLibraryVersions() which returns the compiled and loaded client library versions as a vector. * RMySQL will now check for MySQL minor version consistency and throw an error when the client and loaded library versions don't match. Best, Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner ___ R-packages mailing list r-packa...@r-project.org https://stat.ethz.ch/mailman/listinfo/r-packages __ 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] Problem installing RMySQL (S4R.h:40:17: error: S.h: No such file or directory?)
Dan Bolser wrote: Hi, I'm trying to install RMySQL and I keep hitting errors. My computer is: uname -a Linux cricket 2.6.18-92.1.22.el5PAE #1 SMP Tue Dec 16 12:36:25 EST 2008 i686 i686 i386 GNU/Linux I have set the following environment settings: export PKG_LIBS=-L/usr/lib/mysql -lmysqlclient export PKG_CPPFLAGS=-I/usr/include/mysql I run the following command: R CMD INSTALL --library $HOME/R/i386-redhat-linux-gnu-library/2.7 RMySQL_0.7-2.tar.gz Hi Dan, You will certainly want to upgrade R first. The latest version is R 2.8.1. Jeff And I get the output below. Can anyone help me with this? What additional system details can I send? Thanks very much for any tips. Dan. R CMD INSTALL --library $HOME/R/i386-redhat-linux-gnu-library/2.7 RMySQL_0.7-2.tar.gz * Installing *source* package 'RMySQL' ... checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking how to run the C preprocessor... gcc -E checking for compress in -lz... yes checking for getopt_long in -lc... yes checking for mysql_init in -lmysqlclient... no checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking mysql.h usability... no checking mysql.h presence... no checking for mysql.h... no configure: creating ./config.status config.status: creating src/Makevars ** libs gcc -m32 -std=gnu99 -I/usr/include/R -I/usr/include/mysql -I/usr/local/include-fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -c RS-DBI.c -o RS-DBI.o In file included from RS-DBI.h:32, from RS-DBI.c:22: S4R.h:40:17: error: S.h: No such file or directory S4R.h:53:24: error: Rversion.h: No such file or directory S4R.h:54:51: error: missing binary operator before token ( S4R.h:62:26: error: Rdefines.h: No such file or directory S4R.h:154:49: error: missing binary operator before token ( S4R.h:176:49: error: missing binary operator before token ( In file included from RS-DBI.c:22: RS-DBI.h:100: error: expected specifier-qualifier-list before 'SEXPTYPE' RS-DBI.h:170: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:173: error: expected ')' before '*' token RS-DBI.h:174: error: expected ')' before '*' token RS-DBI.h:175: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:176: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:179: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:181: error: expected ')' before '*' token RS-DBI.h:182: error: expected ')' before '*' token RS-DBI.h:183: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:184: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:187: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:188: error: expected ')' before '*' token RS-DBI.h:189: error: expected ')' before '*' token RS-DBI.h:190: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:191: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:194: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:195: error: expected ')' before '*' token RS-DBI.h:213: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:220: error: expected ')' before '*' token RS-DBI.h:224: error: expected ')' before '*' token RS-DBI.h:231: error: expected ')' before '*' token RS-DBI.h:251: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:253: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:257: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:259: error: expected declaration specifiers or '...' before 'SEXPTYPE' RS-DBI.h:260: error: expected declaration specifiers or '...' before 'SEXPTYPE' RS-DBI.c:36: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.c:109: error: expected ')' before '*' token RS-DBI.c:137: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.c:207: error: expected ')' before '*' token RS-DBI.c:261: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.c:309: error: expected ')'
Re: [R] RCurl unable to download a particular web page -- what is so special about this web page?
Duncan Temple Lang wrote: clair.crossup...@googlemail.com wrote: Dear R-help, There seems to be a web page I am unable to download using RCurl. I don't understand why it won't download: library(RCurl) my.url - http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html?_r=2; getURL(my.url) [1] I like the irony that RCurl seems to have difficulties downloading an article about R. Good thing it is just a matter of additional arguments to getURL() or it would be bad news. Don't forget the irony that https is supported in url() and download.file() on Windows but not UNIX... http://tolstoy.newcastle.edu.au/R/e2/devel/07/01/1634.html Jeff The followlocation parameter defaults to FALSE, so getURL(my.url, followlocation = TRUE) gets what you want. The way I found this is getURL(my.url, verbose = TRUE) and take a look at the information being sent from R and received by R from the server. This gives * About to connect() to www.nytimes.com port 80 (#0) * Trying 199.239.136.200... * connected * Connected to www.nytimes.com (199.239.136.200) port 80 (#0) GET /2009/01/07/technology/business-computing/07program.html?_r=2 HTTP/1.1 Host: www.nytimes.com Accept: */* HTTP/1.1 301 Moved Permanently Server: Sun-ONE-Web-Server/6.1 Date: Mon, 26 Jan 2009 16:10:51 GMT Content-length: 0 Content-type: text/html Location: http://www.nytimes.com/glogin?URI=http://www.nytimes.com/2009/01/07/technology/business-computing/07program.htmlOQ=_rQ3D3op=42fceb38q2fq5duarq5d3-z8q26--q24jq5djccq7bq5dcmq5dc1q5dq24...@-f-q2anq5dry8h@a88q3dz-dbyq...@q2aq5dc1bq26-q2aq26q5bddfq24df And the 301 is the critical thing here. D. Other web pages are ok to download but this is the first time I have been unable to download a web page using the very nice RCurl package. While i can download the webpage using the RDCOMClient, i would like to understand why it doesn't work as above please? library(RDCOMClient) my.url - http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html?_r=2; ie - COMCreate(InternetExplorer.Application) txt - list() ie$Navigate(my.url) NULL while(ie[[Busy]]) Sys.sleep(1) txt[[my.url]] - ie[[document]][[body]][[innerText]] txt $`http://www.nytimes.com/2009/01/07/technology/business-computing/ 07program.html?_r=2` [1] Skip to article Try Electronic Edition Log ... Many thanks for your time, C.C Windows Vista, running with administrator privileges. sessionInfo() R version 2.8.1 (2008-12-22) i386-pc-mingw32 locale: LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom. 1252;LC_MONETARY=English_United Kingdom. 1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] RDCOMClient_0.92-0 RCurl_0.94-0 loaded via a namespace (and not attached): [1] tools_2.8.1 __ 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-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-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] .Renviron for multiple hardwares...
Jonathan Greenberg wrote: Our lab has a lot of different unix boxes, with different hardware, and I'm assuming (perhaps wrongly) that by setting a per-user package installation directory, the packages will only work on one type of hardware. Our systems are all set up to share the same home directory (and, thus, the same .Renviron file) -- so, is there a way to set, in the .Renviron file, per-computer or per-hardware settings? The idea is to have a different package installation directory for each computer (e.g. ~/R/computer1/packages and ~/R/computer2/packages. Thoughts? Ideas? Thanks! You would certainly want to look at altering the library path on R startup using the RProfile.site file (see ?Startup). You R code could use bits of info from the R variables .Platform and .Machine, plus some environment variables for UNIX platform info. As an example of altering the library path, this is what I have used in the past for my personal .Rprofile file: ### Add development R versions to the library path first devlib - paste('~/Rlib',gsub(' ','_',R.version.string),sep='/') if (!file.exists(devlib)) dir.create(devlib) x - .libPaths() .libPaths(c(devlib,x)) rm(x,devlib) So when I start up the latest development version of R, this is what is set: $ /home/hornerj/R-sources/trunk/bin/R --quiet .libPaths() [1] /home/hornerj/Rlib/R_version_2.9.0_Under_development_(unstable)_(2008-10-14_r46718) [2] /home/hornerj/R-sources/trunk/library But with the latest ubuntu R release: $ R --quiet .libPaths() [1] /home/hornerj/Rlib/R_version_2.8.1_(2008-12-22) [2] /usr/local/lib/R/site-library [3] /usr/lib/R/site-library [4] /usr/lib/R/library Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] Problems with RMySQL and MySQL server version 5.1
For those R user's who don't subscribe to R-sig-db and are having troubles with the latest RMySQL binary on CRAN, please read the email thread at the end of this message. RMySQL 0.7-2 does work with MySQL 5.1, however the CRAN binary is linked against the 5.0 version. Best, Jeff Original Message Subject: Re: [R-sig-DB] Problems with RMySQL and MySQL server version 5.1 Date: Wed, 07 Jan 2009 16:36:48 + From: Prof Brian Ripley rip...@stats.ox.ac.uk To: Jeffrey Horner jeff.hor...@vanderbilt.edu CC: r-sig...@stat.math.ethz.ch References: 4964cd3d.9000...@vanderbilt.edu There is a long, long history of precisely this (version mismatches in MySQL binaries cause crashes). We had it at 4.x, so I am not surprised to see it at 5.x now 'x' is no longer unique. When I distributed binaries, the README on my site pointed this out: I suggest you ask Uwe to put it in his README, and if possible do a version check at run time. Jeffrey Horner wrote: An FYI to those users having problems with windows RMySQL CRAN binaries. Original Message Subject: Problems with RMySQL and MySQL server version 5.1 Date: Wed, 7 Jan 2009 09:12:56 +0100 From: Erik Jørgensen erik.jorgen...@agrsci.dk To: jeff.hor...@vanderbilt.edu Hi Jeffrey I have some problems with the use of RMySQL since upgrading to RMySQL version 0.7-2 and MySQL server version 5.1. The RGUI crashes, when I e.g. call the function dbGetQuery(conn, sqlstring) (but not e.g. dbListTables(conn)). It seems that it is due to incompatibility with MySQL version 5.1. When I replace the libMySQL.dll file from version 5.1 with the 5.0 version of the file, the problem disappears. Best regards Erik Jørgensen Faculty of Agricultural Sciences, Aarhus University, Denmark PS. R - version 2.8.1 - Windows XP Professional Service Pack3. I specify the path to the DLL-file manually via the environment variable MYSQL_HOME. -- 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 -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] package install error in CentOS
Check that your data partitions have the 'exec' flag set in /etc/fstab, particulary the /tmp partition: http://www.centos.org/modules/newbb/viewtopic.php?topic_id=1687forum=31 Jeff Jeroen Ooms wrote: I am trying to install package Cairo on CentOS 5.2, but I keep getting this error: * Installing *source* package 'Cairo' ... /usr/lib64/R/bin/INSTALL: ./configure: /bin/sh: bad interpreter: Permission denied ERROR: configuration failed for package 'Cairo' ** Removing '/usr/lib64/R/library/Cairo' The downloaded packages are in /tmp/Rtmp8ML568/downloaded_packages Updating HTML index of packages in '.Library' Warning message: In install.packages(Cairo) : installation of package 'Cairo' had non-zero exit status I tried to do it manually but with no luck: [jer...@138 shizzle]$ sudo R CMD INSTALL Cairo_1.4-4.tar.gz * Installing to library '/usr/lib64/R/library' * Installing *source* package 'Cairo' ... /usr/lib64/R/bin/INSTALL: ./configure: /bin/sh: bad interpreter: Permission denied ERROR: configuration failed for package 'Cairo' ** Removing '/usr/lib64/R/library/Cairo' I have tried to changing the $TMPDIR to another dir, and giving it 777 permissions, but I keep getting the error. Some info: sessionInfo() R version 2.8.0 (2008-10-20) x86_64-redhat-linux-gnu locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base [jer...@138 shizzle]$ gcc --version gcc (GCC) 4.1.2 20071124 (Red Hat 4.1.2-42) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. __ 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] understanding recursive functions
joseph.g.bo...@gsk.com wrote on 12/18/2008 04:22 PM: I'm trying to understand the use of recursive functions described on page 45 of An Introduction to R by the R core development team. A function is a list of expressions, which all get executed with only the last being assigned to a global variable, right? So if a function refers recursively to itself, it should simply start with the first expression and go from there. At least that is my understanding of why the example given on page 45 works. In light of the above, I would appreciate it if someone would understand why the following example does not work: q - function(x,h) {if (x 2) {x - x+1; return(q(x))} else return(x)} If x 1, this should add 1 to x and go back to the beginning of the if expression, and the final result should be 2. So q(0) should return 2. But it returns an error message. All references to x save one (the assignment with the - operator) are found within the current frame, not by lexical scoping, and hence is never changed... producing infinite recursion. The following at least fixes your example: All references to x save one (the assignment with the - operator) are found within the current frame, not by lexical scoping, and hence is never changed... producing infinite recursion. The following at least fixes your example: q - function(x,h) {if (x 2) {x - x+1; x - x+1; return(q(x))} else return(x)} ls() # no x in global env just yet q(-10) ls() Jeff Joe Boyer Statistical Sciences Renaissance Bldg 510, 3233-D Mail Stop RN0320 8-275-3661 cell: (610) 209-8531 [[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. -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] [R-pkgs] RMySQL 0.7-2 now available on CRAN
Dear R users, RMySQL 0.7-2 is now available on CRAN: http://cran.r-project.org/web/packages/RMySQL/index.html From the NEWS file: * New maintainer is Jeffrey Horner [EMAIL PROTECTED]. * We no longer distribute libmysql.dll. This library is now found either by reading the MYSQL_HOME environment variable or by reading the windows registry entries. * Removed dependence on MySQL C function load_defaults() as it was meant for command-line tools, not for (re)connecting to a database. * Fixed \r issue with dbWriteTable(). * Tests have been added and depend on proper values set in the environment variables MYSQL_DATABASE, MYSQL_USER, and MYSQL_PASSWD. Best, Jeff ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ 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] How to avoid $ operator is invalid for atomic vectors
cruz wrote on 11/06/2008 12:16 PM: Thanks for all the responses, they are all very helpful:) you don't need to assign dimension or classes to your objects. It's easier if you do like this this is something that really bothers me, when I need to define an object which i will later fill with data, the dimension of this object should not be fixed because it will grow... so in MATLAB, i.e. we define x = [ ], what about in R? ?numeric, ?character, others probably... x - numeric() x[10] - 42 print(x) [1] NA NA NA NA NA NA NA NA NA 42 Does that answer your question? Jeff Thanks, cruz __ 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. -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] Getting frustrated with RMySQL
Ted Byers wrote on 10/14/2008 02:33 PM: Getting the basic stuff to work is trivially simple. I can connect, and, for example, get everything in any given table. What I have yet to find is how to deal with parameterized queries or how to do a simple insert (but not of a value known at the time the script is written - I ultimately want to put my script into a scheduled task, so the analysis can be repeated on updated data either daily or weekly). Using INSERT INTO myTable (a) VALUES (1) is simple enough, but what if I want to insert a sample number (using, e.g. WEEK(sample_date) as a sample identifier) along with the rate parameter estimated using fitdistr to fit an exponential distribution to a dataset, along with its sd? If I were using Perl or Java, I'd set up the query similar to INSERT INTO myTable (a,b,c) VALUES (?,?,?), and then use function calls to set each of the query parameters. I am having an aweful time finding the corresponding functions in RMySQL. I've found the best way to parameterize is using R's sprintf function. For instance, the following query not only parameterizes the variable position, but also the table name: fields - dbGetQuery(con,sprintf(select field,elem_label from %s_meta where field='%s',inp$pnid,inp$field)) Best, Jeff And for the data, the simplest, and most efficient, way to get the data is to use a statement like: SELECT a,b,c FROM myTable GROUP BY g_id, WEEK(sdate); The data is in MySQL, and my analysis needs to be applied independantly to each group obtained from a query like this. It appears I can't use a data frame since none of the samples are of the same size (lets say the probability of the samples being the same size in indistinguishable from 0). Is it possible to put the resultset from such a query into a list of vectors that I can iterate over, passing each vector to fitdistr in turn? If so, how? I know I can get this using Perl (by getting each sample individually and writing it to a file, then having R read the file, do the analysis and write the output to another file, and then have Perl parse the output file to insert the parameter estimates I need into the appropriate table), but that seems inefficient. Is it possible to do all I need with R working directly with MySQL? If so, can someone fill in the apparent gaps left in the RMySQL documentation? Thanks. Ted -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] Getting frustrated with RMySQL
Barry Rowlingson wrote on 10/14/2008 04:40 PM: 2008/10/14 Jeffrey Horner [EMAIL PROTECTED]: I've found the best way to parameterize is using R's sprintf function. For instance, the following query not only parameterizes the variable position, but also the table name: fields - dbGetQuery(con,sprintf(select field,elem_label from %s_meta where field='%s',inp$pnid,inp$field)) And thus a million web SQL injection exploits were born... Even if you do have control over the parameters to the query, you still have to worry about quotes or other nasty escape characters in your string ending up in the SQL. I hope little Bobby Tables isn't a subject in your analysis: Thank goodness I don't do analysis, as I haven't the schooling. Barry, I'm ashamed of you! I was hoping you'd at least offer an alternative. http://xkcd.com/327/ Okay, you are pardoned: I LOVE xkcd! Especially this one: http://xkcd.com/349/ Best, Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] RApache
lamack lamack wrote: Dear all, I have a question about RApache. Is it possible install it under XAMPP server? I would like of some directions. Is it needed install the R before? As long as your XAMPP server runs some variant of UNIX, rapache should install. and Yes, you should install R first. Best, Jeff Best regards. _ Confira vídeos com notícias do NY Times, gols direto do Lance, vide[[elided Hotmail spam]] __ 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. -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] Possible R graphics devices
Hello all, I've been working on a new R Graphics device that targets Adobe's Shockwave Flash format (SWF for short). It uses http://www.libming.org/ on the backend. Here are some example outputs so far: http://160.129.129.41/~hornerj/plots/ Once you click on the above, choose a directory like 'smooth' and then click on test.html to see a side-by-side comparison of the swf file with the png equivalent. Fonts aren't working yet (but they will), and libming doesn't support dashed lines either, so there are some areas upon which to improve. My goal is to support limited interactivity in the form of popup labels for key data points. Maybe someone has some other ideas? Also, there's a fascinating new project that aims to create interactive graphics within the HTML canvas tag using the Processing.js javascript library. It's quite eye-opening: http://ejohn.org/blog/processingjs I believe an R graphics device could target javascript as well! Thoughts? Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] X11 plotting error
Hmmm... the short answer is that your call to png() is requiring X11 to generate the plot. Don't know what version you're running, but prior to R 2.7.0, all png() calls needed access to the X server to create the plots (on Unix). But with 2.7.0 and later, png() can be called with type='cairo' to generate plots without X11 intervention. If you're running an earlier version of R and you can't upgrade, then you could install the Cairo package which supports png output without X11 intervention. Best, Jeff cls59 wrote: Hey everyone, I'm part of a team working at NOAA and we have developed a swan script that analyzes data and generates plots for the forecasters. We are ready to put the script on the cron and call it a summer but a technical issue has popped up which has us puzzled. When we run the script as an unprivileged user, it bails when png() gets called to open a device for the output. The error is unable to open connection to X 11 display ' ': When we run the script as root, everything works like a charm. The user has ownership of the plotting directories where the script drops it's output. The unprivileged user can run R interactively, but use of x11() or any other plotting commands fail. Any Linux users out there who might have any ideas on how to straighten this out? We are using Red Hat Enterprise 4. -Chuck -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] aligned memory allocation in C
Christophe Dutang1 wrote: Hi, I'm currently R porting SF Mersenne Twister algorithm of Matsumoto and Saito. To get the full power of their code, I want to use their fonction fill_array32 which need aligned memory. That is to say I need to use the C function memalign on windows, posix_memalign on linux and classic malloc on Mac OS. In 'writing R extenstion', they recommand to use R_alloc function to allocate memory in C. Does R_alloc return a pointer to aligned memory? if not how can I do this? probably no, because R crashes when I succesively R_alloc and fill_array32 (cf below) on my macbook with R 2.7.1. You can still do this. Just take the address returned from R_alloc and test for alignment. If it's not, then just use an aligned address beyond the one returned. (But then the question is, which direction beyond the one returned? How does one test for that?) Jeff Thanks in advance Kind regards Christophe PS : http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/howto-compile.html provides an example of memalign. PPS : mac os report Thread 0 Crashed: 0 libSystem.B.dylib 0x9341bb9e __kill + 10 1 libSystem.B.dylib 0x93492ec2 raise + 26 2 libSystem.B.dylib 0x934a247f abort + 73 3 randtoolbox.so0x15e65f1d 0x15e5d000 + 36637 4 randtoolbox.so0x15e614ef fill_array32 + 4038 5 randtoolbox.so0x15e6513d SFmersennetwister + 335 6 randtoolbox.so0x15e652c6 doSFMersenneTwister + 255 7 libR.dylib0x00367a52 do_dotcall + 1394 8 libR.dylib0x0038b5a2 Rf_eval + 1754 9 libR.dylib0x0038f9a2 do_set + 592 10 libR.dylib0x0038b366 Rf_eval + 1182 11 libR.dylib0x0038b366 Rf_eval + 1182 12 libR.dylib0x0038c140 do_begin + 58 13 libR.dylib0x0038b366 Rf_eval + 1182 14 libR.dylib0x0038b366 Rf_eval + 1182 15 libR.dylib0x0038c140 do_begin + 58 16 libR.dylib0x0038b366 Rf_eval + 1182 17 libR.dylib0x0038d9a6 Rf_applyClosure + 663 18 libR.dylib0x0038b25d Rf_eval + 917 19 org.R-project.R 0x000189c3 run_REngineRmainloop + 569 (Rinit.m:442) 20 org.R-project.R 0x0001142a -[REngine runREPL] + 260 (REngine.m:181) 21 org.R-project.R 0x2e91 main + 795 (main.m:126) 22 org.R-project.R 0x2b5a _start + 216 23 org.R-project.R 0x2a81 start + 41 __ 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. -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] 'system' command through Rserve
This probably has to do with your ssh configuration and nothing to do with R. How are you starting Rserve? Is it run with the same user privileges as when you run R manually? Best, Jeff Patil, Prasad wrote on 07/31/2008 02:51 PM: Hello, I've installed an Rserve instance on a remote server. I have no problem interfacing with it and running most commands. I have loaded some R scripts on the remote server, and one of them contains a system command to copy a file (created by the script) onto another server. When I run the script on the remote server itself, the script works as I intend: it creates a .csv file and uses scp to copy it onto another server. When I run the script remotely (through an Rconnection in Java), the .csv is created but the file is not copied onto the other server. Is there any reason why a system command would work when called locally but not when called remotely? The format is as follows: # create array write.csv(array, array.csv) system(scp /{path}/array.csv {remote server}:/{path2}) Again, the script works correctly when run through R on the remote server, but when I run it through Rserve, everything works except for the 'system' command. Any insights would be greatly appreciated. Thanks a lot, Prasad [[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. -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] environment question
Edna Bell wrote: Hi R users! I was looking at some of the example code for the environment function. Here it is: e1 - new.env(parent = baseenv()) # this one has enclosure package:base. e2 - new.env(parent = e1) assign(a, 3, envir=e1) ls(e1) ls(e2) exists(a, envir=e2) # this succeeds by inheritance exists(a, envir=e2, inherits = FALSE) exists(+, envir=e2) # this succeeds by inheritance My question is: how can a exist in e2 when the ls(e2) gives character(0), please? It actually doesn't. From the code above here's the inheritance tree for the environments: baseenv() = e1 = e2 When you call exists() on the e2 environment, it actually fails. However since the inherits flag is TRUE by default, exists() searches through the inherited environments and finds a in e1. So, exists will tell you that it found a, just not where it found a. However, if you set inherits=FALSE, then exists() searches only in the specified environment. HTH Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] ANNOUNCE: rapache 1.1.0 release
Hello, First presented at DSC2005, rapache is a project supporting web application development using the R statistical language and environment and the Apache web server. The current release runs on UNIX/Linux and Mac OS X operating systems. http://biostat.mc.vanderbilt.edu/rapache/ rapache 1.1.0 now supports Apache threaded web servers, but the Apache Prefork Multi-Processing Module is still recommended. Please see: http://httpd.apache.org/docs/2.2/mpm.html for details about Multi-Processing Modules. Thanks, Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] Font quality in base graphics
willemf wrote on 07/15/2008 08:42 AM: I am attempting to get publication quality graphs using R on Ubuntu. I encounter lots of problems in using cex to control font size: for instance cex=1.5 results in very blocky characters. I then tried to use res=1200 while creating a PNG file, hoping that this would solve the problem, but it did not. When doing the above, a second problem appeared: the font size relative to the graphics decreased drastically. e.g. png(t1.png, res=1200, width=1200, height=1200). Is anyone prepared to give me a pointer of where to read about precise control over font type and font size in base graphics? I have two books on R graphics but this aspect is never treated in detail in any of them. Kind regards, willemf. You may find some help with the Cairo package, which allows one to select desired truetype and opentype fonts using the fontconfig library. Be sure to thoroughly read the CairoFonts and CairoFontMatch help pages to learn how to carefully select your fonts. The benefit of using Cairo is that your png graphics have a better chance of looking exactly like your pdf graphics since Cairo embeds the fonts into the pdf by default. Knowing which journal you're publishing in and their graphic requirements would be helpful to further solve your problem. Some researchers here at Vanderbilt have had success saving graphics as pdf's (with or without Cairo), then either using gimp or the imagemagic command convert to upscale the graphic to a desired dpi setting. Best, Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] Sweave: looping over mixed R/LaTeX code
Stephan Kolassa wrote on 06/13/2008 03:22 AM: Dear guRus, I would like to loop over a medium amount of Sweave code, including both R and LaTeX chunks. Is there any way to do so? As an illustration, can I create a .tex file like this using a loop within a .Rnw file, where the 1,2,3 comes from some iteration variable in R? \documentclass{article} \usepackage{Sweave} \begin{document} Iteration 1 Iteration 2 Iteration 3 \end{document} Another alternative would be to use the brew package from CRAN: http://cran.r-project.org/web/packages/brew/index.html While the disadvantage would be a change of syntax from Sweave to brew, you would gain the advantage of looping over code chunks. brew also installs a collection of example files, one being a conversion of the Sweave test file to brew. Scope out the 'Examples' section from the brew help page. Best, Jeff Right now, I do have a working but painful solution. I put the loop contents in a separate loop.Rnw file, then: 1. run everything before the loop through R for initialization 2. Sweave loop.Rnw; shell(move loop.tex loop_1.tex) Sweave loop.Rnw; shell(move loop.tex loop_2.tex) ... Sweave loop.Rnw; shell(move loop.tex loop_n.tex) 3. \input all loop_i.tex files into master.Rnw and Sweave master.Rnw This does what I need, however, it is a major pain code-wise, e.g., there appears to be no way to control the loop during execution (n must be known in advance), and I need to control all graphics using \includegraphics with the iteration counter paste()d into the filename. An alternative may be not using Sweave and working with one giant sink() and lots of print()s, letting R just write the entire .tex file. This also appears inelegant to me. Is there a better way to do this? I have tried to do my homework, see below. Do I get partial credit ;-) ? Thank you all for your time! Stephan # I can't simply start a for loop within an R chunk and finish it in another one. whiledo in the ifthen.sty package doesn't like Sweave at all. And of course, it would simply reuse the R chunks if it did work, without changing things between loops. For the same reason, I cannot define a \newcommand{\loopcontent}{...} with the entire loop contents and then simply write \loopcontent \loopcontent ... or \input or \include the loop content from an external file. Of course it would be possible to not use Sweave and just use the output from the R console, but there are a couple of figures I would really like to see close to the relevant portions of the calculations. I also thought about putting the entire loop in *one* R chunk, but then I see no way to include LaTeX chunks *within* this R chunk. I can't just sink() to the .tex file in the middle of the R chunk (as the sink() gets appended to the .tex file only after Sweave is done with it). I have read the Sweave manual and FAQs and the R/R Windows FAQ, I did both RSiteSearches and RSeek searches for all combinations of Sweave and loop, for, while I could think of. For what it's worth, here's my sessionInfo(): R version 2.7.0 (2008-04-22) i386-pc-mingw32 locale: LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252 attached base packages: [1] stats graphics grDevices utils datasets tcltk methods base other attached packages: [1] svIDE_0.9-5 loaded via a namespace (and not attached): [1] svMisc_0.9-5 -- __ 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. -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] Calling R from C - part way there but need a push!
Maximillian Murphy wrote on 04/29/2008 11:19 AM: Dear All, I've read the manual on Writing R Extensions and in particular the part on calling R from C. (Most of the manual is about calling C from R, not the other way around.) The good news is that I can now call _some_ R from C, specifically the R functions which have C header files. However it isn't clear to me how to call R functions that are written in R. I imagine that there is a standard C function of the form Call_r_from_C(package name, Rfunction name as a string, arg1, arg2, ...); where arg1 etc are standardised ways of representing R data structures in C. However I haven't been able to find such a function prototype in the R include/*.h files. See footnote (1). Can you point me in the right direction please? Is there a set of examples somewhere that I can peruse? Does R keep any state when being called from C? Should I think of it as being a co-process, so I can make consecutive calls to it and expect it to remember previous calls? I'm thinking of a sequence of calls such as load library, load R code from a file of my own, set value of x, make a call and read the values back into my C program? Help is much appreciated. I would recommend studying the examples found in the tests/Embedding directory from the R sources. For instance, the following is from RNamedCall.c: /* Call the function foo() with 3 arguments, 2 of which are named. foo(pch=+, id = 123, c(T,F)) Note that PrintValue() of the expression seg-faults. We have to set the print name correctly. */ void bar1() { SEXP fun, pch; SEXP e; PROTECT(e = allocVector(LANGSXP, 4)); fun = findFun(install(foo), R_GlobalEnv); if(fun == R_NilValue) { fprintf(stderr, No definition for function foo. Source foo.R and save the session.\n); UNPROTECT(1); exit(1); } SETCAR(e, fun); SETCADR(e, mkString(+)); SET_TAG(CDR(e), install(pch)); SETCADDR(e, ScalarInteger(123)); SET_TAG(CDR(CDR(e)), install(id)); pch = allocVector(LGLSXP, 2); LOGICAL(pch)[0] = TRUE; LOGICAL(pch)[1] = FALSE; SETCADDDR(e, pch); PrintValue(e); eval(e, R_GlobalEnv); SETCAR(e, install(foo)); PrintValue(e); R_tryEval(e, R_GlobalEnv, NULL); UNPROTECT(1); } Best, Jeff Regards, Max (1) The most likely include file is Rinterface.h and within that the most likely candidates seem to be: extern int (*ptr_R_ReadConsole)(const char *, unsigned char *, int, int); extern void (*ptr_R_WriteConsole)(const char *, int); extern void (*ptr_R_WriteConsoleEx)(const char *, int, int); but it turns out that they assume that R is running the terminal and these are requests to R to display or read from R's console. R isn't acting as the back end being given work and returning answers. (2) Googling calling r from c yields precisely five hits, most of which just point back at the R extensions document with vague It's in there somewhere's. I've looked! (3) Leads suggested by help.search(C) Foreign(base): Foreign Function Interface Functions to make calls to compiled code that has been loaded into R. .Internal(base) Call an Internal Function '.Internal' performs a call to an internal code which is built in to the R interpreter. Only true R wizards should even consider using this function, and only R developers can add to the list of internal functions. (Definitely not me!) .Primitive(base)Call a Primitive Internal Function The advantage of '.Primitive' over '.Internal' functions is the potential efficiency of argument passing. (4) R code that I have called successfully is that with prototypes defined in e.g. include/R_ext/Applic.h __ 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. -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] XML write?
Alberto Monteiro wrote on 04/29/2008 08:37 AM: Is there any function to write a XML structure, after it was read using xmlTreeParse? Ex: library(XML) x - xmlTreeParse(Irpf2008/aplicacao/dados/12345678901/12345678901.xml) # write it... Calling: library(help=XML) # or help(package=XML) lists all the functions from the XML package, and saveXML seems to be what you want. I remember having difficulty finding these functions (for listing package contents) when I first learned R, and perusing the posting guide did mention them in relation to properly posting info about surprising behavior and bugs. Maybe a new list item can be added under Do your homework before posting, something like: * Do help(package=packageName) for a description and function list of the installed packageName, or read the package reference manual from CRAN (http://cran.r-project.org/web/packages/). Best, Jeff Alberto Monteiro PS: please, brazilians, don't be offended by my foul language! __ 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. -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] Embedding fonts in pdfs
hadley wickham wrote on 04/18/2008 02:40 PM: Hi all, I'm having problems embedding fonts in my graphics - and I've tried embedFonts to no avail. I have a pdf file and pdffonts tells me: name type emb sub uni object ID - --- --- --- - ZapfDingbats Type 1no no no 5 0 HelveticaType 1no no no 10 0 (both before and after running the gs script). From reading the documentation, I suspect that these aren't being embedded because they are standard PS fonts, but my publisher (lulu.com) wants them embedded. Does anyone have any hints? Have you tried using the Cairo package? For instance, I just helped one of our users here at Vanderbilt to embed 'Gill Sans MT' (because apparently it's required by some journal) into her PDF graphic, like so: CairoFonts( regular=Gill Sans MT, bold=Gill Sans MT:style=Bold, italic=Gill Sans MT:style=Italic, bolditalic=Gill Sans MT:style=Bold Italic ) CairoPDF(file=file.pdf) ... dev.off() Also, Preview or even Acrobat reader (or xpdf) should reveal in the Properties of the pdf file whether or not your desired fonts are embedded. Best, Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] R_alloc with structures with flexible array members
Ramon Diaz-Uriarte wrote on 03/05/2008 04:25 AM: Dear All, In a package, I want to use some C code where I am using a structure (as the basic element of a linked list) with flexible array members. Basically, this is a structure where the last component is an incomplete array type (e.g., Harbison Steel, C, a reference manual, 5th ed., p. 159) such as: struct Sequence { struct Sequence *next; int len; unsigned int state_count[]; }; To create one such sequence, I allocate storage (following Harbison and Steel) in a C program as follows: struct Sequence *A; int n = 4; A = malloc( sizeof(struct Sequence) + n * sizeof(unsigned int)); If I understand correctly, however, it would be better to use R_alloc instead of malloc (memory automagically freed on exit and error; error-checking). But I do not know how to make the call to R_alloc here, since R_alloc allocates n units of size bytes each. I've tried, without success, the following two: int to_add_for_R_alloc = (int) ceil((float) sizeof(struct sequence) / sizeof(unsigned int)); A = (struct sequence *) R_alloc(to_add_for_R_alloc + n, sizeof(unsigned int)); or even a brute force attempt as: A = (struct sequence *) R_alloc( 100, sizeof(struct sequence)); but both result in segmentation faults. Should I just keep using malloc (and free at end)? Hi Ramon, You should be able to use R_alloc without seg faults, so there's something wrong with your code somewhere. R_alloc multiplies its arguments together to come up with the total number of bytes to allocate then it allocates a raw vector and returns the data portion. So you can just treat R_alloc similarly to malloc by calling R_alloc(1,sizeof(struct Sequence) + n * sizeof(unsigned int)). Best, Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] R_alloc with structures with flexible array members
Ramon Diaz-Uriarte wrote on 03/05/2008 03:00 PM: Dear Prof. Ripley, Yes, of course! You are right. What a silly mistake on my part! I was using a standalone program for development of functions, debugging, etc, of what is part of a package. Aha! The lesson I take away from this then is question everything, assume nothing. Jeff Thanks, R. On Wed, Mar 5, 2008 at 8:45 PM, Prof Brian Ripley [EMAIL PROTECTED] wrote: On Wed, 5 Mar 2008, Ramon Diaz-Uriarte wrote: Dear Jeff, Thanks for the suggestion. However, something is still not working. This is a simple example: *** start C #include R.h struct Sequence { int len; unsigned int state_count[]; }; int main(void) { struct Sequence *A; int n = 4; // First line segfaults. Second doesn't A = (struct Sequence *) R_alloc(1, sizeof(struct Sequence) + n * sizeof(unsigned int)); // A = malloc(sizeof(struct Sequence) + n * sizeof(unsigned int)); return(0); } *** end C ** I then do gcc -std=gnu99 -Wall -I/usr/share/R/include -I/usr/share/R/include -L/usr/lib/R/lib -lR ex7.c and the ./a.out segfaults when I use R_alloc (not with malloc). You can't use R_alloc in a standalone program without initializing R, which has not been done here. You said 'in a package', but this is not in a package. Best, R. On Wed, Mar 5, 2008 at 5:23 PM, Jeffrey Horner [EMAIL PROTECTED] wrote: Ramon Diaz-Uriarte wrote on 03/05/2008 04:25 AM: Dear All, In a package, I want to use some C code where I am using a structure (as the basic element of a linked list) with flexible array members. Basically, this is a structure where the last component is an incomplete array type (e.g., Harbison Steel, C, a reference manual, 5th ed., p. 159) such as: struct Sequence { struct Sequence *next; int len; unsigned int state_count[]; }; To create one such sequence, I allocate storage (following Harbison and Steel) in a C program as follows: struct Sequence *A; int n = 4; A = malloc( sizeof(struct Sequence) + n * sizeof(unsigned int)); If I understand correctly, however, it would be better to use R_alloc instead of malloc (memory automagically freed on exit and error; error-checking). But I do not know how to make the call to R_alloc here, since R_alloc allocates n units of size bytes each. I've tried, without success, the following two: int to_add_for_R_alloc = (int) ceil((float) sizeof(struct sequence) / sizeof(unsigned int)); A = (struct sequence *) R_alloc(to_add_for_R_alloc + n, sizeof(unsigned int)); or even a brute force attempt as: A = (struct sequence *) R_alloc( 100, sizeof(struct sequence)); but both result in segmentation faults. Should I just keep using malloc (and free at end)? Hi Ramon, You should be able to use R_alloc without seg faults, so there's something wrong with your code somewhere. R_alloc multiplies its arguments together to come up with the total number of bytes to allocate then it allocates a raw vector and returns the data portion. So you can just treat R_alloc similarly to malloc by calling R_alloc(1,sizeof(struct Sequence) + n * sizeof(unsigned int)). Best, Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz __ 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, [EMAIL PROTECTED] 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.
Re: [R] write.csv +RMySQL request
Tristan Casey wrote on 02/29/2008 03:37 AM: Well that is certainly good news if write.csv output can be stored directly to a character vector! I have tried to specify a vector within the file= argument for example; write.csv(a,file=b) where b is a preexisting character vector This does not work. Do I need to define b as something else, like a textConnection? Well, I was just curious myself, so I tested this and the following R code works and presumes you have DBI and RSQLite installed (mind the line wrap): library(datasets) library(RSQLite) # Temp file for sqlite database tfile - tempfile() # Connection to sqlite database con - dbConnect(dbDriver(SQLite), dbname = tfile) # Create a table to hold ASCII serialized R data frames dbSendQuery(con,'create table frames (name varchar(255), value text default NULL)') # Serialize the iris data frame to a length 1 character vector Siris - rawToChar(serialize(iris,NULL,ascii=TRUE)) # Now insert it into the database dbSendQuery(con,paste(insert into frames values (','iris',',',Siris,'),sep='')) # Assign the unserialized data frame to DBiris DBiris - unserialize(dbGetQuery(con,select value from frames where name='iris')[1,'value']) # To idio? all(DBiris == iris) dbDisconnect(con) file.remove(tfile) rm(list=c('tfile','con','Siris','DBiris')) Best, Jeff Date: Fri, 29 Feb 2008 09:16:11 + From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: [EMAIL PROTECTED]; r-help@r-project.org Subject: RE: [R] write.csv +RMySQL request On Fri, 29 Feb 2008, Tristan Casey wrote: Ahh, my apologies I must admit that I don't fully understand textConnections fully. I have been reading up on th RODBC package as an alternative to RMySQL. With the file argument in write.csv, are you saying it is possible to write the csv formated data directly to a cell in a MySQL database? I am unsure what the variable 'con' must consist of. No, that it is possible to write it to an R character vector. Would this need to be a character string that initially connects to the database (dbConnect) then pastes the MySQL query? I am unsure how to specify where the data is going with the file/connection argument. Thanks Date: Fri, 29 Feb 2008 08:44:58 + From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: [EMAIL PROTECTED]; r-help@r-project.org Subject: RE: [R] write.csv +RMySQL request On Fri, 29 Feb 2008, Tristan Casey wrote: Thanks again for your help. I am wanting my variable to store a character string exactly as the write.csv function would store as a csv text file; IE: My goal is to store a data frame of this construction; x1 x2 1 2 3 4 as X1,X2,1,2,3,4 (the same format as CSV). I am aware of the file argument, however that is the problem, storing to a physical text file and then importing into the SQL database is a very inefficient way of doing things, especially when I can use RMySQL to send commands directly to the database. You seem however unaware of text connections. Neither of us said anything about using a 'physical text file', and the documentation for write.csv says file: either a character string naming a file or a connection open for writing. '' indicates output to the console. A 'text connection; is not a file (physical or otherwise). Kind Regards, Tristan Casey BPsySci (UQ) + 4 Festa Court, Capalaba, QLD 4157 H 8/33 Lilly St, Greenslopes, QLD 4120 0450 033 948 Date: Fri, 29 Feb 2008 05:12:04 + From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: [EMAIL PROTECTED]; r-help@r-project.org Subject: Re: [R] write.csv +RMySQL request On Thu, 28 Feb 2008, jim holtman wrote: ?capture.output myoutput - capture.output(write.csv(...)) It would be better to write directly to a text connection: see the 'file' argument to write.csv. On Thu, Feb 28, 2008 at 7:34 PM, Tristan Casey [EMAIL PROTECTED] wrote: Hello, I am relatively new to R and learning its ins and outs. As part of a website I am building, I need to read and write csv files directly from an SQL database. Basically I want to convert R variables (dataframes) into CSV format, store them as another R variable (as a properly formatted text string suitable for csv reading) and then send this to one row in a database. The SQL part is fine, the problem arises because I cannot capture the output of write.csv! It posts to the terminal when file= is used, however I also want to store it. Does anyone have any ideas? Thanks in advance! -- Brian D. Ripley, [EMAIL PROTECTED] 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 _ Your Future Starts Here. Dream it? Then be it! Find it at www.seek.com.au
[R] RFC for package PopCon: a popularity contest for R and packages
(I posted this to the R-devel list yesterday, but I thought others on this list would be interested, so sorry for those who get it twice.) Hello all, I've developed a prototype package called PopCon (short for popularity contest), a package for tracking the popularity of R and its packages. I'd like this work to be similar in spirit to the Debian package popularity-contest: http://popcon.debian.org/. Once Popcon is loaded, it captures two kinds of information from the user and stores it into a cache: the names of the libraries he/she loads, and the names of symbols requested from his/her code. Once the cache is full, the goal is to flush the data to a central server for storage, free for anyone to download and analyze. That's it. Pretty simple use and works behind the scenes. You can get the prototype here: http://biostat.mc.vanderbilt.edu/twiki/pub/Main/JeffreyHorner/PopCon_0.1.tar.gz And note that flushing of the cache is NOT TURNED ON and IT WON'T FORWARD ANY DATA ANYWHERE! It only gets deleted. So, I envision all the software and data generated and stored to be licensed under a GPL and a Creative Commons license, or even public domain. Thoughts? I'm looking for volunteers, because there are many issues to hash out. Here's a few of them: 1. Obviously storing IP addresses or any bit of personal information is out, but I'm interested in generating a permanent random key of some sort so that data from the same R installs can be tracked. I'm wondering if just md5 hashing the combination of R version, platform, and IP address would be appropriate and reproducible per R install. The debian package popularity-contest has the benefit of installing an '/etc' config file and generating the key once, while I'd like PopCon users to just call 'library(PopCon)' and do nothing else. 2. I'm willing to maintain the central server and work on the infrastructure, but help will definitely be needed. Also, if there's significant interested, maybe R core would be interested in this. 3. What exactly is PopCon tracking as far as symbol names go? It currently used an R_ObjectTable object attached to the search path to capture names, but is this the best way? see http://www.omegahat.org/RObjectTables/. It's also replacing base::getHook to trap library loads. 4. What else would be interesting to track? Some folks have suggested various bits of R.Version() output. Here's what PopCon can currently do: library(PopCon) search() [1] .GlobalEnvpackage:PopCon.pcUDB [4] package:stats package:graphics package:grDevices [7] package:utils package:datasets package:methods [10] Autoloads package:base # Notice the above search entry .pcUDB. That's the R Object Table typeof(PopCon::getCache()) [1] character PopCon::getCache() [1] .conflicts.OK search:: # Now the cache contains the name 'search', which I called above, # and the double colon operator. library(cluster) any(PopCon::getCache()=='package:cluster') [1] TRUE # Package names are represented in the PopCon cache just like # their name on the search path. PopCon::getCache() [1] .conflicts.OKsearch [3] :: $.data.frame [5] $.default$.data.frame [7] $.defaultunique.integer [9] unique.numeric $.data.frame [11] $.defaultunique.integer [13] unique.numeric unique.character [15] unique.integer unique.numeric [17] close.gzfile $.packageDescription2 [19] $.default$.data.frame [21] $.defaultunique.integer [23] unique.numeric unique.character [25] unique.integer unique.numeric [27] close.gzfile $.packageDescription2 [29] $.defaultunique.integer [31] unique.numeric close.gzfile [33] names.simple.listnames.default [35] [.defaultas.character.simple.list [37] as.vector.simple.listas.vector.default [39] unique.character $.packageDescription2 [41] $.default=.R_system_version [43] Ops.R_system_version =.package_version [45] Ops.package_version =.numeric_version [47] =.package_version Ops.package_version [49] =.numeric_version unlist.R_system_version [51] unlist.package_version unlist.numeric_version [53] unlist.default unlist.package_version [55] unlist.numeric_version unlist.default [57] as.list.R_system_version as.list.package_version [59] unique.integer unique.numeric [61] as.list.R_system_version as.list.package_version [63] unique.integer unique.numeric [65] as.list.package_version unique.integer [67] unique.numeric as.list.package_version [69] unique.integer unique.numeric [71] =.default $.packageDescription2 [73] $.default.R_system_version [75]
Re: [R] An R is slow-article
I hazard to say that the author of that blog post isn't using the time he saved from writing his analyses in C very efficiently. I wonder how long it took him to write it in C in the first place, even to setup the testing of C against R, or to write the blog post. He didn't say. Jeff Armstrong, Whit wrote on 01/09/2008 09:49 AM: fisher.test seems to use the .C calling convention in a couple of different places. for example: tmp - .C(fisher_sim, as.integer(nr), as.integer(nc), as.integer(sr), as.integer(sc), as.integer(n), as.integer(B), integer(nr * nc), double(n + 1), integer(nc), results = double(B), PACKAGE = stats)$results perhaps some R experts on the list can tell us whether there is significant overhead to .C vs .Call. Does .C really duplicate its arguments? What does RObjToCPtr do? (line 1682.. in dotcode.c) /* Convert the arguments for use in foreign */ /* function calls. Note that we copy twice */ /* once here, on the way into the call, and */ /* once below on the way out. */ cargs = (void**)R_alloc(nargs, sizeof(void*)); nargs = 0; for(pargs = args ; pargs != R_NilValue; pargs = CDR(pargs)) { #ifdef THROW_REGISTRATION_TYPE_ERROR if(checkTypes !comparePrimitiveTypes(checkTypes[nargs], CAR(pargs), dup)) { /* We can loop over all the arguments and report all the erroneous ones, but then we would also want to avoid the conversions. Also, in the future, we may just attempt to coerce the value to the appropriate type. This is why we pass the checkTypes[nargs] value to RObjToCPtr(). We just have to sort out the ability to return the correct value which is complicated by dup, etc. */ errorcall(call, _(Wrong type for argument %d in call to %s), nargs+1, symName); } #endif cargs[nargs] = RObjToCPtr(CAR(pargs), naok, dup, nargs + 1, which, symName, argConverters + nargs, checkTypes ? checkTypes[nargs] : 0, encname); #ifdef R_MEMORY_PROFILING if (TRACE(CAR(pargs)) dup) memtrace_report(CAR(pargs), cargs[nargs]); #endif nargs++; } Thanks, Whit -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gustaf Rydevik Sent: Wednesday, January 09, 2008 10:25 AM To: r-help@r-project.org Subject: [R] An R is slow-article Hi all, Reading the wikipedia page on R, I stumbled across the following: http://fluff.info/blog/arch/0172.htm It does seem interesting that the C execution is that much slower from R than from a native C program. Could any of the more technically knowledgeable people explain why this is so? The author also have some thought-provoking opinions on R being no-good and that you should write everything in C instead (mainly because R is slow and too good at graphics, encouraging data snooping). See http://fluff.info/blog/arch/0041.htm While I don't agree (granted, I can't really write C), it was interesting to read something from a very different perspective than I'm used to. Best regards, Gustaf _ Department of Epidemiology, Swedish Institute for Infectious Disease Control work email: gustaf.rydevik at smi dot ki dot se skype:gustaf_rydevik __ 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. This e-mail message is intended only for the named recipient(s) above. It may contain confidential information. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying of this e-mail and any attachment(s) is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender by replying to this e-mail and delete the message and any attachment(s) from your system. Thank you. __ 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. -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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,
Re: [R] Implementing R through Oracle
jah wrote on 11/05/2007 02:41 PM: I have looked through all the ROracle documentation, R-help, R-dev, Googled the world and still cannot figure out this issue. Everything I read it is about connecting to an Oracle database and pulling data, processing it, and then pushing it back to Oracle. I am running in pl/sql code so I already have a Oracle session open. What I want to do is from Oracle call R. I am having a mental challenge in seeing how this can be done. Any words of wisdon? I understand that one can write user defined functions for Oracle in java, so you might be able to bridge over to R via the rJava package. If you can write them in C, then you'll have the enviable task of embedding R into Oracle using the OCI, since no package exists. Now THAT would be a programming challenge. Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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 sprintf with dates
stephen bond wrote on 10/02/2007 08:36 AM: hello, Please help with using sprintf with character variables: The following does not produce what i intended foot=function(){ str1=format(Sys.Date,%Y%m%d) sprintf(99%-4s%s,nm,str1) } I wanted to have 99nm 20071002 as the output. You forgot the parens after Sys.Date: foot=function(){ str1=format(Sys.Date(),%Y%m%d) sprintf(99%-4s%s,nm,str1) } Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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.