Re: [R] Linux configuration (Ubuntu)
Brian Edward a écrit : Hello all, I have been a R user for about a year now, running on a MS Windows machine. I am in the process of making a complete switch to open-source. Linux is a new world to me. Ubuntu was my selection of the various distributions. Please pardon this very basic question (I was unable to locate an answer on R or Ubuntu). I used Synaptic to download the necessary files to run. However, I was unable to locate the program using the Add/Remove feature. So, I created a Launcher for R on the desktop and identified the executable file. The path I entered into the Command Line was: /usr/bin/R I can run R in the Terminal, but not as a separate desktop location. So, the short question is, what is the specific command line or configuration I should be using to run R? Or, am I supposed to be running R in the Terminal? Thanks in advance, Brian [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Dear Edward, R under linux (Ubuntu or other distributions) is not exactly as it is under windows. Under linux, you have to use a shell (or a terminal) to launch R and use it. The main difference between windows and linux version of R, is that R under linux, does not provide the graphical facilities to load and install libraries. To do so under linux, you have to download the tar.gz version of the library from CRAN and use as a root user the command R CMD INSTALL thelibrarytoinstall.tar.gz. You have to install, of course, before, the needed compilers gcc and/or fortran, depend the library you are about to install. Hope it 'll help. Regards -- Cordialement Emmanuel Poizot Cnam/Intechmer B.P. 324 50103 Cherbourg Cedex Phone (Direct) : (00 33)(0)233887342 Fax : (00 33)(0)233887339 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Pooled Covariance Matrix
On Wed, 20 Sep 2006, Murray Jorgensen wrote: I am in a discriminant analysis situation with a frame containing several variables and a grouping factor, if you like: set.seed(200906) exampledf - as.data.frame(matrix(rnorm(50,5,2),nrow=10,ncol=5)) exampledf$Group - factor(rep(c(1,2,3),c(3,3,4))) exampledf I'm sure there must be a simple way to get the within group pooled covariance matrix but I haven't found it yet. There are two versions of this, weighted and unweighted, and the difference caused confusion in the early discriminant analysis literature. (See MASS4 p.333.) The weighted version is conventional. Suppose you have a matrix X and a grouping factor g. Then either of group.means - rowsum(X, g)/as.vector(table(g)) group.means - tapply(X, list(rep(g, ncol(X)), col(X)), mean) gives the group means, and var(X - group.means[g,]) seems to be what you want. I started thinking that one might begin by forming a frame with the same dimensions but containing the group means. But then I found a thread from two years back called Getting the groupmean for each person which seemed to imply that doing this was a bit subtle even for ncol=1. Hence I will risk a question to the list. That thread seems to be about efficiency for very large matrices on R of two years' ago. -- 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@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.
Re: [R] currency or stock trading strategy
Darren Weber wrote: Hi Patrick, thanks for pointing me to your work and Rmetrics. I have a few questions on my mind right now. Do you have methods for automatic download of price quote histories? Rmetrics and tseries I can use python to get XML data on FOREX price quotes from the NYRB and other sites. Together with Rpy and matplotlib, that data download could form the basis for an open source technical analysis platform. I still need some way to get open source price quote histories for stocks yahoo internet Bloomberg with R interface exchanges delayed on internet or by direct subscription or through Bloomberg Diethelm Wuertz and options. Any ideas? Best, Darren On 9/18/06, Patrick Burns [EMAIL PROTECTED] wrote: The Finance page of the Burns Statistics website tells you how to sign up to R-sig-finance. You want to investigate Rmetrics. You can see an example of backtesting in R from the 'evalstrat' package that is in the Public Domain area of the Burns Statistics website. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Darren Weber wrote: Hi, are there any good charting and analysis tools for use with currencies, stocks, etc. in R? I have some tools to download currency data from the NYFRB using python and XML. Can we get and parse an XML download using R? Can we have interaction in R plots? Does anyone use R for back-testing trading strategies? Are there any forums for discussion of using R for this specific purpose (apart from this general list)? Is anyone aware of any general open-source developments for these purposes (I don't see any from GNU or google searches)? Take care, Darren __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Linux configuration (Ubuntu)
Poizot Emmanuel wrote: Brian Edward a écrit : Hello all, I have been a R user for about a year now, running on a MS Windows machine. I am in the process of making a complete switch to open-source. Linux is a new world to me. Ubuntu was my selection of the various distributions. Please pardon this very basic question (I was unable to locate an answer on R or Ubuntu). I used Synaptic to download the necessary files to run. However, I was unable to locate the program using the Add/Remove feature. So, I created a Launcher for R on the desktop and identified the executable file. The path I entered into the Command Line was: /usr/bin/R I can run R in the Terminal, but not as a separate desktop location. So, the short question is, what is the specific command line or configuration I should be using to run R? Or, am I supposed to be running R in the Terminal? Thanks in advance, Brian [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Dear Edward, R under linux (Ubuntu or other distributions) is not exactly as it is under windows. Under linux, you have to use a shell (or a terminal) to launch R and use it. The main difference between windows and linux version of R, is that R under linux, does not provide the graphical facilities to load and install libraries. To do so under linux, you have to download the tar.gz ^ - packages version of the library from CRAN and use as a root user the command R ^^^ - package CMD INSTALL thelibrarytoinstall.tar.gz. You have to install, of course, ^^^ - package before, the needed compilers gcc and/or fortran, depend the library you package - ^^^ Yes, please, it is called a *package*. And you can easily install packages from R by typing: install.packages(thepackagetoinstall) Please see ?install.packages. Uwe Ligges are about to install. Hope it 'll help. Regards __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] multiple lines and plot
?lines On 20/09/06, Mauricio Cardeal [EMAIL PROTECTED] wrote: Hi. Please, how can I put together 2 or more lines at the same scatterplot ? Example: measures of protein intake (quantitative) of 4 children over 30 days, by day. How to plot all children at same graphic: Protein X Time ? Is there any command like overlay ? Thank you, Mauricio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] about BATCH and parameter file
XinMeng wrote: Hello sir: I use Rcmd to execute R code,such as : C:\\Program Files\\R\\R-2.2.1\\bin\\Rcmd.exe BATCH globalLowessRun.r globalLowessRun.r is a R function written by myself. But I wanna make the globalLowessRun.r changeable,such as globalLinearRun.r or gridbasedLowessRun.r,and so on. Can you please explain in more detail? I do not understand wht you really would like to chenge. If it is just the name, why don't you simply retype the command? Uwe Ligges How can I achieve this goal via Rcmd.exe BATCH ? The only finding is: Rcmd BATCH [options] globalLowessRun.r [outfile] I wonder the only way I can try is [options],but I don't know how to do it. Thanks a lot! My best -- *** Xin Meng Capitalbio Corporation National Engineering Research Center for Beijing Biochip Technology BioPharma-informatics Software Dept. Research Engineer Tel: +86-10-80715888/80726868-6438 Fax: +86-10-80726790 [EMAIL PROTECTED] Address:18 Life Science Parkway, Changping District, Beijing 102206, China __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] tcltk problem
Hi, I'm using fedora core 3. I downloaded R and installed it. After that, I invoked R by the root user and write the command install.packages(Rcmdr, dependencies=TRUE). This command installs Rcmdr automatically. However, whenever I type library(Rcmdr), it tells me that Loading required package: tcltk Error in firstlib(which.lib.loc, package) : Tcl/Tk support is not available on this system Error: package 'tcltk' could not be loaded tcl and tk are installed on my system The problem is that R can't find them as I guess Please help me to solve this problem __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] multiple lines and plot
Mauricio Cardeal wrote: Hi. Please, how can I put together 2 or more lines at the same scatterplot ? Example: measures of protein intake (quantitative) of 4 children over 30 days, by day. How to plot all children at same graphic: Protein X Time ? Is there any command like overlay ? Make the plot for one child and add other with connands uch as lines() or segments(), don't know what is best in your case. Uwe Ligges Thank you, Mauricio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [Rd] Sweave processes \Sexpr in commented LaTeX source (2.3.1patched and 2.4.0)
Hi. 2006/9/20, Marc Schwartz [EMAIL PROTECTED]: Hi all, On FC5, using: Version 2.3.1 Patched (2006-08-06 r38829) and today's R version 2.4.0 alpha (2006-09-19 r39397) with the following .Rnw file: \documentclass[10pt]{article} \begin{document} This line should print '2': \Sexpr{1 + 1} %% This line should NOT print '2': \Sexpr{1 + 1} If it's just a comment, why don't use something like: % \ Sexpr (del the space) or %\sexpr (change 'sexpr' with 'Sexpr') or %...the 'Sexpr' command (add a backslash in latex code) ? Antonio. \end{document} The \Sexpr in the second line is processed even though the line is commented. This results in the following .tex file content (in the case of R 2.4.0): \documentclass[10pt]{article} \usepackage{/home/marcs/R.Files/SourceCode/R-alpha/share/texmf/Sweave} \begin{document} This line should print '2': 2 %% This line should NOT print '2': 2 \end{document} Shouldn't Sweave just generally ignore commented LaTeX code? In reviewing Sweave.R I did not see a check for this, so perhaps there are circumstances where one wants a \Sexpr in commented LaTeX code processed. An example escapes me at the moment however. HTH, Marc Schwartz __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] multiple lines and plot
Hi Have you searched the R-project web? There are plenty of overlay commands. Have you looked at plot help page? The first example shows you how to put line on existing scatterplot. So plot, lines and points are the basics for standard plot customisation. HTH Petr On 19 Sep 2006 at 22:50, Mauricio Cardeal wrote: Date sent: Tue, 19 Sep 2006 22:50:45 -0300 From: Mauricio Cardeal [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject:[R] multiple lines and plot Hi. Please, how can I put together 2 or more lines at the same scatterplot ? Example: measures of protein intake (quantitative) of 4 children over 30 days, by day. How to plot all children at same graphic: Protein X Time ? Is there any command like overlay ? Thank you, Mauricio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] estimating state space with exogenous input in measurement eq.
With a bit more details: RSiteSearch(kalman, functions) produced for me just now 29 hits. The second hit there mentions package 'sspir'. After installing it, I tried help(package=sspir). The Description suggested I try 'help(sspir)', which briefly summarizes what it does and does not do and gives an overview of alternative software. None of R's volunteer contributors have as yet provided a complete package with documentation that makes it almost trivial to do all you might want to do with a model like you describe. However, several different capabilities are available, and virtually anything you want to do can probably be done without excessive effort. If you would like more help from this listserve, please provide commented, minimal, self-contained, example with reproducible code (as suggested in the posting guide www.R-project.org/posting-guide.html). Your general question produced to my knowledge two general and I hope helpful replies (including this one). A more specific question might generate more specific and perhaps more useful replies (quicker). Hope this helps, Spencer Graves MARK LEEDS wrote: below is very close to a standard kalman filter setup except for the exogenous u[k] so i would check on www.r-project.org for any packages that do kalman filtering. ( also, good reference for state space is a book by durbin and koopman but i forget the title exactly ). - Original Message - From: Øyvind Foshaug [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, September 11, 2006 7:52 AM Subject: [R] estimating state space with exogenous input in measurement eq. Anyone know how to esimate parameters in the system: x[k]=Ax[k-1]+ B + Gv[k-1] y[k]=x[k]+Du[k]+Hw[k] a system with exogenous u[k] in the measurement eq., v,w are iid, both eq. are gaussian. Thanks, Oyvind - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Wilcoxon Rank-Sum Test with Bonferroni's correction
Consider the following: l0 - list(1:3, 4:5) l1 - list(6:8, 9:11, 12:16) WT - mapply(function(x,y)wilcox.test(x,y)$p.value, l0, l1) The simplest Bonferroni for this case would be as follows: length(WT)*WT Greater numerical precision could be obtained as follows: 1-(1-WT)^length(WT) If you aren't satisfied with either of these, I suggest two things: First have you tried help('Bonferroni')? This produced 124 hits for me just now. Second, please expand your example slightly to make it self contained (as I tried to do above) and PLEASE do read the posting guide www.R-project.org/posting-guide.html. Hope this helps. Spencer Graves Raj, Towfique wrote: Dear all, I am trying to run Wilcoxon Rank-Sum Test with Bonferroni's correction. I have two lists: l0, l1: mapply(function(x,y)wilcox.test(x,y)$p.value, l0, l1) How do I run Bonferroni's correction on mapply? Any help is much apperciated. Thanks, -Raj __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Linux configuration (Ubuntu)
On Wed, 20 Sep 2006, Uwe Ligges wrote: Poizot Emmanuel wrote: R under linux (Ubuntu or other distributions) is not exactly as it is under windows. Under linux, you have to use a shell (or a terminal) to launch R and use it. The main difference between windows and linux version of R, is that R under linux, does not provide the graphical facilities to load and install libraries. To do so under linux, you have to download the tar.gz ^ - packages version of the library from CRAN and use as a root user the command R ^^^ - package CMD INSTALL thelibrarytoinstall.tar.gz. You have to install, of course, ^^^ - package before, the needed compilers gcc and/or fortran, depend the library you package - ^^^ Yes, please, it is called a *package*. And you can easily install packages from R by typing: install.packages(thepackagetoinstall) Please see ?install.packages. One more quick hint to ex-Windows users: the Rgui menu item runs install.packages(NULL, dependencies = TRUE) and that will bring up a graphical menu to select packages even on Linux (provided tcltk is working). -- 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@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.
Re: [R] tcltk problem
On Wed, 20 Sep 2006, Dina Said wrote: Hi, I'm using fedora core 3. I downloaded R and installed it. After that, I invoked R by the root user and write the command install.packages(Rcmdr, dependencies=TRUE). This command installs Rcmdr automatically. However, whenever I type library(Rcmdr), it tells me that Loading required package: tcltk Error in firstlib(which.lib.loc, package) : Tcl/Tk support is not available on this system Error: package 'tcltk' could not be loaded tcl and tk are installed on my system The problem is that R can't find them as I guess It is most likely that tcl and tk are installed, but tcl-devel and tk-devel are not. See the 'R Installation and Administation' manual. Please install these RPMs if necessary, then re-install R, keeping a note of the output from configure. (As far as I know this cannot happen if you installed the RPM, so am assuming that you built R from the sources: you omitted to tell us.) -- 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@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.
[R] Call for Abstracts: Tools for Intelligent Data Analysis (GfKl 07)
*** Call for Abstracts *** Tools for Intelligent Data Analysis Session at the 31th Annual Conference of the German Classification Society (GfKl): Data Analysis, Machine Learning, and Applications March 7-9, 2007 University of Freiburg Providing innovative tools for data analysis is extremely important for making techniques available for a broader community. In the session 'Tools for Intelligent Data Analysis' we are looking for presentations of tools (in a very broad sense) which support any area of data analysis including data mining (from the data preparation to the visualization of results). We solicit contributions on algorithms as well as design and applications of such tools. Some suggested topics * Data mining tools * Implementations of algorithms * Vizualization frameworks * Statistical (extension) packages All presentes will be invited to submit a paper for a book published by Springer (Studies in Classification, Data Analysis, and Knowledge Organization). Deadline for submission of abstracts: Fr. November 10, 2006 Session Chairs: Michael Hahsler [EMAIL PROTECTED] Kurt Hornik [EMAIL PROTECTED] For information on how to submit your abstract, please go to http://www.ai.wu-wien.ac.at/~hahsler/research/tools_gfkl07/ -- Michael Hahsler Institut für Informationswirtschaft, Wirtschaftsuniversität Wien Tel: +43-1-31336-6081 Fax: +43-1-31336-739 E-Mail: [EMAIL PROTECTED] WWW: http://wwwai.wu-wien.ac.at/~hahsler__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] RODBC Connections closed automatically in background
Usually I try to do all data import before I do long calculations. A simple workaround for your problem would be: foo - function(dsn) { db - odbcConnect(dsn) odbcSetAutoCommit(db, FALSE) data - someDatabaseOperation(db) odbcClose(db) data2 - someLongCalculation(data) db - odbcConnect(dsn) odbcSetAutoCommit(db, FALSE) anotherDatabaseOperation(db, data2) odbcClose(db) } An other options is to include the odbcConnect and odbcClose into someLongCalculation() and anotherDatabaseOperation() Cheers, Thierry -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Jay Z Verzonden: woensdag 20 september 2006 0:12 Aan: R-help@stat.math.ethz.ch Onderwerp: [R] RODBC Connections closed automatically in background I am having a problem with RODBC's connections. It appears that my connection to the database is closed by R automatically before I am done with it. Here is my code: foo - function(dsn) { db - odbcConnect(dsn) odbcSetAutoCommit(db, FALSE) data - someDatabaseOperation(db) data2 - someLongCalculation(data) anotherDatabaseOperation(db, data2) # This often fails b/c the db is no longer open. odbcClose(db) } I see some output: Warning: closing unused RODBC handle 9 Warning: [RODBC] Error SQLDisconnect Warning: [RODBC] Error SQLFreeconnect Warning: [RODBC] Error in SQLFreeEnv Error in odbcGetErrMsg(channel) : first argument is not an open RODBC channel I suspect that during the call to someLongCalculation(), R considers the database connection as unused, and therefore, closes the connection, which prevents me from using the connection in the call to anotherDatabaseOperation(). What causes the database connection to close? What can I do to prevent the connection from closing implicitly? I am using R 2.3.1 on Windows with the latest version of RODBC, connnectin to SQL Server 2000. Thanks in advance. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] random number generation from a-/symmetric distribution
Hi list, are there any functions or ideas to compute random numbers with a specific population mean and standard deviation from symmetric (but not normal) and asymmetric distributions? My first idea was to use e.g. rf() (and other R-functions for random number generation) and then scale the random numbers (for example: mean 300 and standard deviation 40), but I don't know if I'm wrong... Thanks, Sven __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] random number generation from a-/symmetric distribution
Garbade, Sven a écrit : Hi list, are there any functions or ideas to compute random numbers with a specific population mean and standard deviation from symmetric (but not normal) and asymmetric distributions? My first idea was to use e.g. rf() (and other R-functions for random number generation) and then scale the random numbers (for example: mean 300 and standard deviation 40), but I don't know if I'm wrong... Thanks, Sven http://cran.r-project.org/src/contrib/Descriptions/boot.html and all methods/packages related to bootstraping. hih __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] looking for some functions to analyze a data set.
Taka Matzmoto sell_mirage_ne at hotmail.com writes: Hi R-users I have a data set. There are 10 products and the numbers of people who ranked the products. ... Is there any other way I can summarize this data? Be sure to know what assumptions are implicit in the procedures you are using to do this. Any procedure you use will violate some assumption that seems quite intutively appealing. Anupam. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] multiple lines and plot
Ok. I´ve already tried ?lines. An example: x - c(1,2,3,4,5,6) y - c(3,5,2,4,1,4) z - c(2,3,4,3,2,1) plot(x,y) lines(x,y) lines(x,z) Here is the point: how to show the points under the second line (x,z) ? Thanks Mauricio David Barron escreveu: ?lines On 20/09/06, Mauricio Cardeal [EMAIL PROTECTED] wrote: Hi. Please, how can I put together 2 or more lines at the same scatterplot ? Example: measures of protein intake (quantitative) of 4 children over 30 days, by day. How to plot all children at same graphic: Protein X Time ? Is there any command like overlay ? Thank you, Mauricio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] multiple lines and plot
You can specify the same type parameter in either lines() or points() that can be used in plot(). So, if you want to show points as well as lines, use the following: x - c(1,2,3,4,5,6) y - c(3,5,2,4,1,4) z - c(2,3,4,3,2,1) plot(x,y,type=b) lines(x,z,col=red,type=b) On 20/09/06, Mauricio Cardeal [EMAIL PROTECTED] wrote: Ok. I´ve already tried ?lines. An example: x - c(1,2,3,4,5,6) y - c(3,5,2,4,1,4) z - c(2,3,4,3,2,1) plot(x,y) lines(x,y) lines(x,z) Here is the point: how to show the points under the second line (x,z) ? Thanks Mauricio David Barron escreveu: ?lines On 20/09/06, Mauricio Cardeal [EMAIL PROTECTED] wrote: Hi. Please, how can I put together 2 or more lines at the same scatterplot ? Example: measures of protein intake (quantitative) of 4 children over 30 days, by day. How to plot all children at same graphic: Protein X Time ? Is there any command like overlay ? Thank you, Mauricio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Need help to estimate the Coef matrices in mAr
Dear Spencer, Thank you very much for your attention on my problem. According to your advice I did some home work on this problem, but unfortunately I could not solve my problem. Suppose I have a dataset of length 300 with 2 variables. And I want to fit a VAR model on this of order 2. I went through the function mAr.est and got understand that, here 'K' is a matrix with (300-2) rows and 7 columns. the first col. consists only 1, next two columns consist of lagged values of two variables with lag-length 2, next two col. consist of lagged value with lag length-1, and next two cols are for lag-length-0. Next, they add additional a 7-7 matrix to K. For this matrix diagonal elements are the square root of sum of square of elements of K (col. wise) and rest of the elements are 0. I feel that this matrix, that is added to K, is the key matrix for any type of modification that you prescribed. Therefore for experimental purpose I put NA against one of its off-diagonal elements. But I got error. However I cannot understand why they put such figures for diagonal and off-diagonal elements of that matrix. Can you suggest me any solution more specifically? Thanks and regards, Arun On 9/4/06, Spencer Graves [EMAIL PROTECTED] wrote: Have you tried 'RSiteSearch(multivariate autoregression, functions)'? This produced 14 hits for me just now, the first of which mentions a package 'MSBVAR'. Have you looked at that? If that failed, I don't think it would be too hard to modify 'mAr.est' to do what you want. If it were my problem, I might a local copy of the function, then add an argument accepting a 2 or 3-dimensional array with numbers for AR coefficients to be fixed and NAs for the coefficients. Then I'd use 'debug' to walk through the function line by line until I figured out how to modify the function to do what I wanted. I haven't checked all the details, so I don't know for sure if this would work, but the function contains a line 'R = qr.R(qr((rbind(K, diag(scale, complete = TRUE)' which I would start by decomposing, possibly starting as follows: Z - rbind(K, diag(scale) I'd figure out how the different columns of Z relate to my problem, then modify it appropriately to get what I wanted. Another alternative would be to program it from scratch using something like 'optim' to minimize the sum of squares of residuals over the free parameters in my AR matrices. I'm confident I could make this work, even if the I somehow could not get it with either of the other two. There may be something else better, e.g., a Kalman filter representation, but I can't think how to do that off the top if my head. Hope this helps. Spencer Graves Arun Kumar Saha wrote: Dear R users, I am using mAr package to fit a Vector autoregressive model to my data. But here I want to put some predetermined values for some elements in coefficient matrix that mAr.est going to estimate. For example if p=3 then I want to put A3[1,3] = 0 and keep rest of the elements of coefficient matrices to be determined by mAr.est. Can anyone please tell me how can I do that? Sincerely yours, Arun [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Arun Kumar Saha, M.Sc.[C.U.] S T A T I S T I C I A N[Analyst] RISK MANAGEMENT DIVISION Transgraph Consulting [www.transgraph.com] Hyderabad, INDIA Contact # Home: (91-033) 25558038 Office: (91-040) 30685012 Ext. 17 FAX: (91-040) 55755003 Mobile: 919989122010 E-Mail: [EMAIL PROTECTED] [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to draw a per mille symbol?
On Tue, 2006-09-19 at 17:53 +0100, Prof Brian Ripley wrote: On Tue, 19 Sep 2006, Gavin Simpson wrote: Dear list, Following advice posted to this list a while back by Prof Ripley [1], I have been trying to draw a per mille character [2] in an axis label. This should give the correct character: plot(1:10, ylab = \u2030) but all I get is 'S'. I'm running linux (FC5) and have fonts installed that have the correct character (viewed in the Gnome character map at least). On what device? If X11, this is almost always a font selection issue. Unicode support in X11 fonts is a complex issue that seems to vary with every minor update. Yes, this was an X11 device. I have also tried plotting to a pdf device with a font family that the character map tool shows I have a per mille glyph for, e.g.: What does character map have to do with postscript fonts? Given your comment, nothing. You've probably guessed I know very little about fonts, and had naively assumed that a font of the same name as a name displayed by postscriptFonts() or pdfFonts(), which showed a per mille sign in the character map tool in Gnome, were one and the same thing. pdf(~/tmp/test_per_mille.pdf, paper = a4, family = URWBookman) plot(1:10, ylab = \u2030) dev.off() But all I get here is a period or a dot-like symbol. But see the article in R-news 2006-2 about this. All we can do for PDF is to use an appropriate 8-bit font map, or a CJK font. It seems that e.g. encoding=CP1251 works, even for Helvetica. Ok, thanks for this - I've now read this and think I understand the issues and how to work with fonts in R a bit better now. The ultimate aim was to be able to include relevant code in a Sweave document. I'm not aware of a way to pass extra instructions to the pdf generator code in Sweave, so the solution will involve generating the pdf within embedded R code directly and inserting the figure manually into the the document. Is my thinking correct here? Thanks again for answering my questions, Prof. Ripley. G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC ENSIS, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to compare contours
dear All can anybody point me in to the right direction for this kind of operation?? Here an example. Please consider an hilly matematical landscapa as i-1 X- runif(i, min=0, max=4*pi) Y- runif(i, min=0, max=4*pi) Z-(cos(X)+cos(Y))/2 plot(X,Y,xlim=c(0,4*pi),ylim=c(0,4*pi), xlab=X,ylab=Y, main=c(i, points)) coscos.spl-interp.new(X,Y ,Z,xo=seq(0,4*pi,length=100),yo=seq(0,4*pi,length=100)) contour(coscos.spl,add=T,col=blue,levels=c(seq(-1,1,1/5)),labcex=0.8) in this case contour plot derived from 1 points interpolated rappresent very welll real trend. now consider par(mfrow=c(4,5) ) for (i in seq(5,195,10)) { X- runif(i, min=0, max=4*pi) Y- runif(i, min=0, max=4*pi) Z-(cos(X)+cos(Y))/2 plot(X,Y,xlim=c(0,4*pi),ylim=c(0,4*pi), xlab=X,ylab=Y, main=c(i, points)) coscos.spl-interp.new(X,Y ,Z,xo=seq(0,4*pi,length=100),yo=seq(0,4*pi,length=100)) contour(coscos.spl,add=T,col=blue,levels=c(seq(-1,1,1/5)),labcex=0.8) } How many points are necessary to fit (at 95% c.i.) true surface??? 85 points??? or more than 200??? tnx in advance!! - Landini Massimiliano - Legge di Hanggi: Più stupida è la tua ricerca, più verrà letta e approvata. Corollario alla Legge di Hanggi: Più importante è la tua ricerca, meno verrà capita. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Variable im Data Frame Namen
Hello R Experts, how can I incorporate a variable in a data frame definition? Example: week - 28 test(week) - data.frame(a,b,s,c); test28 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Stats question - cox proportional hazards adjustments
Hi useRs, Many studies of the link between red meat and colorectal cancer use Cox proportional hazards with (among other things) a gender covariate. If it is true that men eat more red meat, drink more alcohol and smoke more than women, and if it is also true that alcohol and tobacco are known risk factors then why does it make sense to adjust for gender? I would think that in this case some of the risk that should be properly attributed to the bad habits will actually end up being attributed to being male instead. Cheers, Geoff Russell __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to draw a per mille symbol?
On Wed, 2006-09-20 at 15:28 +1200, Paul Murrell wrote: Hi Gavin Simpson wrote: Dear list, Following advice posted to this list a while back by Prof Ripley [1], I have been trying to draw a per mille character [2] in an axis label. This should give the correct character: plot(1:10, ylab = \u2030) but all I get is 'S'. I'm running linux (FC5) and have fonts installed that have the correct character (viewed in the Gnome character map at least). Thanks for your reply Paul, and also to Andrew Robinson for his earlier reply. I had initially avoided trying to use the encoding argument and pdf() as I had planned to include the code to produce the graphics in a Sweave document and AFAICS there is no way to pass extra arguments to the code generating the pdf figures in Sweave? Of course, my original plan was ignorant of the details of font encodings and mappings to single byte encodings in pdf and postscript devices and wouldn't have worked anyway. I get the same thing (and using xfd I see the per mille character in the font I'm using). I'm afraid I'm not sure why this is happening; I can get a number of other unusual characters to work (e.g., \u20ac), but there appear to be some characters that do not draw correctly. I used the following code to explore the default Helvetica font I've got and I can't see a rational pattern in the misbehaviour. x11(width=5, height=5) grid.prompt(TRUE) digits - c(0:9, letters[1:6]) for (i in c(00, 01, 02, 03, 1e, 20, 21, 22)) { grid.newpage() for (j in 1:16) { for (k in 1:16) { pushViewport(viewport(x=j/16, y=1-k/16, width=1/16, height=1/16, just=c(right, bottom))) eval(parse(text=paste('grid.text(\\u', i, digits[k], digits[j], ')', sep=))) popViewport() } } } That is a nice tool for looking at the font glyphs, which I can see being very useful in working out which unicode number matches the character you want to display. I'm not too clued up on grid graphics yet, would it be easy to modify the above to print out the \u code above each glyph? I have also tried plotting to a pdf device with a font family that the character map tool shows I have a per mille glyph for, e.g.: pdf(~/tmp/test_per_mille.pdf, paper = a4, family = URWBookman) plot(1:10, ylab = \u2030) dev.off() But all I get here is a period or a dot-like symbol. This is an encoding problem I think. For producing PDF output, the character string gets converted to a single-byte encoding. If your default locale is ISOLatin1 like mine then you won't see the per mille because that character (called perthousand in the Adobe afm's) is not in the ISOLatin1 encoding. If you explicitly use an encoding that does include perthousand (like WinAnsi) then the conversion to single-byte encoding works. For example, this works (for me at least) ... pdf(WinAnsi_per_mille.pdf, encoding=WinAnsi) plot(1:10, ylab = \u2030) dev.off() Paul Thanks for this, which works fine for me also. All the best, G I've tried this in R 2.4.0 alpha [4] and R 2.5.0 to be [4] as my self-compiled R 2.3.1-patched dies when plotting Unicode characters (fixed in 2.4.0 alpha and above [3]) Can anyone point me in the right direction to get this working? TIA, G [1] http://finzi.psych.upenn.edu/R/Rhelp02a/archive/48709.html [2] like a % but with 2 circles at the bottom not one, see http://en.wikipedia.org/wiki/Permille [3] see thread at http://article.gmane.org/gmane.comp.lang.r.devel/9704 [4] R version 2.4.0 alpha (2006-09-19 r39410) [5] R version 2.5.0 Under development (unstable) (2006-09-19 r39410) -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC ENSIS, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R CMD check fails at package dependencies check on Fedora Core 5, works on other systems
Marc Schwartz (via MN) writes: On Tue, 2006-09-19 at 22:16 +1000, Robert King wrote: Here is another thing that might help work out what is happening. If I use --no-install, ade4 actually fails as well, in the same way as zipfR. [Desktop]$ R CMD check --no-install ade4 * checking for working latex ... OK * using log directory '/home/rak776/Desktop/ade4.Rcheck' * using Version 2.3.1 (2006-06-01) * checking for file 'ade4/DESCRIPTION' ... OK * this is package 'ade4' version '1.4-1' * checking if this is a source package ... OK * checking package directory ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking DESCRIPTION meta-information ... ERROR [Desktop]$ R CMD check --no-install zipfR * checking for working latex ... OK * using log directory '/home/rak776/Desktop/zipfR.Rcheck' * using Version 2.3.1 (2006-06-01) * checking for file 'zipfR/DESCRIPTION' ... OK * checking extension type ... Package * this is package 'zipfR' version '0.6-0' * checking if this is a source package ... OK * checking package directory ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking DESCRIPTION meta-information ... ERROR snip Robert, I tried the process last night (my time) using the initial instructions on my FC5 system with: $ R --version R version 2.3.1 Patched (2006-08-06 r38829) Copyright (C) 2006 R Development Core Team I could not replicate the problem. However, this morning, with your additional communication: $ R CMD check --no-install zipfR_0.6-0.tar.gz * checking for working latex ... OK * using log directory '/home/marcs/Downloads/zipfR.Rcheck' * using Version 2.3.1 Patched (2006-08-06 r38829) * checking for file 'zipfR/DESCRIPTION' ... OK * checking extension type ... Package * this is package 'zipfR' version '0.6-0' * checking if this is a source package ... OK * checking package directory ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for syntax errors ... OK * checking R files for library.dynam ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking Rd files ... OK * checking Rd cross-references ... WARNING Warning in grep(pattern, x, ignore.case, extended, value, fixed, useBytes) : input string 70 is invalid in this locale * checking for missing documentation entries ... WARNING Warning in grep(pattern, x, ignore.case, extended, value, fixed, useBytes) : input string 70 is invalid in this locale All user-level objects in a package should have documentation entries. See chapter 'Writing R documentation files' in manual 'Writing R Extensions'. * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking DVI version of manual ... OK WARNING: There were 2 warnings, see /home/marcs/Downloads/zipfR.Rcheck/00check.log for details So I am wondering if this raises the possibility of a locale issue on your FC5 system resulting in a problem reading DESCRIPTION files? It may be totally unrelated, but one never knows I suppose. Mine is: $ locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LC_NUMERIC=en_US.UTF-8 LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8 LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8 LC_ALL= HTH, Marc Schwartz That's a bug in tools:::Rd_aliases (it needs to preprocess the Rd lines, which re-encodes if necessary and possible). I'll commit a fix later today. Thanks for spotting this. Best -k __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Step procedure and Akaike information criterion
Please can you help me I have the following problem: I have selected an lm model through the step procedure which visualize for each step the AIC value; then I have calculated for the initial model and the selected one the AIC using the funnction AIC. The results are different.What's happened? Emilia Rocco Dipartimento di Statistica G. Parenti Università di Firenze e-mail: [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Step procedure and Akaike information criterion
compare ?AIC with ?extractAIC, which explains the difference. On 20/09/06, Emilia Rocco [EMAIL PROTECTED] wrote: Please can you help me I have the following problem: I have selected an lm model through the step procedure which visualize for each step the AIC value; then I have calculated for the initial model and the selected one the AIC using the funnction AIC. The results are different.What's happened? Emilia Rocco Dipartimento di Statistica G. Parenti Università di Firenze e-mail: [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem in font
Em Segunda 18 Setembro 2006 10:02, Uwe Ligges escreveu: Ronaldo Reis-Jr. wrote: Hi, But, I have this warning in the enviromnent that have this problem: During startup - Warning message: using .GlobalEnv instead of 'package:lattice' So, can you please be a bit more specific? R version, your startup files such as Rprofile files etc? Uwe Ligges maybe this is the problem? How to fix it? Thanks ROnaldo Hi all, I fix it, it was my fault. if I make dev.copy2eps(file.eps) I give the error, but if I make dev.copy2eps(file=file.eps) it work fine. Thanks for all and sorry by the fault problem :) Inte Ronaldo -- Música do Mudo e do Surdo: ``Eu quis dizer, você não quis escutar.'' -- Paralamas do Sucesso -- Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. Ecologia Evolutiva | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8190 | [EMAIL PROTECTED] | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Linux configuration (Ubuntu)
Uwe Ligges wrote: Brian Edward wrote: Hello all, I have been a R user for about a year now, running on a MS Windows machine. I am in the process of making a complete switch to open-source. Linux is a new world to me. Ubuntu was my selection of the various distributions. Please pardon this very basic question (I was unable to locate an answer on R or Ubuntu). I used Synaptic to download the necessary files to run. However, I was unable to locate the program using the Add/Remove feature. So, I created a Launcher for R on the desktop and identified the executable file. The path I entered into the Command Line was: /usr/bin/R I can run R in the Terminal, but not as a separate desktop location. So, the short question is, what is the specific command line or configuration I should be using to run R? Or, am I supposed to be running R in the Terminal? Short answer: yes, long answer, yes, unless you want to use some very capable editor as an environment such ass Emacs + ESS. Look up the documentation and the list archives fo details on Emacs and ESS. Uwe Ligges The kate editor (a Linux KDE tool that also runs fine under Gnome) also works well with R. Just set the editor option to use spaces instead of tab characters or the submission of code to an R session will not work properly. I set a customized shortcut of Alt-r to submit code to kate's shell window at the bottom of the screen, after manually launching R in that window. After R starts you can manage help files nicely using help.start() to use a browser. I often use dillo, the world's fastest graphical browser, by specifying options(browser='dillo') before help.start(). Frank Thanks in advance, Brian -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Stats question - cox proportional hazards adjustments
Geoff Russell [EMAIL PROTECTED] writes: Hi useRs, Many studies of the link between red meat and colorectal cancer use Cox proportional hazards with (among other things) a gender covariate. If it is true that men eat more red meat, drink more alcohol and smoke more than women, and if it is also true that alcohol and tobacco are known risk factors then why does it make sense to adjust for gender? I would think that in this case some of the risk that should be properly attributed to the bad habits will actually end up being attributed to being male instead. This is more than a bit off-topic for the list, but in (very) brief: Because you need to get rid of purely gender related effects that disturb the analysis and may create spurious association. Otherwise you would become able to prove effects like stiletto heels causing breast cancer, etc. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Variable im Data Frame Namen
assign(paste(week, 28, sep=), data.frame(a=1:2, b=3:4, cc=letters[5:6])) week28 a b cc 1 1 3 e 2 2 4 f __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Linux configuration (Ubuntu)
Frank E Harrell Jr wrote: SNIP After R starts you can manage help files nicely using help.start() to use a browser. I often use dillo, the world's fastest graphical browser, by specifying options(browser='dillo') before help.start(). WOW - dillo is BRILLIANT for this purpose. Thanks for the tip! Do you have any idea on how to convince dillo to reuse the same browser window again instead of using a new one when using ? ? Frank Thanks in advance, Brian -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Simulation help
I'm trying to simulate trend data over a five year period. I want different trend profiles...the simplest being a linear trend. I've been using the following code: patBdta1 - NULL for(i in 1:100) patBdta1 - rbind(patBdta1,c(yr1= mean(rbinom(50,1,.50)), yr2 =mean(rbinom(50,1,.51)), yr3 =mean(rbinom(50,1,.52)), yr4 =mean(rbinom(50,1,.53)), yr5 =mean(rbinom(50,1,.54 This code creates 100 data sets each with a 5 yr binomial trend profile with a slope of approximately .01. Now, what I want to do is pass this code (or some code) in such a way that I can simulate various trend slopes (i.e., pass in a loop or vectorize vs. copying/repeating code for each slope). Any guidance is much appreciated. Thanks! Marc Marc W. Zodet, MS Senior Health Statistician Agency for Healthcare Research and Quality [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Linux configuration (Ubuntu)
UweL == Uwe Ligges [EMAIL PROTECTED] on Wed, 20 Sep 2006 01:03:30 +0200 writes: UweL Brian Edward wrote: Hello all, I have been a R user for about a year now, running on a MS Windows machine. I am in the process of making a complete switch to open-source. Linux is a new world to me. Ubuntu was my selection of the various distributions. Please pardon this very basic question (I was unable to locate an answer on R or Ubuntu). I used Synaptic to download the necessary files to run. However, I was unable to locate the program using the Add/Remove feature. So, I created a Launcher for R on the desktop and identified the executable file. The path I entered into the Command Line was: /usr/bin/R I can run R in the Terminal, but not as a separate desktop location. So, the short question is, what is the specific command line or configuration I should be using to run R? Or, am I supposed to be running R in the Terminal? UweL Short answer: yes, long answer, yes, unless you want to use some very UweL capable editor as an environment such ass Emacs + ESS. Look up the UweL documentation and the list archives fo details on Emacs and ESS. Of course, I'm strongly suggesting the unless, i.e. using Emacs + ESS. Further note that Ubuntu (as all other Linux distributions derived from Debian) provides ESS as a standard package you can simply install, e.g., via Synaptic. Note that you need to activate the 'Universe' {in the sources that Synaptic or other package installers search} for that, but I assume you've done that anyway for the R-related ubuntu packages. And yes, I believe Ubuntu is a very good choice when upgrading from Windows! Martin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Calculating mean together with split
Hi I have a table called npl containing results of simulations. It contains about 19000 entries and the structure looks like this: NoPlants sim run year DensPlants 16 lng_cs99_renosterbos 140.00192 . . . it has 43 different entries for sim and year goes from 1 to 100, and run from 1 to 5. I would like to calculate the mean of DensPlants for each simulation and each year seperately, i.e. calculating the mean for all combinations of sim and year over run. I can use split(npl, npl$sim) to split npl into different groups each containing the entries for one parameterset - but where to go from there? Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Stats question - cox proportional hazards adjustments
Peter et al, Thanks for the reply, I did reread the posting guide before posting and figured it was a short question and might just have a short answer. I have Therneau's book on order, which will probably clarify the matter in time. I understand stratifying to deal with confounding, but not adding it as a covariate in a regression. e.g, If one of the gender related effects you mention happens to be drinking, then we don't want to get rid of it, it may well be an additional covariate and we want its full effect embodied in the b value for that covariate. I'll keep reading! Cheers, Geoff On 20 Sep 2006 14:47:00 +0200, Peter Dalgaard [EMAIL PROTECTED] wrote: Geoff Russell [EMAIL PROTECTED] writes: Hi useRs, Many studies of the link between red meat and colorectal cancer use Cox proportional hazards with (among other things) a gender covariate. If it is true that men eat more red meat, drink more alcohol and smoke more than women, and if it is also true that alcohol and tobacco are known risk factors then why does it make sense to adjust for gender? I would think that in this case some of the risk that should be properly attributed to the bad habits will actually end up being attributed to being male instead. This is more than a bit off-topic for the list, but in (very) brief: Because you need to get rid of purely gender related effects that disturb the analysis and may create spurious association. Otherwise you would become able to prove effects like stiletto heels causing breast cancer, etc. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calculating mean together with split
Have a look at the function aggregate.table in the package gtools (part of the gregmisc bundle). On 20/09/06, Rainer M Krug [EMAIL PROTECTED] wrote: Hi I have a table called npl containing results of simulations. It contains about 19000 entries and the structure looks like this: NoPlants sim run year DensPlants 16 lng_cs99_renosterbos 140.00192 . . . it has 43 different entries for sim and year goes from 1 to 100, and run from 1 to 5. I would like to calculate the mean of DensPlants for each simulation and each year seperately, i.e. calculating the mean for all combinations of sim and year over run. I can use split(npl, npl$sim) to split npl into different groups each containing the entries for one parameterset - but where to go from there? Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calculating mean together with split
Sorry, that should have been package gdata, not gtools...they're both in the same bundle, though. On 20/09/06, Rainer M Krug [EMAIL PROTECTED] wrote: Hi I have a table called npl containing results of simulations. It contains about 19000 entries and the structure looks like this: NoPlants sim run year DensPlants 16 lng_cs99_renosterbos 140.00192 . . . it has 43 different entries for sim and year goes from 1 to 100, and run from 1 to 5. I would like to calculate the mean of DensPlants for each simulation and each year seperately, i.e. calculating the mean for all combinations of sim and year over run. I can use split(npl, npl$sim) to split npl into different groups each containing the entries for one parameterset - but where to go from there? Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Simulation help
This should work. I try to avoid for loops because large (or nested) for loops tend to consume a lot of memory. one.dataset - function(dummy = 0, slope = 0.01){ return(c(yr1= mean(rbinom(50,1,.5)), yr2 =mean(rbinom(50,1,.5 + slope)), yr3 =mean(rbinom(50,1,.5 + 2 * slope)), yr4 =mean(rbinom(50,1,.5 + 3 * slope)), yr5 =mean(rbinom(50,1,.5 + 4 * slope } datasets.slope01 - t(sapply(1:100, one.dataset, slope = 0.01)) datasets.slope05 - t(sapply(1:100, one.dataset, slope = 0.05)) Cheers, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 [EMAIL PROTECTED] www.inbo.be -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Zodet, Marc W. (AHRQ) Verzonden: woensdag 20 september 2006 15:29 Aan: r-help@stat.math.ethz.ch Onderwerp: [R] Simulation help I'm trying to simulate trend data over a five year period. I want different trend profiles...the simplest being a linear trend. I've been using the following code: patBdta1 - NULL for(i in 1:100) patBdta1 - rbind(patBdta1,c(yr1= mean(rbinom(50,1,.50)), yr2 =mean(rbinom(50,1,.51)), yr3 =mean(rbinom(50,1,.52)), yr4 =mean(rbinom(50,1,.53)), yr5 =mean(rbinom(50,1,.54 This code creates 100 data sets each with a 5 yr binomial trend profile with a slope of approximately .01. Now, what I want to do is pass this code (or some code) in such a way that I can simulate various trend slopes (i.e., pass in a loop or vectorize vs. copying/repeating code for each slope). Any guidance is much appreciated. Thanks! Marc Marc W. Zodet, MS Senior Health Statistician Agency for Healthcare Research and Quality [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calculating mean together with split
Of course, aggregate will work too, depends on how you want the output to be formatted. You could also look at summarize in the Hmisc package. On 20/09/06, David Barron [EMAIL PROTECTED] wrote: Sorry, that should have been package gdata, not gtools...they're both in the same bundle, though. On 20/09/06, Rainer M Krug [EMAIL PROTECTED] wrote: Hi I have a table called npl containing results of simulations. It contains about 19000 entries and the structure looks like this: NoPlants sim run year DensPlants 16 lng_cs99_renosterbos 140.00192 . . . it has 43 different entries for sim and year goes from 1 to 100, and run from 1 to 5. I would like to calculate the mean of DensPlants for each simulation and each year seperately, i.e. calculating the mean for all combinations of sim and year over run. I can use split(npl, npl$sim) to split npl into different groups each containing the entries for one parameterset - but where to go from there? Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Stats question - cox proportional hazards adjustments
Geroff, The answer to your question is that the answer depends on the question that you wish to ask. If you want to know if men have a higher probability of mortality (or mortality rate) than women after taking into account differential alcohol use, red meat consumption, etc. by sex then you would adjust for these factors. If your question is do men have a higher probability of mortality than women then you would not adjust for the various potential confounders. Adjusting for confounders can be very important. Consider a study of coffee drinking as a factor influencing mortality. Such a study may well find that coffee drinking is related to mortality, even if coffee drinking is completely innocuous. Why might this be so? Smoking is associated with mortality, and smoking is associated with coffee drinking (some people smoke while the drink coffee). If you fail to adust for smoking, you may be lead to an incorrect inference about the relation between coffee and mortality. I hope this helps. John John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics Baltimore VA Medical Center GRECC, University of Maryland School of Medicine Claude D. Pepper OAIC, University of Maryland Clinical Nutrition Research Unit, and Baltimore VA Center Stroke of Excellence University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) [EMAIL PROTECTED] Geoff Russell [EMAIL PROTECTED] 9/20/2006 9:54 AM Peter et al, Thanks for the reply, I did reread the posting guide before posting and figured it was a short question and might just have a short answer. I have Therneau's book on order, which will probably clarify the matter in time. I understand stratifying to deal with confounding, but not adding it as a covariate in a regression. e.g, If one of the gender related effects you mention happens to be drinking, then we don't want to get rid of it, it may well be an additional covariate and we want its full effect embodied in the b value for that covariate. I'll keep reading! Cheers, Geoff On 20 Sep 2006 14:47:00 +0200, Peter Dalgaard [EMAIL PROTECTED] wrote: Geoff Russell [EMAIL PROTECTED] writes: Hi useRs, Many studies of the link between red meat and colorectal cancer use Cox proportional hazards with (among other things) a gender covariate. If it is true that men eat more red meat, drink more alcohol and smoke more than women, and if it is also true that alcohol and tobacco are known risk factors then why does it make sense to adjust for gender? I would think that in this case some of the risk that should be properly attributed to the bad habits will actually end up being attributed to being male instead. This is more than a bit off-topic for the list, but in (very) brief: Because you need to get rid of purely gender related effects that disturb the analysis and may create spurious association. Otherwise you would become able to prove effects like stiletto heels causing breast cancer, etc. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R ( http://www.r/ )-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Confidentiality Statement: This email message, including any attachments, is\ for the s...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calculating mean together with split
Hi David aggregate is what I was looking for, as I wanted to have it in the tabular format to plot it. Thanks Rainer David Barron wrote: Of course, aggregate will work too, depends on how you want the output to be formatted. You could also look at summarize in the Hmisc package. On 20/09/06, David Barron [EMAIL PROTECTED] wrote: Sorry, that should have been package gdata, not gtools...they're both in the same bundle, though. On 20/09/06, Rainer M Krug [EMAIL PROTECTED] wrote: Hi I have a table called npl containing results of simulations. It contains about 19000 entries and the structure looks like this: NoPlants sim run year DensPlants 16 lng_cs99_renosterbos 140.00192 . . . it has 43 different entries for sim and year goes from 1 to 100, and run from 1 to 5. I would like to calculate the mean of DensPlants for each simulation and each year seperately, i.e. calculating the mean for all combinations of sim and year over run. I can use split(npl, npl$sim) to split npl into different groups each containing the entries for one parameterset - but where to go from there? Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Beginners manual for emacs and ess
Hi I heard so much about Emacs and ESS that I decided to try it out - but I am stuck at the beginning. Is there anywhere a beginners manual for Emacs ESS to be used with R? even M-x S tells me it can't start S-Plus - obviously - but I want it to start R... Any help welcome (otherwise I will be stuck with Eclipse and R) Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] variance functions in glmmPQL or glm?
Hello R users- I am new to R, and tried searching the archives and literature for an answer to this - please be patient if I missed something obvious. I am fitting a logistic regression model, and would like to include variance functions (specifically the varIdent function). I cannot figure out how to do this either in glmmPQL (or something similar) for the model with random effects, or in glm for the model without random effects. Is it possible to fit a varIdent function in a generalized linear model? If so, what are the appropriate packages/functions to use? Any help would be appreciated. Thank you, Gretchen Anderson M.Sc. Candidate Dept. of Fisheries and Wildlife Michigan State University 13 Natural Resources Building East Lansing, MI 48824 Phone: (517) 353-0731 E-Mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] local intallation of MSBVAR_0.2.0.tar.gz
Hello, can someone tell me how to install a package like MSBVAR_0.2.0.tar.gz locllay ? thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R CMD check fails at package dependencies check on Fedora Core 5, works on other systems
On Wed, 2006-09-20 at 13:20 +0200, Kurt Hornik wrote: Marc Schwartz (via MN) writes: On Tue, 2006-09-19 at 22:16 +1000, Robert King wrote: Here is another thing that might help work out what is happening. If I use --no-install, ade4 actually fails as well, in the same way as zipfR. [Desktop]$ R CMD check --no-install ade4 * checking for working latex ... OK * using log directory '/home/rak776/Desktop/ade4.Rcheck' * using Version 2.3.1 (2006-06-01) * checking for file 'ade4/DESCRIPTION' ... OK * this is package 'ade4' version '1.4-1' * checking if this is a source package ... OK * checking package directory ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking DESCRIPTION meta-information ... ERROR [Desktop]$ R CMD check --no-install zipfR * checking for working latex ... OK * using log directory '/home/rak776/Desktop/zipfR.Rcheck' * using Version 2.3.1 (2006-06-01) * checking for file 'zipfR/DESCRIPTION' ... OK * checking extension type ... Package * this is package 'zipfR' version '0.6-0' * checking if this is a source package ... OK * checking package directory ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking DESCRIPTION meta-information ... ERROR snip Robert, I tried the process last night (my time) using the initial instructions on my FC5 system with: $ R --version R version 2.3.1 Patched (2006-08-06 r38829) Copyright (C) 2006 R Development Core Team I could not replicate the problem. However, this morning, with your additional communication: $ R CMD check --no-install zipfR_0.6-0.tar.gz * checking for working latex ... OK * using log directory '/home/marcs/Downloads/zipfR.Rcheck' * using Version 2.3.1 Patched (2006-08-06 r38829) * checking for file 'zipfR/DESCRIPTION' ... OK * checking extension type ... Package * this is package 'zipfR' version '0.6-0' * checking if this is a source package ... OK * checking package directory ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for syntax errors ... OK * checking R files for library.dynam ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking Rd files ... OK * checking Rd cross-references ... WARNING Warning in grep(pattern, x, ignore.case, extended, value, fixed, useBytes) : input string 70 is invalid in this locale * checking for missing documentation entries ... WARNING Warning in grep(pattern, x, ignore.case, extended, value, fixed, useBytes) : input string 70 is invalid in this locale All user-level objects in a package should have documentation entries. See chapter 'Writing R documentation files' in manual 'Writing R Extensions'. * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking DVI version of manual ... OK WARNING: There were 2 warnings, see /home/marcs/Downloads/zipfR.Rcheck/00check.log for details So I am wondering if this raises the possibility of a locale issue on your FC5 system resulting in a problem reading DESCRIPTION files? It may be totally unrelated, but one never knows I suppose. Mine is: $ locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LC_NUMERIC=en_US.UTF-8 LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8 LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8 LC_ALL= HTH, Marc Schwartz That's a bug in tools:::Rd_aliases (it needs to preprocess the Rd lines, which re-encodes if necessary and possible). I'll commit a fix later today. Thanks for spotting this. Best -k Thanks for noting this Kurt! Regards, Marc __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Beginners manual for emacs and ess
On Wed, 2006-09-20 at 17:03 +0200, Rainer M Krug wrote: Hi I heard so much about Emacs and ESS that I decided to try it out - but I am stuck at the beginning. Is there anywhere a beginners manual for Emacs ESS to be used with R? even M-x S tells me it can't start S-Plus - obviously - but I want it to start R... Any help welcome (otherwise I will be stuck with Eclipse and R) Rainer There are some reference materials on the main ESS site at: http://ess.r-project.org/ In addition, there is a dedicated ESS mailing list, with more info here: https://stat.ethz.ch/mailman/listinfo/ess-help HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [Rd] Sweave processes \Sexpr in commented LaTeX source (2.3.1patched and 2.4.0)
On Wed, 2006-09-20 at 09:09 +0200, Antonio, Fabio Di Narzo wrote: Hi. 2006/9/20, Marc Schwartz [EMAIL PROTECTED]: Hi all, On FC5, using: Version 2.3.1 Patched (2006-08-06 r38829) and today's R version 2.4.0 alpha (2006-09-19 r39397) with the following .Rnw file: \documentclass[10pt]{article} \begin{document} This line should print '2': \Sexpr{1 + 1} %% This line should NOT print '2': \Sexpr{1 + 1} If it's just a comment, why don't use something like: % \ Sexpr (del the space) or %\sexpr (change 'sexpr' with 'Sexpr') or %...the 'Sexpr' command (add a backslash in latex code) ? Antonio. See my comments in this post on r-devel, where this thread was originally started: https://stat.ethz.ch/pipermail/r-devel/2006-September/039416.html HTH, Marc __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] local intallation of MSBVAR_0.2.0.tar.gz
Hello, can someone tell me how to install a package like MSBVAR_0.2.0.tar.gz locllay ? thanks - Originalnachricht - Von: Rainer M Krug [EMAIL PROTECTED] Datum: Mittwoch, September 20, 2006 11:06 am Betreff: Re: [R] Calculating mean together with split An: David Barron [EMAIL PROTECTED] CC: r-help r-help@stat.math.ethz.ch Hi David aggregate is what I was looking for, as I wanted to have it in the tabular format to plot it. Thanks Rainer David Barron wrote: Of course, aggregate will work too, depends on how you want the output to be formatted. You could also look at summarize in the Hmisc package. On 20/09/06, David Barron [EMAIL PROTECTED] wrote: Sorry, that should have been package gdata, not gtools...they're both in the same bundle, though. On 20/09/06, Rainer M Krug [EMAIL PROTECTED] wrote: Hi I have a table called npl containing results of simulations. It contains about 19000 entries and the structure looks like this: NoPlants sim run year DensPlants 16 lng_cs99_renosterbos 140.00192 . . . it has 43 different entries for sim and year goes from 1 to 100, and run from 1 to 5. I would like to calculate the mean of DensPlants for each simulation and each year seperately, i.e. calculating the mean for all combinations of sim and year over run. I can use split(npl, npl$sim) to split npl into different groups each containing the entries for one parameterset - but where to go from there? Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel: +27 - (0)72 808 2975 (w) Fax: +27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email:[EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.htmland provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Comment blocks in R programs
All, Is there a way to add comment blocks in an R script other than using # at the beginning of each line? Or, is there anything like ndocs for C++ and the markup for Java that can generate documentation? This may be a bad question, but I have searched R documentation and can't seem to find an Answer. I have also looked at the R package documentation mark up docs for help files but that was more than I wanted. thank you for you help. Joe __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] local intallation of MSBVAR_0.2.0.tar.gz
On Wed, 2006-09-20 at 11:12 -0400, [EMAIL PROTECTED] wrote: Hello, can someone tell me how to install a package like MSBVAR_0.2.0.tar.gz locllay ? thanks Unix/Linux or Windows? If Windows, forget the tar.gz file (unless you are set up to compile source code), you'd probably be better off with the zip binary. Download it instead and then look at the menus in R-GUI for the option to install from local zip file - I rarely use Windows these days so forget which menu it is in now. If Unix/linux, then: R CMD INSTALL MSBVAR_0.2.0tar.gz or R CMD INSTALL -l /path/to/lib MSBVAR_0.2.0tar.gz will do what you want, the -l /path thingy allows you to install to a specified library. All this is explained in the R Installation and Administration manual, that you can find here (html): http://cran.r-project.org/doc/manuals/R-admin.html HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC ENSIS, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Comment blocks in R programs
Try this: if (FALSE) { ... whatever ... } On 9/20/06, Joe Byers [EMAIL PROTECTED] wrote: All, Is there a way to add comment blocks in an R script other than using # at the beginning of each line? Or, is there anything like ndocs for C++ and the markup for Java that can generate documentation? This may be a bad question, but I have searched R documentation and can't seem to find an Answer. I have also looked at the R package documentation mark up docs for help files but that was more than I wanted. thank you for you help. Joe __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calculating mean together with split
It contains about 19000 entries and the structure looks like this: NoPlants sim run year DensPlants 16 lng_cs99_renosterbos 140.00192 . . . it has 43 different entries for sim and year goes from 1 to 100, and run from 1 to 5. I would like to calculate the mean of DensPlants for each simulation and each year seperately, i.e. calculating the mean for all combinations of sim and year over run. You can do this pretty easily with the reshape package: library(reshape) dfm - rename(df, c(DensPlants = value)) # this is the form that reshape wants # Then try one of these: cast(dfm, year ~ sim) cast(dfm, year + sim ~ . ) cast(dfm, year ~ sim, margins=TRUE) Depending on what format you want the resulting summaries in. Hadley __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Comment blocks in R programs
I should have noted that the ...whatever... must be valid R. You could also do this: Here are some comments. On 9/20/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: if (FALSE) { ... whatever ... } On 9/20/06, Joe Byers [EMAIL PROTECTED] wrote: All, Is there a way to add comment blocks in an R script other than using # at the beginning of each line? Or, is there anything like ndocs for C++ and the markup for Java that can generate documentation? This may be a bad question, but I have searched R documentation and can't seem to find an Answer. I have also looked at the R package documentation mark up docs for help files but that was more than I wanted. thank you for you help. Joe __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Comment blocks in R programs
Gabor Grothendieck wrote: Try this: if (FALSE) { ... whatever ... } Problem is, ... whatever ... must be syntactically correct to use that trick. Why not using a text editor that does rectangular selection or commenting several lines at a time, there are many out there to propose that kind of feature. Cheers, Romain On 9/20/06, Joe Byers [EMAIL PROTECTED] wrote: All, Is there a way to add comment blocks in an R script other than using # at the beginning of each line? Or, is there anything like ndocs for C++ and the markup for Java that can generate documentation? This may be a bad question, but I have searched R documentation and can't seem to find an Answer. I have also looked at the R package documentation mark up docs for help files but that was more than I wanted. thank you for you help. Joe -- *mangosolutions* /data analysis that delivers/ Tel +44 1249 467 467 Fax +44 1249 467 468 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] acos(0.5) == pi/3 FALSE
On Tue, 19 Sep 2006, Johannes H?sing wrote: Peter Dalgaard: Ben Bolker [EMAIL PROTECTED] writes: 1. compose your response I've always wondered why step 1. - often the time-consuming bit - is not listed last. The advice applies to the situation when answering immediately would be your knee-jerk reaction. It is assumed that actually composing and sending the mail would take very little time and thought, whereas coming around to answering it after runif(1)*4 hours would take considerably more time, even when mulitiplied with the probability that you are still the first one. Looking at the submission times of questions and answers in this particular case, though, I would be upset if the helpful guys actually used this algorithm. Most of the answers were submitted after 3.5 to 4 h time, thus revealing a possible flaw of the random number generator underlying runif(). Johannes, Turn on 'full-headers' in your email reader. Most of the replies were submitted within 20 minutes of the posting of the original query by the list-serv (to me and I assume to others) and several that said essentially the same thing were posted within the first 10 minutes, I recall. The list-serv held the initial email for a couple of hours before passing it on. The replies are processed more rapidly, being held at most a few minutes each. Given the initial hold placed on that email, runif(1)*4 hours would have increased the overall response time (from time of initial posting to time of first response) by less than 25% (with high probability). And would have saved several respondents from having to type up their replies. In this case even runif(1)*20 minutes would likely have cut the response traffic to one or two and would have increased the overall response time by less than 10 minutes. Chuck __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0717 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Union of two data frames
Kartik Pappu kartik.pappu at gmail.com writes: Essentially, I want to make a union of the two data frames. I hope this question makes sense. See merge(...), and have a look at R intro. Also check documentation for Design package. Anupam. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Linux configuration (Ubuntu)
Rainer M Krug wrote: Frank E Harrell Jr wrote: SNIP After R starts you can manage help files nicely using help.start() to use a browser. I often use dillo, the world's fastest graphical browser, by specifying options(browser='dillo') before help.start(). WOW - dillo is BRILLIANT for this purpose. Thanks for the tip! Do you have any idea on how to convince dillo to reuse the same browser window again instead of using a new one when using ? ? Good question. No, don't know. Hope someone can figure it out. By the way a handy use of kate is kate -u from the command line to open a file into an existing kate session, or start a session if needed. Frank Frank Thanks in advance, Brian __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Beginners manual for emacs and ess
Rainer M Krug rkrug at sun.ac.za writes: Is there anywhere a beginners manual for Emacs ESS to be used with R? even M-x S tells me it can't start S-Plus - obviously - but I want it to start R... Please also look at John Fox's Xemacs+ESS intro. http://socserv.mcmaster.ca/jfox/Books/Companion/ESS/ Anupam. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calculating mean together with split
# Then try one of these: cast(dfm, year ~ sim) cast(dfm, year + sim ~ . ) cast(dfm, year ~ sim, margins=TRUE) Oops that should be: dfm - rename(df, c(DensPlants = value)) cast(dfm, year ~ sim, mean) cast(dfm, year + sim ~ . , mean) cast(dfm, year ~ sim, mean, margins=TRUE) (Thanks for pointing that out Gabor!) Hadley __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help with function
Hello everyone, I have a function here that I wrote but doesn't seem to work quite right. Attached is the code. In the calib funcion under the for loop Bt[i+2]-(1-m)*Bt[i+1]+Rt[i]*Rerr-Ct[i+1] returns NA's for everything after years 1983 and 1984. However the code works when it reads Bt[i+2]-(1-m)*Bt[i+1]+Rt[i]*Rerr-Ct[i]. I don't quite understand why since it should be calculating all of the necessary inputs prior to calculating Bt[i+2]. Any help would be greatly appreciated. Thanks #Model parameters B0-7500 m-0.3 R0-B0*m z-0.8 a-B0/R0*(1-(z-0.2)/(0.8*z)) b-(z-0.2)/(0.8*z*R0) dat-data.frame(years=seq(1983,2004),cobs=c(19032324,19032324,17531618,2 0533029,20298099,20793744,23519369,23131780,19922247,17274513,17034419,1 2448318,4551585,4226451,7183688,7407924,7538366,7336039,8869193,7902341, 6369089,6211886)) stdr-runif(100,0,0.5) stdc-runif(100,0,0.5) BC-runif(1000,0,100) #model calibration calib-function(x){ v-sample(stdr,1) cr-sample(stdc,1) N-rnorm(1) Bq-sample(BC,1) Rerr-exp(N*v-(v^2/2)) Cerr-exp(N*cr-(cr^2/2)) Bt-vector();Bt[1]=B0;Bt[2]=B0 Rt-vector() Ct-vector() for (i in 1:length(x$years)){ Ct[i]-1/Bq*Bt[i]*Cerr Rt[i]-Bt[i]/(a+b*Bt[i]) Bt[i+2]-(1-m)*Bt[i+1]+Rt[i]*Rerr-Ct[i+1] } out-new.env() out$yr-x$years[1:length(x$years)] out$Bt-Bt[1:length(x$years)] out$Rt-Rt[1:length(x$years)] out$Ct-Ct[1:length(x$years)] out$stdr-v out$stdc-cr out$Bq-Bq out$Rerr-Rerr out$Cerr-Cerr return(as.list(out)) } test-calib(dat) Cameron Guenther, Ph.D. Associate Research Scientist FWC/FWRI, Marine Fisheries Research 100 8th Avenue S.E. St. Petersburg, FL 33701 (727)896-8626 Ext. 4305 [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Linux configuration (Ubuntu)
On 20 September 2006 at 15:42, Martin Maechler wrote: | Further note that Ubuntu (as all other Linux distributions | derived from Debian) provides ESS as a standard package you can | simply install, e.g., via Synaptic. | Note that you need to activate the 'Universe' | {in the sources that Synaptic or other package installers | search} for that, but I assume you've done that anyway for the | R-related ubuntu packages. At this point, it may be worth recalling that there are -- eleven 'core' R packages incl documentation and r-mathlib -- around 80 CRAN packages ready to install to extend R -- packages for ess as mentioned in this thread -- RPy (R from Python) support via the python-rpy package -- Ggobi via the ggobi package -- and even R inside PostgreSQL via postgresql-$VER-plr for Debian and Ubuntu. Not everything may be available at all 'flavours' but Debian testing and Ubuntu dapper are well covered. | And yes, I believe Ubuntu is a very good choice when upgrading | from Windows! Yup, though I personally prefer KUbuntu. That said, all indications are that the new Debian installer will be very powerful. Hopefully in December ... Dirk -- Hell, there are no rules here - we're trying to accomplish something. -- Thomas A. Edison __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Adding percentage to Pie Charts (was (no subject))
Greg Snow Greg.Snow at intermountainmail.org writes: Have you read the books by Cleveland? I do not recall reading Cleveland's book; I have read one by Tufte. You raise some interesting issues there. I agree with some, I could not clearly understand some other things you mention. I think visual perception is aquired, in part. So if I were presenting data to viewers who took carpentry or other such classes in highschool I may be tempted to use dotcarts. An interesting experiment: have kids compare pieces of pie or bread-sticks over a dinner, and check how they do. They should not have taken a carpentry class. I use dot-charts, they are useful. Sometimes pie carts are useful too, because people are so used to using and seeing them over a long time. Ofcourse, they can be improved. Also, it may be possible to put points of a dot-chart on a single straight line, label them with a pointing line, and get better perception. There is poor perception of the horizantal distance, by having to view that extra vertical distance in a dotchart. However, it is useful to have the vertical axis in Lattice plots, but not in stand-alone dot-charts. Anupam. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help with function
Take the case of i==1. Ct[i]-1/Bq*Bt[i]*Cerr # Assign Ct[1] using Bt[1] Rt[i]-Bt[i]/(a+b*Bt[i]) # Assign Rt[1] using Bt[1] Bt[i+2]-(1-m)*Bt[i+1]+Rt[i] *Rerr-Ct[i+1] # Assign Bt[3] using Bt[2] and Rt[1] and **Ct[2]** You're reading Ct[i+1] before you ever assign it, hence NA. OSISTM Hope this helps, Regards, Mike On 9/20/06, Guenther, Cameron [EMAIL PROTECTED] wrote: Hello everyone, I have a function here that I wrote but doesn't seem to work quite right. Attached is the code. In the calib funcion under the for loop Bt[i+2]-(1-m)*Bt[i+1]+Rt[i]*Rerr-Ct[i+1] returns NA's for everything after years 1983 and 1984. However the code works when it reads Bt[i+2]-(1-m)*Bt[i+1]+Rt[i]*Rerr-Ct[i]. I don't quite understand why since it should be calculating all of the necessary inputs prior to calculating Bt[i+2]. Any help would be greatly appreciated. Thanks #Model parameters B0-7500 m-0.3 R0-B0*m z-0.8 a-B0/R0*(1-(z-0.2)/(0.8*z)) b-(z-0.2)/(0.8*z*R0) dat-data.frame(years=seq(1983,2004),cobs=c(19032324,19032324,17531618,2 0533029,20298099,20793744,23519369,23131780,19922247,17274513,17034419,1 2448318,4551585,4226451,7183688,7407924,7538366,7336039,8869193,7902341, 6369089,6211886)) stdr-runif(100,0,0.5) stdc-runif(100,0,0.5) BC-runif(1000,0,100) #model calibration calib-function(x){ v-sample(stdr,1) cr-sample(stdc,1) N-rnorm(1) Bq-sample(BC,1) Rerr-exp(N*v-(v^2/2)) Cerr-exp(N*cr-(cr^2/2)) Bt-vector();Bt[1]=B0;Bt[2]=B0 Rt-vector() Ct-vector() for (i in 1:length(x$years)){ Ct[i]-1/Bq*Bt[i]*Cerr Rt[i]-Bt[i]/(a+b*Bt[i]) Bt[i+2]-(1-m)*Bt[i+1]+Rt[i]*Rerr-Ct[i+1] } out-new.env() out$yr-x$years[1:length(x$years)] out$Bt-Bt[1:length(x$years)] out$Rt-Rt[1:length(x$years)] out$Ct-Ct[1:length(x$years)] out$stdr-v out$stdc-cr out$Bq-Bq out$Rerr-Rerr out$Cerr-Cerr return(as.list(out)) } test-calib(dat) Cameron Guenther, Ph.D. Associate Research Scientist FWC/FWRI, Marine Fisheries Research 100 8th Avenue S.E. St. Petersburg, FL 33701 (727)896-8626 Ext. 4305 [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Regards, Mike Nielsen __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Comment delay time (was: acos(0.5) == pi/3 FALSE)
On 9/20/2006 11:54 AM, Charles C. Berry wrote: On Tue, 19 Sep 2006, Johannes H�sing wrote: Peter Dalgaard: Ben Bolker [EMAIL PROTECTED] writes: 1. compose your response I've always wondered why step 1. - often the time-consuming bit - is not listed last. The advice applies to the situation when answering immediately would be your knee-jerk reaction. It is assumed that actually composing and sending the mail would take very little time and thought, whereas coming around to answering it after runif(1)*4 hours would take considerably more time, even when mulitiplied with the probability that you are still the first one. Looking at the submission times of questions and answers in this particular case, though, I would be upset if the helpful guys actually used this algorithm. Most of the answers were submitted after 3.5 to 4 h time, thus revealing a possible flaw of the random number generator underlying runif(). Johannes, Turn on 'full-headers' in your email reader. Most of the replies were submitted within 20 minutes of the posting of the original query by the list-serv (to me and I assume to others) and several that said essentially the same thing were posted within the first 10 minutes, I recall. The list-serv held the initial email for a couple of hours before passing it on. The replies are processed more rapidly, being held at most a few minutes each. Given the initial hold placed on that email, runif(1)*4 hours would have increased the overall response time (from time of initial posting to time of first response) by less than 25% (with high probability). And would have saved several respondents from having to type up their replies. In this case even runif(1)*20 minutes would likely have cut the response traffic to one or two and would have increased the overall response time by less than 10 minutes. Perhaps the list server should have a configurable user-specific random delay time before posting a new thread. Users who don't want to risk wasting time on duplicate postings could ask not to see new threads until a random delay has passed. Followups to the threads that arrived during this waiting period would all be sent at once, so if you see a message doesn't have responses, you know it's safe to write one. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Building the call of an arbitrary function
Le Dimanche 17 Septembre 2006 14:12, Duncan Murdoch a écrit : On 9/17/2006 12:36 PM, Vincent Goulet wrote: Hy all, Is there a direct way to build the complete function call of an arbitrary function? Here's what I want to do. A function will build a function which will itself call a probability density function for some law given in argument to the first function: f(gamma, 1000) will return, say, function(x, shape, rate, scale = 1/rate) dgamma(x + 1000, shape, rate, scale = 1/rate) (Notice that the arguments of the output function are those of dgamma().) I tried all sorts of combinations of call(), formals(), args() et al. to no avail. But then, I avoided, so far, to build the whole thing as a character string. Would it be the only option? No, do.call is what you want. dgamma(x + 1000, shape, rate, scale = 1/rate) is the same as do.call(dgamma, list(x+1000, shape, rate, scale=1/rate)) But since you're going to have to look up the parameters that are appropriate to your target density (i.e. shape, rate, scale), I'm not sure how useful this will be. It might be easier just to code the call to dgamma directly. Duncan Murdoch First, thanks to both Duncan and Gabor for their useful reply. do.call() was part of the et al. functions I looked up, but I only tried it interactively (where the call is immediately executed after being built) and so dismissed it. After some more struggling (hence the delay in my reply), I was able to do exactly what I want without using strings. For the record, here's my solution: f - function(dist, y) { dist - paste(d, dist, sep = ) args - sapply(names(formals(dist)[-1]), as.name) x - substitute(x + y, list(y = y)) eval(substitute(FUN - function() do.call(f, a), list(f = dist, a = c(x = x, args formals(FUN) - formals(pdf) FUN } Then, for example, f(gamma, 1000) function (x, shape, rate = 1, scale = 1/rate, log = FALSE) do.call(dgamma, list(x = x + 1000, shape = shape, rate = rate, scale = scale, log = log)) environment: 0x8a9b330 I think this is pretty neat! ;-) Vincent -- Vincent Goulet, Associate Professor École d'actuariat Université Laval, Québec [EMAIL PROTECTED] http://vgoulet.act.ulaval.ca __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] binom
I have this data and calculated binom, but am very confused with the value (at least 5, q =4, q=5, q =6??) and parameters? Can someone explain how to plug in the va;ues and parameters? Hospital # Tested # Positive # Positive (per 1000) A 3741 30 8 C 5006 11 2.2 If 500 newborns are screened at Hospital A, the exact binomial probability of at least 5 HIV-positive would be: Pr ( X = q | X ~ Binom(size, prob)) Pr (X =5 |X ~ Binom(500, 0.008)) pbinom(q, size, prob, lower.tail =TRUE, log.p = FALSE) pbinom(q=5, size=500, prob=0.008, lower.tail =TRUE, log.p = FALSE) [1] 0.7857602 If 500 newborns are screened at Hospital C, the exact binomial probability of at least 5 HIV-positive would be: Pr ( X = q | X ~ Binom(size, prob)) Pr (X =5 |X ~ Binom(500, 0.0022)) pbinom(q, size, prob, lower.tail =TRUE, log.p = FALSE) pbinom(q=5, size=500, prob=0.0022, lower.tail =TRUE, log.p = FALSE) [1] 0.9990512 thx much [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] GLM Question
Hello, I am trying to formulate a glm model with repeated measures of viral blood counts where animal weight is a covariate. Animal treatment group is the fixed effect and subject is the random effect. I'm thinking this situation calls for a mixed model in the Poisson family with data correlated to days post inoculation (DPI) where animal weight is factored out to not influence goodness of fit tests. How might I alter the following code to reflect this situation? glm(count~treatment,family=poisson) If this is too much to ask, I understand! I realize I've got a ways to go in writing this... Many thanks! Mark __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Comment blocks in R programs
Tinn-R has that functionality. On 9/20/06, Romain Francois [EMAIL PROTECTED] wrote: Gabor Grothendieck wrote: Try this: if (FALSE) { ... whatever ... } Problem is, ... whatever ... must be syntactically correct to use that trick. Why not using a text editor that does rectangular selection or commenting several lines at a time, there are many out there to propose that kind of feature. Cheers, Romain On 9/20/06, Joe Byers [EMAIL PROTECTED] wrote: All, Is there a way to add comment blocks in an R script other than using # at the beginning of each line? Or, is there anything like ndocs for C++ and the markup for Java that can generate documentation? This may be a bad question, but I have searched R documentation and can't seem to find an Answer. I have also looked at the R package documentation mark up docs for help files but that was more than I wanted. thank you for you help. Joe -- *mangosolutions* /data analysis that delivers/ Tel +44 1249 467 467 Fax +44 1249 467 468 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Beginners manual for emacs and ess
I recommend you start with our JCGS article to get a sense of what ESS does and why. An earlier version of the article is in the ESS distribution as file ess-5.3.2/doc/ess-intro-graphs.pdf The manual is in the ESS distribution as file ess-5.3.2/doc/ess.pdf The reference card is file ess-5.3.2/doc/refcard/refcard.pdf __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Beginners manual for emacs and ess
and in answer to your specific question You start R with M-x R __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] hours() in 'chron': output != input
I encountered surprising (to me, at least) behavior while using 'hours()' in package 'chron.' I will be grateful if someone can point out my error or provide an explanation and intuitive solution (I suppose I could convert chron to a character vector and use substring, but I deal mostly with newbies and kludgy approaches don't inspire much confidence). I used 2.3.0 to construct the dataframe below. 1) 'date.char' is a character vector 2) 'time.char' is a character vector 3) 'chron' was created by chron(dates(date.char),times(time.char)) 4) hours were extracted with hours(chron). 5) Note that the hours used to construct 'chron' do not match the hours extracted with 'hours()' when minutes and seconds are 00:00. date.char time.char chron hour 1 09/20/06 00:00:00 (09/20/06 00:00:00)0 2 09/20/06 01:00:00 (09/20/06 01:00:00)0 3 09/20/06 02:00:00 (09/20/06 02:00:00)2 4 09/20/06 03:00:00 (09/20/06 03:00:00)3 5 09/20/06 04:00:00 (09/20/06 04:00:00)3 6 09/20/06 05:00:00 (09/20/06 05:00:00)5 7 09/20/06 06:00:00 (09/20/06 06:00:00)6 8 09/20/06 07:00:00 (09/20/06 07:00:00)6 9 09/20/06 08:00:00 (09/20/06 08:00:00)8 10 09/20/06 09:00:00 (09/20/06 09:00:00)9 11 09/20/06 10:00:00 (09/20/06 10:00:00)9 12 09/20/06 11:00:00 (09/20/06 11:00:00) 11 13 09/20/06 12:00:00 (09/20/06 12:00:00) 12 14 09/20/06 13:00:00 (09/20/06 13:00:00) 12 15 09/20/06 14:00:00 (09/20/06 14:00:00) 14 16 09/20/06 15:00:00 (09/20/06 15:00:00) 15 17 09/20/06 16:00:00 (09/20/06 16:00:00) 15 18 09/20/06 17:00:00 (09/20/06 17:00:00) 17 19 09/20/06 18:00:00 (09/20/06 18:00:00) 18 20 09/20/06 19:00:00 (09/20/06 19:00:00) 18 21 09/20/06 20:00:00 (09/20/06 20:00:00) 20 22 09/20/06 21:00:00 (09/20/06 21:00:00) 21 23 09/20/06 22:00:00 (09/20/06 22:00:00) 21 24 09/20/06 23:00:00 (09/20/06 23:00:00) 23 This behavior is problematic if one wants to extract hours and use them to group data. Regards, Glen Sargeant __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] mysterious error on compile R 2.3.1
Getting a very strange error with a new install of R from source on x86; make[3]: Leaving directory `/tmp/R.INSTALL.r20887/cluster/src' ** R ** data ** moving datasets to lazyload DB Error in factor(c(1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1), : invalid labels; length 2 should be 1 or 1 Execution halted ERROR: lazydata failed for package 'cluster' ** Removing '/home/dylan/src/R-2.3.1/library/cluster' make[2]: *** [cluster.ts] Error 1 make[2]: Leaving directory `/home/dylan/src/R-2.3.1/src/library/Recommended' make[1]: *** [recommended-packages] Error 2 make[1]: Leaving directory `/home/dylan/src/R-2.3.1/src/library/Recommended' make: *** [stamp-recommended] Error 2 note that i am using the GCC flags: CFLAGS=-march=opteron -ffast-math CXXFLAGS=-march=opteron -ffast-math any ideas? -- Dylan Beaudette Soils and Biogeochemistry Graduate Group University of California at Davis 530.754.7341 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] hours() in 'chron': output != input
I think hours should have a comparison tolerance. Try: hours(x+1e-10) as a workaround. On 9/20/06, Glen A Sargeant [EMAIL PROTECTED] wrote: I encountered surprising (to me, at least) behavior while using 'hours()' in package 'chron.' I will be grateful if someone can point out my error or provide an explanation and intuitive solution (I suppose I could convert chron to a character vector and use substring, but I deal mostly with newbies and kludgy approaches don't inspire much confidence). I used 2.3.0 to construct the dataframe below. 1) 'date.char' is a character vector 2) 'time.char' is a character vector 3) 'chron' was created by chron(dates(date.char),times(time.char)) 4) hours were extracted with hours(chron). 5) Note that the hours used to construct 'chron' do not match the hours extracted with 'hours()' when minutes and seconds are 00:00. date.char time.char chron hour 1 09/20/06 00:00:00 (09/20/06 00:00:00)0 2 09/20/06 01:00:00 (09/20/06 01:00:00)0 3 09/20/06 02:00:00 (09/20/06 02:00:00)2 4 09/20/06 03:00:00 (09/20/06 03:00:00)3 5 09/20/06 04:00:00 (09/20/06 04:00:00)3 6 09/20/06 05:00:00 (09/20/06 05:00:00)5 7 09/20/06 06:00:00 (09/20/06 06:00:00)6 8 09/20/06 07:00:00 (09/20/06 07:00:00)6 9 09/20/06 08:00:00 (09/20/06 08:00:00)8 10 09/20/06 09:00:00 (09/20/06 09:00:00)9 11 09/20/06 10:00:00 (09/20/06 10:00:00)9 12 09/20/06 11:00:00 (09/20/06 11:00:00) 11 13 09/20/06 12:00:00 (09/20/06 12:00:00) 12 14 09/20/06 13:00:00 (09/20/06 13:00:00) 12 15 09/20/06 14:00:00 (09/20/06 14:00:00) 14 16 09/20/06 15:00:00 (09/20/06 15:00:00) 15 17 09/20/06 16:00:00 (09/20/06 16:00:00) 15 18 09/20/06 17:00:00 (09/20/06 17:00:00) 17 19 09/20/06 18:00:00 (09/20/06 18:00:00) 18 20 09/20/06 19:00:00 (09/20/06 19:00:00) 18 21 09/20/06 20:00:00 (09/20/06 20:00:00) 20 22 09/20/06 21:00:00 (09/20/06 21:00:00) 21 23 09/20/06 22:00:00 (09/20/06 22:00:00) 21 24 09/20/06 23:00:00 (09/20/06 23:00:00) 23 This behavior is problematic if one wants to extract hours and use them to group data. Regards, Glen Sargeant __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] GLM Question
You can use the lmer function in the Matrix package or glmmPQL in the MASS package. The former would be used like this: p1 - lmer(count ~ treatment + (1|subject), family=poisson) Dave On 20/09/06, Mark Jankowski [EMAIL PROTECTED] wrote: Hello, I am trying to formulate a glm model with repeated measures of viral blood counts where animal weight is a covariate. Animal treatment group is the fixed effect and subject is the random effect. I'm thinking this situation calls for a mixed model in the Poisson family with data correlated to days post inoculation (DPI) where animal weight is factored out to not influence goodness of fit tests. How might I alter the following code to reflect this situation? glm(count~treatment,family=poisson) If this is too much to ask, I understand! I realize I've got a ways to go in writing this... Many thanks! Mark __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [ROracle] error loading (undefined symbol: sqlclu)
I have this error when I load the library ROracle: library(ROracle) Loading required package: DBI Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/usr/local/lib/R/site-library/ROracle/libs/ROracle.so': /usr/local/lib/R/site-library/ROracle/libs/ROracle.so: undefined symbol: sqlclu Error in library(ROracle) : .First.lib failed for 'ROracle' Also, my LD_LIBRARY_PATH seems to be set correctly: drapeau:~ echo $LD_LIBRARY_PATH /home/drapeau/lib:/opt/oracle/xe/app/oracle/product/10.2.0/client/lib I installed the big database applications (10g) and ROracle 0.5-7 Your help will be very appreciated to help me solve this error, Thank you, Mathieu __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] mysterious error on compile R 2.3.1
On Wed, 20 Sep 2006, Dylan Beaudette wrote: Getting a very strange error with a new install of R from source on x86; make[3]: Leaving directory `/tmp/R.INSTALL.r20887/cluster/src' ** R ** data ** moving datasets to lazyload DB Error in factor(c(1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1), : invalid labels; length 2 should be 1 or 1 Execution halted ERROR: lazydata failed for package 'cluster' ** Removing '/home/dylan/src/R-2.3.1/library/cluster' make[2]: *** [cluster.ts] Error 1 make[2]: Leaving directory `/home/dylan/src/R-2.3.1/src/library/Recommended' make[1]: *** [recommended-packages] Error 2 make[1]: Leaving directory `/home/dylan/src/R-2.3.1/src/library/Recommended' make: *** [stamp-recommended] Error 2 note that i am using the GCC flags: CFLAGS=-march=opteron -ffast-math CXXFLAGS=-march=opteron -ffast-math We do request you do not do so in the R-admin manual. From the gcc man page: This option should never be turned on by any -O option since it can result in incorrect output for programs which depend on an exact implementation of IEEE or ISO rules/specifications for math func- tions. R is such a program. -- 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@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.
Re: [R] mysterious error on compile R 2.3.1
Dylan Beaudette [EMAIL PROTECTED] writes: Getting a very strange error with a new install of R from source on x86; make[3]: Leaving directory `/tmp/R.INSTALL.r20887/cluster/src' ** R ** data ** moving datasets to lazyload DB Error in factor(c(1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1), : invalid labels; length 2 should be 1 or 1 Execution halted ERROR: lazydata failed for package 'cluster' ** Removing '/home/dylan/src/R-2.3.1/library/cluster' make[2]: *** [cluster.ts] Error 1 make[2]: Leaving directory `/home/dylan/src/R-2.3.1/src/library/Recommended' make[1]: *** [recommended-packages] Error 2 make[1]: Leaving directory `/home/dylan/src/R-2.3.1/src/library/Recommended' make: *** [stamp-recommended] Error 2 note that i am using the GCC flags: CFLAGS=-march=opteron -ffast-math CXXFLAGS=-march=opteron -ffast-math any ideas? Don't do that Seriously! -ffast-math will allow the compiler to break IEEE math specifications, which in turn will break R all over the place. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Unexpected behavior of apply() over a 3d array
Dear listeRs, I'm finding that apply() behaves strangely when used on a 3-d array. For example: at - array(1:27,dim=c(3,3,3)) at , , 1 [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 , , 2 [,1] [,2] [,3] [1,] 10 13 16 [2,] 11 14 17 [3,] 12 15 18 , , 3 [,1] [,2] [,3] [1,] 19 22 25 [2,] 20 23 26 [3,] 21 24 27 apply(at, 1, max) [1] 25 26 27 If, for the MARGIN argument in apply() 1 is rows, I would have expected as output a 3x3 matrix something like 7 16 25 8 17 16 9 18 27 Either that, or maybe the transpose of that, but a single vector seems rather random. Especially when you go apply(at, 3, max) [1] 9 18 27 What is that the max of? Each submatrix? The diagonal? I'm confused. Can anyone clarify this? Besides this, is there a function that will work on a 3d array, the way I'm implying, or do I need to write an explicit loop that takes 2d slices of my 3d array? Thanks! Toby __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Poission distribution
The expected number of bladder cancer over next 20 years a tire industry is 1.8. Poission distribution is assumed to hold and 6 reported deaths are caused by bladder cancer among the employees. Trying to find how unusual this event is. ppois(q=6, lambda=1.8, lower.tail = TRUE, log.p = FALSE) [1] 0.9974306 not sure if ppois is the right one to use and the parameters... thx much __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] functionality of update in SAS
Dear list, I've tried to search the archives but found nothing, although I may use the wrong wording in my searches. I've also double-checked the upData function in Hmisc, but it does something else. I'm wondering if one can update a dataframe by forcing into it a shorter dataframe containing the corrections, like the update provided in SAS data steps. In this simple example: a - data.frame(id=c(1:5),x=rnorm(5)) b - data.frame(id=4,x=rnorm(1)) a id x 1 1 0.6557921 2 2 0.1897523 3 3 0.7976721 4 4 0.2107103 5 5 -0.8855786 b id x 1 4 0.8369147 I would like the updated dataframe to look like (row names are not important to me) id x 1 1 0.6557921 2 2 0.1897523 3 3 0.7976721 4 4 0.8369147 5 5 -0.8855786 I thought this could be done with merge, but this never removes the old version of a row, it just gives me two rows with id==4. I thought of this solution: reject - a$id %in% b$id a2 - a[!reject,] a3 - rbind(a2,b) a3 id x 1 1 0.6557921 2 2 0.1897523 3 3 0.7976721 5 5 -0.8855786 11 4 0.8369147 This works, and obviously it is not the best way to make the correction in a simple case like this. But providing a few lines of corrected data can be an effective method with large dataframes, especially if many identifier (grouping) variables are needed to identify each line that needs updating, and in this context my solution above rapidly becomes ugly. Furthermore (but I can live with this constraint) this method removes entire rows, so I need to make sure the dataframe used to make corrections contains all the Y variables in the original dataframe, even those that do not need correcting. If a method exists to just change one variable in 5 lines for a dataframe of 5000 lines and 30 variables, I'd appreciate learning about it. But I'll already be thrilled if I can update whole lines at a time. Sincerely, Denis Chabot __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Unexpected behavior of apply() over a 3d array
Read ?apply carefullly.If FUN returns as a scalar as it does here then the result dimensions are dim(X)[MARGIN]. For example, apply(X, 1, max) has three components which are max(X[1,,]), max(X[2,,]) and max(X[3,,]) and apply(X, 3, max) has three components which are max(X[,,1]), max(X[,,2]) and max(X[,,3]) Also try apply(X, 1:2, max), etc. On 9/20/06, Toby Muhlhofer [EMAIL PROTECTED] wrote: Dear listeRs, I'm finding that apply() behaves strangely when used on a 3-d array. For example: at - array(1:27,dim=c(3,3,3)) at , , 1 [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 , , 2 [,1] [,2] [,3] [1,] 10 13 16 [2,] 11 14 17 [3,] 12 15 18 , , 3 [,1] [,2] [,3] [1,] 19 22 25 [2,] 20 23 26 [3,] 21 24 27 apply(at, 1, max) [1] 25 26 27 If, for the MARGIN argument in apply() 1 is rows, I would have expected as output a 3x3 matrix something like 7 16 25 8 17 16 9 18 27 Either that, or maybe the transpose of that, but a single vector seems rather random. Especially when you go apply(at, 3, max) [1] 9 18 27 What is that the max of? Each submatrix? The diagonal? I'm confused. Can anyone clarify this? Besides this, is there a function that will work on a 3d array, the way I'm implying, or do I need to write an explicit loop that takes 2d slices of my 3d array? Thanks! Toby __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [ROracle] error loading (undefined symbol: sqlclu)
On Wed, 2006-09-20 at 15:15 -0400, Mathieu Drapeau wrote: I have this error when I load the library ROracle: library(ROracle) Loading required package: DBI Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/usr/local/lib/R/site-library/ROracle/libs/ROracle.so': /usr/local/lib/R/site-library/ROracle/libs/ROracle.so: undefined symbol: sqlclu Error in library(ROracle) : .First.lib failed for 'ROracle' Also, my LD_LIBRARY_PATH seems to be set correctly: drapeau:~ echo $LD_LIBRARY_PATH /home/drapeau/lib:/opt/oracle/xe/app/oracle/product/10.2.0/client/lib I installed the big database applications (10g) and ROracle 0.5-7 Your help will be very appreciated to help me solve this error, Thank you, Mathieu Where did you set LD_LIBRARY_PATH? If in one of your shell config files, it is likely that it is being stepped on during your login and thus not being seen within the R session. I had this problem previously and set the variable in /etc/ld.so.conf (though I am using RODBC instead). Edit that file (as root), add the path: /opt/oracle/xe/app/oracle/product/10.2.0/client/lib and then run [/sbin/]ldconfig to update the current settings. Be sure also that $ORACLE_HOME is set to /opt/oracle/xe/app/oracle/product/10.2.0/client Then try to load ROracle in a new R session. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Unexpected behavior of apply() over a 3d array
It's definitely not random! Try apply(at,3,I) to see what the marginal table is that max operates on, and you'll see where your result comes from. On 20/09/06, Toby Muhlhofer [EMAIL PROTECTED] wrote: Dear listeRs, I'm finding that apply() behaves strangely when used on a 3-d array. For example: at - array(1:27,dim=c(3,3,3)) at , , 1 [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 , , 2 [,1] [,2] [,3] [1,] 10 13 16 [2,] 11 14 17 [3,] 12 15 18 , , 3 [,1] [,2] [,3] [1,] 19 22 25 [2,] 20 23 26 [3,] 21 24 27 apply(at, 1, max) [1] 25 26 27 If, for the MARGIN argument in apply() 1 is rows, I would have expected as output a 3x3 matrix something like 7 16 25 8 17 16 9 18 27 Either that, or maybe the transpose of that, but a single vector seems rather random. Especially when you go apply(at, 3, max) [1] 9 18 27 What is that the max of? Each submatrix? The diagonal? I'm confused. Can anyone clarify this? Besides this, is there a function that will work on a 3d array, the way I'm implying, or do I need to write an explicit loop that takes 2d slices of my 3d array? Thanks! Toby __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Unexpected behavior of apply() over a 3d array
It just seemed wierd because over a 2d array, it also returns vectors, but I guess breaking things down into components of the list it makes sense. Besides, using David's suggestion of apply(at, MARGIN, I) also offers the insights I need. Gabor Grothendieck wrote: Read ?apply carefullly.If FUN returns as a scalar as it does here then the result dimensions are dim(X)[MARGIN]. For example, apply(X, 1, max) has three components which are max(X[1,,]), max(X[2,,]) and max(X[3,,]) and apply(X, 3, max) has three components which are max(X[,,1]), max(X[,,2]) and max(X[,,3]) Also try apply(X, 1:2, max), etc. On 9/20/06, Toby Muhlhofer [EMAIL PROTECTED] wrote: Dear listeRs, I'm finding that apply() behaves strangely when used on a 3-d array. For example: at - array(1:27,dim=c(3,3,3)) at , , 1 [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 , , 2 [,1] [,2] [,3] [1,] 10 13 16 [2,] 11 14 17 [3,] 12 15 18 , , 3 [,1] [,2] [,3] [1,] 19 22 25 [2,] 20 23 26 [3,] 21 24 27 apply(at, 1, max) [1] 25 26 27 If, for the MARGIN argument in apply() 1 is rows, I would have expected as output a 3x3 matrix something like 7 16 25 8 17 16 9 18 27 Either that, or maybe the transpose of that, but a single vector seems rather random. Especially when you go apply(at, 3, max) [1] 9 18 27 What is that the max of? Each submatrix? The diagonal? I'm confused. Can anyone clarify this? Besides this, is there a function that will work on a 3d array, the way I'm implying, or do I need to write an explicit loop that takes 2d slices of my 3d array? Thanks! Toby __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to draw a per mille symbol?
Hi Gavin Simpson wrote: On Wed, 2006-09-20 at 15:28 +1200, Paul Murrell wrote: Hi Gavin Simpson wrote: Dear list, Following advice posted to this list a while back by Prof Ripley [1], I have been trying to draw a per mille character [2] in an axis label. This should give the correct character: plot(1:10, ylab = \u2030) but all I get is 'S'. I'm running linux (FC5) and have fonts installed that have the correct character (viewed in the Gnome character map at least). Thanks for your reply Paul, and also to Andrew Robinson for his earlier reply. I had initially avoided trying to use the encoding argument and pdf() as I had planned to include the code to produce the graphics in a Sweave document and AFAICS there is no way to pass extra arguments to the code generating the pdf figures in Sweave? In cases like this, I put an explicit pdf() call (and dev.off()) in my Sweave code chunk and then explicitly \includegraphics{} the resulting figure. Of course, my original plan was ignorant of the details of font encodings and mappings to single byte encodings in pdf and postscript devices and wouldn't have worked anyway. I get the same thing (and using xfd I see the per mille character in the font I'm using). I'm afraid I'm not sure why this is happening; I can get a number of other unusual characters to work (e.g., \u20ac), but there appear to be some characters that do not draw correctly. I used the following code to explore the default Helvetica font I've got and I can't see a rational pattern in the misbehaviour. x11(width=5, height=5) grid.prompt(TRUE) digits - c(0:9, letters[1:6]) for (i in c(00, 01, 02, 03, 1e, 20, 21, 22)) { grid.newpage() for (j in 1:16) { for (k in 1:16) { pushViewport(viewport(x=j/16, y=1-k/16, width=1/16, height=1/16, just=c(right, bottom))) eval(parse(text=paste('grid.text(\\u', i, digits[k], digits[j], ')', sep=))) grid.text(paste(\\u, i, digits[k], digits[j], sep=), y=1, just=top, gp=gpar(col=grey, cex=0.5)) popViewport() } } } That is a nice tool for looking at the font glyphs, which I can see being very useful in working out which unicode number matches the character you want to display. I'm not too clued up on grid graphics yet, would it be easy to modify the above to print out the \u code above each glyph? Sure. See code above. Paul I have also tried plotting to a pdf device with a font family that the character map tool shows I have a per mille glyph for, e.g.: pdf(~/tmp/test_per_mille.pdf, paper = a4, family = URWBookman) plot(1:10, ylab = \u2030) dev.off() But all I get here is a period or a dot-like symbol. This is an encoding problem I think. For producing PDF output, the character string gets converted to a single-byte encoding. If your default locale is ISOLatin1 like mine then you won't see the per mille because that character (called perthousand in the Adobe afm's) is not in the ISOLatin1 encoding. If you explicitly use an encoding that does include perthousand (like WinAnsi) then the conversion to single-byte encoding works. For example, this works (for me at least) ... pdf(WinAnsi_per_mille.pdf, encoding=WinAnsi) plot(1:10, ylab = \u2030) dev.off() Paul Thanks for this, which works fine for me also. All the best, G I've tried this in R 2.4.0 alpha [4] and R 2.5.0 to be [4] as my self-compiled R 2.3.1-patched dies when plotting Unicode characters (fixed in 2.4.0 alpha and above [3]) Can anyone point me in the right direction to get this working? TIA, G [1] http://finzi.psych.upenn.edu/R/Rhelp02a/archive/48709.html [2] like a % but with 2 circles at the bottom not one, see http://en.wikipedia.org/wiki/Permille [3] see thread at http://article.gmane.org/gmane.comp.lang.r.devel/9704 [4] R version 2.4.0 alpha (2006-09-19 r39410) [5] R version 2.5.0 Under development (unstable) (2006-09-19 r39410) -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Dennis Chabot poss. answer
Hi Dennis! Here is a possible solution to consider: a - data.frame(x=1:25,y=rnorm(25)) a x y 1 1 1.38958705 2 2 -0.45165628 3 3 0.86517671 4 4 0.40802481 5 5 -2.00104605 6 6 0.11152748 7 7 1.84400316 8 8 0.80775204 9 9 -0.12510867 10 10 -0.13650037 11 11 -0.63498148 12 12 1.70665004 13 13 -0.42427846 14 14 0.38587832 15 15 -0.07601500 16 16 0.40442795 17 17 1.78181958 18 18 -0.07199413 19 19 -0.62582419 20 20 0.71653130 21 21 -1.07557102 22 22 -0.04874676 23 23 -0.09447060 24 24 -0.99221486 25 25 0.16559026 # Set row numbers b - c(2,5,7,18,22) a[b,2] - rnorm(length(b)) a x y 1 1 1.3895870 2 2 -0.4613160 3 3 0.8651767 4 4 0.4080248 5 5 -0.5564420 6 6 0.1115275 7 7 1.6625939 8 8 0.8077520 9 9 -0.1251087 10 10 -0.1365004 11 11 -0.6349815 12 12 1.7066500 13 13 -0.4242785 14 14 0.3858783 15 15 -0.0760150 16 16 0.4044279 17 17 1.7818196 18 18 2.0357456 19 19 -0.6258242 20 20 0.7165313 21 21 -1.0755710 22 22 -1.2000225 23 23 -0.0944706 24 24 -0.9922149 25 25 0.1655903 Hope this can be useful! Note: I accidentally deleted the original e-mail. Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ppois
A quick question! The number of episodes per year of otitis media follows a Possion distribution with lambda = 1.6 episodes per year. Wouldn't the probability of getting 3 or more episodes of otitis media in the first 2 years of life be: ppois(q=3, lambda=1.6*2, lower.tail = TRUE, log.p = FALSE) [1] 0.6025197 I am confused with the lambda and 3 or more.. thx much __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Poission distribution
Is that 6 deaths over 20 years? If so, the probability of getting exactly 6 deaths is given by dpois(6,1.8) [1] 0.007808587 The probability of getting six or more deaths is 1 minus the result you obtained. On 20/09/06, Ethan Johnsons [EMAIL PROTECTED] wrote: The expected number of bladder cancer over next 20 years a tire industry is 1.8. Poission distribution is assumed to hold and 6 reported deaths are caused by bladder cancer among the employees. Trying to find how unusual this event is. ppois(q=6, lambda=1.8, lower.tail = TRUE, log.p = FALSE) [1] 0.9974306 not sure if ppois is the right one to use and the parameters... thx much __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] mysterious error on compile R 2.3.1
On Wednesday 20 September 2006 12:38, Peter Dalgaard wrote: Dylan Beaudette [EMAIL PROTECTED] writes: Getting a very strange error with a new install of R from source on x86; make[3]: Leaving directory `/tmp/R.INSTALL.r20887/cluster/src' ** R ** data ** moving datasets to lazyload DB Error in factor(c(1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1), : invalid labels; length 2 should be 1 or 1 Execution halted ERROR: lazydata failed for package 'cluster' ** Removing '/home/dylan/src/R-2.3.1/library/cluster' make[2]: *** [cluster.ts] Error 1 make[2]: Leaving directory `/home/dylan/src/R-2.3.1/src/library/Recommended' make[1]: *** [recommended-packages] Error 2 make[1]: Leaving directory `/home/dylan/src/R-2.3.1/src/library/Recommended' make: *** [stamp-recommended] Error 2 note that i am using the GCC flags: CFLAGS=-march=opteron -ffast-math CXXFLAGS=-march=opteron -ffast-math any ideas? Don't do that Seriously! -ffast-math will allow the compiler to break IEEE math specifications, which in turn will break R all over the place. yikes! i wont do that anymore. this fixed the problem. thanks! cheers, -- Dylan Beaudette Soils and Biogeochemistry Graduate Group University of California at Davis 530.754.7341 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] functionality of update in SAS
On 9/20/06, Denis Chabot [EMAIL PROTECTED] wrote: Dear list, I've tried to search the archives but found nothing, although I may use the wrong wording in my searches. I've also double-checked the upData function in Hmisc, but it does something else. I'm wondering if one can update a dataframe by forcing into it a shorter dataframe containing the corrections, like the update provided in SAS data steps. In this simple example: a - data.frame(id=c(1:5),x=rnorm(5)) b - data.frame(id=4,x=rnorm(1)) a id x 1 1 0.6557921 2 2 0.1897523 3 3 0.7976721 4 4 0.2107103 5 5 -0.8855786 b id x 1 4 0.8369147 I would like the updated dataframe to look like (row names are not important to me) id x 1 1 0.6557921 2 2 0.1897523 3 3 0.7976721 4 4 0.8369147 5 5 -0.8855786 Making a few assumtions (like id's being unique, b$id guaranteed to be in a$id and all columns in b are also in a), you could do which.id - which(a$id %in% b$id) a[which.id, colnames(b)] - b -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Statitics Textbook - any recommendation?
I would like to buy a basic statistics book (experimental design, sampling, ANOVA, regression, etc.) with examples in R. Or download it in PDF or html format. I went to the CRAN contributed documentation, but there were only R textbooks, that is, textbooks where R is the focus, not the statistics. And I would like to find the opposite. Other text I am trying to find is multivariate data analysis (EFA, cluster, mult regression, MANOVA, etc.) with examples with R. Any recommendation? Thank you in advance, Iuri. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to delete some columns from a matrix based on some other indicator variable
Hello, I am not very familiar with R and need help in deleting a few columns in a matrix. Suppose I have a indicator variable called r and it's defined as r = (0, 0, 1, 1). A matrix D is a 3X4 matrix. If I want a new matrix which contains only the columns of D corresponding to the elements of r that equal to 1. how can i write a loop which creat a new matrix that contains only the last 2 columns of D in this case? thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to store an array in MySQL
Hi all, does somebody know how to store an array in MySQL with the package RMySQL. Thanks in advance. A similar question was asked last month. http://finzi.psych.upenn.edu/R/Rhelp02a/archive/81429.html In a normalized database, you should store the index and value in separate columns. Try this... a-array(1:3, c(2, 4)) [,1] [,2] [,3] [,4] [1,]1321 [2,]2132 d -dim(a) z-cbind(expand.grid(r=1:d[1],c=1:d[2]),x=as.vector(a)) r c x 1 1 1 1 2 2 1 2 3 1 2 3 4 2 2 1 5 1 3 2 6 2 3 3 7 1 4 1 8 2 4 2 library(RMySQL) con-dbConnect(MySQL(), dbname=test) dbWriteTable(con, array, z, row.names=FALSE) [1] TRUE --- Now in Mysql select * from array; +--+--+--+ | r| c| x| +--+--+--+ |1 |1 |1 | |2 |1 |2 | |1 |2 |3 | |2 |2 |1 | |1 |3 |2 | |2 |3 |3 | |1 |4 |1 | |2 |4 |2 | +--+--+--+ select group_concat(x order by c separator ' ' ) as a from array group by r; +-+ | a | +-+ | 1 3 2 1 | | 2 1 3 2 | +-+ Chris Stubben __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Statitics Textbook - any recommendation?
I recommend mine, which is listed in CRAN, Statistical Analysis and Data Display Richard M. Heiberger and Burt Holland http://springeronline.com/0-387-40270-5 All examples and figures in the book are included in the online files that may be downloaded from the book's website. The R package HH containing the R functions from the online files is now on CRAN. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Statitics Textbook - any recommendation?
Venables and Ripley's Modern Applied Statistics with S was recommended on the CRAN site, and I like it myself. On 9/20/06, Iuri Gavronski [EMAIL PROTECTED] wrote: I would like to buy a basic statistics book (experimental design, sampling, ANOVA, regression, etc.) with examples in R. Or download it in PDF or html format. I went to the CRAN contributed documentation, but there were only R textbooks, that is, textbooks where R is the focus, not the statistics. And I would like to find the opposite. Other text I am trying to find is multivariate data analysis (EFA, cluster, mult regression, MANOVA, etc.) with examples with R. Any recommendation? Thank you in advance, Iuri. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- I can answer any question. I don't know is an answer. I don't know yet is a better answer. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Statitics Textbook - any recommendation?
Not withstanding Prof. Heiberger's admirable enthusiasm, I think the canonical answer is probably MASS (Modern Applied Statistics with S) by Venables and Ripley. It is very comprehensive, but depending on your background, you may find it too telegraphic. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Iuri Gavronski Sent: Wednesday, September 20, 2006 1:22 PM To: r-help@stat.math.ethz.ch Subject: [R] Statitics Textbook - any recommendation? I would like to buy a basic statistics book (experimental design, sampling, ANOVA, regression, etc.) with examples in R. Or download it in PDF or html format. I went to the CRAN contributed documentation, but there were only R textbooks, that is, textbooks where R is the focus, not the statistics. And I would like to find the opposite. Other text I am trying to find is multivariate data analysis (EFA, cluster, mult regression, MANOVA, etc.) with examples with R. Any recommendation? Thank you in advance, Iuri. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.