Re: [R] Sweave bug? when writing figures / deleting variable in chunk
I have found a quite strange (to me) behaviour in Sweave. It only occurs in the following situation: You need to understand what Sweave does when it creates pictures: = sel - 1:5 @ fig=T= plot(trees[sel,]) rm(sel) @ By default, a eps and pdf version of the graphic is made. That is, this chunk producing the graphic is *run twice*: once to make the eps file, once to make the pdf file. After this code chunk is run once: fig=T= plot(trees[sel,]) rm(sel) ...the variable sel is obviously deleted, so the second time it runs... well, there's your error message. Best to place the command rm( sel ) in it's own separate chunk. P. -- Dr Peter Dunn | dunn at usq.edu.au Faculty of Sciences, USQ; http://www.sci.usq.edu.au/staff/dunn Aust. Centre for Sustainable Catchments: www.usq.edu.au/acsc This email (including any attached files) is confidential an...{{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.
[R] sma package, and MouseArray data set
Hi all I have just downloaded the sma package from CRAN. On installing on my linux machine, I get the message library(sma) data(MouseArray) Warning message: file 'MouseArray.RData' has magic number 'RDX1' Use of save versions prior to 2 is deprecated Hereafter, MouseArray is not found: MouseArray Error: object MouseArray not found We were hoping to use the MouseArray data with some of the sma functions. Since the data seems the only problem, is the data available elsewhere in this form? Or is there an easy work-around? I have tried contacting the listed maintainer (Benjamin Bolstad), but the listed email address ([EMAIL PROTECTED]) bounced. Thanks. P. sessionInfo() R version 2.5.0 (2007-04-23) i486-pc-linux-gnu locale: LC_CTYPE=en_AU.UTF-8;LC_NUMERIC=C;LC_TIME=en_AU.UTF-8;LC_COLLATE=en_AU.UTF-8;LC_MONETARY=en_AU.UTF-8;LC_MESSAGES=en_AU.UTF-8;LC_PAPER=en_AU.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_AU.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods [7] base other attached packages: sma 0.5.15 -- Dr Peter Dunn | dunn at usq.edu.au Faculty of Sciences, USQ; http://www.sci.usq.edu.au/staff/dunn Aust. Centre for Sustainable Catchments: www.usq.edu.au/acsc This email (including any attached files) is confidential an...{{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.
[R] Building package: What does this message about rcompgen imply?
Hi all I'm updating a package for submission to CRAN, and I am getting an error message I never have seen before, and can't find out what it implies or means (and hence, what I need to do to fix it). After running R CMD check, I get this: snip * checking foreign function calls ... OK * checking R code for possible problems ... OK * checking Rd files ... OK * checking Rd cross-references ... WARNING Error in .find.package(package, lib.loc) : there is no package called 'rcompgen' Execution halted * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK snip I am informed: There is no package called 'rcompgen'. True; I never knew there was one, so I certainly never asked for it to be loaded. (I can search all the files in the package directory and the string rcompgen never appears either, and nor does the string find.package.) So somewhere, this package must be deemed necessary to install. (I have checked all dependencies too: none of those packages need rcompgen either.) I can get this package from CRAN and install it of course, but I don't think I need it. (Not that I fully understand what it is for or what it does...). I'm sure it implies there is a problem in my package, but i don't know what problem that is. So can anyone help me: Why does R think I need package rcompgen? What error/mistake in my Rd files would invoke this? Where should I be looking, and what sort of problem might I be looking for? Thanks as always. P. -- Dr Peter Dunn | dunn at usq.edu.au Faculty of Sciences, USQ; http://www.sci.usq.edu.au/staff/dunn Aust. Centre for Sustainable Catchments: www.usq.edu.au/acsc This email (including any attached files) is confidential an...{{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] Building package: What does this message about rcompgen imply?
Dirk On 3 May 2007 at 10:43, Peter Dunn wrote: | After running R CMD check, I get this: | | snip | * checking foreign function calls ... OK | * checking R code for possible problems ... OK | * checking Rd files ... OK | * checking Rd cross-references ... WARNING | Error in .find.package(package, lib.loc) : | there is no package called 'rcompgen' | Execution halted Are you by chance on Debian (or Ubuntu)? Bingo. The short answer seems to be that I do need rcompgen to be installed, and my Debian system didn't do that. Easy fixed though. Thanks. P. version _ platform i486-pc-linux-gnu arch i486 os linux-gnu system i486, linux-gnu status major 2 minor 5.0 year 2007 month 04 day23 svn rev41293 language R version.string R version 2.5.0 (2007-04-23) -- Dr Peter Dunn | dunn at usq.edu.au Faculty of Sciences, USQ; http://www.sci.usq.edu.au/staff/dunn Aust. Centre for Sustainable Catchments: www.usq.edu.au/acsc This email (including any attached files) is confidential an...{{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] Error distribution question
I was wondering if somebody could offer me some advice on which error distribution would be appropriate for the type of data I have. I'm studying what continuous predictor variables such as grooming received, rank, etc. affect the amount of grooming given. This response variable is continuous with many zeros, and so positively skewed. This kind of variable is very common in prospecting (oil, mining) industries, and also in medical research. It's neither continuous nor discrete, because of the weight on zero. Basically, it is a combination of _two_ variables: X: a Bernoulli trial, such that p(X = 0) = 1 - p (failure) and p(X = 1) = p (success) Y: the continous variable that represents numerically the success So, we have the final variable as X * Y. Indeed, the Tweedie distribution may be just what you are after. I realized in the Tweedie help page that one can use a specific response distribution (Normal, Poisson, Compound Poisson, etc) by setting the variance power = to a specific number. I'm a beginner, so I really don't follow then, This sounds like you have the tweedie package. And yes, the variance.power tells you which distribution you have. Tweedie distributions have a variance of the form var[Y] = phi * mu^p for some variance.power p. (Note Tweedie distns belong to the exponential family, so can be used in the generalized linear model framework.) The mixed distributions you talk about (continuous, plus a positive mass at zero) correspond to tweedie distributions with 1 p 2. (p=2 is the gamma; p=0 is Normal; p=3 is inverse Gaussian; p=1 and phi=1 is Poisson). which response distribution to use (i.e. what variance power) that would be appropriate for continuous response data with many zeros. If you want to use a tweedie distn in practice, you first need to know *which* Tweedie distribution you need; that is, what value of p is appropriate. To do that, use the tweedie.profile function in package tweedie. tTat will tell you what value of p is approprioate for your data. For the sake of an example, suppose you wish to fit a model something like Y ~ x1 + x2; use tweedie.profile and you get p = 1.6: tweedie.profile(Y ~ x1 + x2, p.vec=seq(1.1, 1.9, length=10), do.plot=TRUE) Then, you can fit the appropriate generalized linear model if you wish as follow, using package statmod: glm( Y ~ x1 + x2, family=tweedie(variance.power=1,.6, link.power=0) (link.power=0 means a log, and is a commonly used link.) Hope that's of some help. P. -- Dr Peter Dunn | dunn at usq.edu.au Faculty of Sciences, USQ; http://www.sci.usq.edu.au/staff/dunn Aust. Centre for Sustainable Catchments: www.usq.edu.au/acsc This email (including any attached files) is confidential an...{{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] Sweave issue: quotes in verbatim-like output print incorrectly
Thanks to Gavin Simpson and Patrick Drechsler: The solution was simple. (No idea how I would have discovered these answers without this R mailing list!) Many thanks. P. Gavin Simpson [EMAIL PROTECTED] writes: On Wed, 2007-03-07 at 15:33 +1000, Peter Dunn wrote: But I recently received a new computer, and ever since I have had a problem I've never seen before. For example, I place the following in my Snw file: Try this in the preamble of your Snw file: \usepackage[utf8x]{inputenc} \usepackage[utf8]{inputenc} should suffic for this. Also, utf8 is newer than utf8x. So if you only need the ISO 8859 subset of Unicode, utf8 should serve your needs. HTH Patrick -- I never used a logarithm in my life, and could not undertake to extract the square root of four without misgivings. (Georg Bernhard Shaw) __ 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. This email (including any attached files) is confidential an...{{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.
[R] Sweave issue: quotes in verbatim-like output print incorrectly
Hi all I love Sweave; use it all the time. But I recently received a new computer, and ever since I have had a problem I've never seen before. For example, I place the following in my Snw file: = sms - read.table(http://www.sci.usq.edu.au/staff/dunn/Datasets/applications/popular/smsspeed.dat;, header=TRUE) attach(sms) sms.lm - lm( Time ~ Age*Phone, subset=(Age30) ) summary(sms.lm) @ Standard stuff. The output appears in the corresponding LaTeX file as it should, in a verbatim-like environment as it should. But since I have had this new machine, this line of output: Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 appears in my resulting pdf document as Signif. codes: 0 ^a˘A¨Y***^a˘A´Z0.001 ^a˘A¨Y**^a˘A´Z0.01 ^a˘A¨Y*^a ˘A´Z0.05 ^a˘A¨Y.^a˘A´Z0.1 ^a˘A¨Y^a˘A´Z1 In short, every quote is replaced by garbage. This makes my output looks incredibly bad. (This is true for all cases; the above is the output from my example.) I also imagine (hope!) there is a very simple fix. Can anyone help me? Documents which used to produce the correct output document now do this, so it must be something to do with my machine set up, or R set up, rather than the documents themselves, I guess. Any help appreciated. I have no idea where to look for the solution (the FAQ. manuals and mailing archives were no help that I could see; happy to be corrected). P. version _ platform i486-pc-linux-gnu arch i486 os linux-gnu system i486, linux-gnu status Patched major 2 minor 4.0 year 2006 month 11 day25 svn rev39997 language R version.string R version 2.4.0 Patched (2006-11-25 r39997) sessionInfo() R version 2.4.0 Patched (2006-11-25 r39997) i486-pc-linux-gnu locale: LC_CTYPE=en_AU.UTF-8;LC_NUMERIC=C;LC_TIME=en_AU.UTF-8;LC_COLLATE=en_AU.UTF-8;LC_MONETARY=en_AU.UTF-8;LC_MESSAGES=en_AU.UTF-8;LC_PAPER=en_AU.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_AU.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods [7] base -- Dr Peter Dunn | dunn at usq.edu.au Faculty of Sciences, USQ; http://www.sci.usq.edu.au/staff/dunn Aust. Centre for Sustainable Catchments: www.usq.edu.au/acsc This email (including any attached files) is confidential an...{{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] glms with poisson and negative binomial errors
If your data are continuous but must be positive, consider a gamma or inverse gaussian glm. If your data are non-negative (is positive but could include zeros), consider glms based on Tweedie distributions. See, for example: http://cran.ms.unimelb.edu.au/src/contrib/Descriptions/tweedie.html Tweedie distributions have variances of the form var[Y] = phi * mu^p for real p not in the interval (0,1). p=2 is the gamma case, p=0 the normal case, p=1 and phi=1 the Poisson case. But when 1 p 2, the distribution are defined on the non-negative reals (and in fact correspond to a Poisson sum of gamma distributions). P. On Thursday 22 February 2007 05:37, Jarrett Byrnes wrote: A reviewer recently remarked to me that, due to my data being constrained to not fall below zero, a generalized linear model with a negative binomial error (or poisson) with a log link would be more appropriate for fitting my model. I ran it in R with glm.nb() and got results that matched just using lm on log transformed data pretty well. However, R indicated some warnings. I checked warnings(), and saw a list of warnings as follows: Warning messages: 1: non-integer x = 0.254825 I got the same error when trying to use the poisson family. My data is indeed continuous, not discrete (lots of non-integers). Does this mean that the model was not fit properly? Was data dropped when fitting the model? Is there an option to deal with this that I have overlooked? It would seem all is in order, but i just wanted to make sure. Thanks! Thanks. -Jarrett __ 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. -- Dr Peter Dunn | dunn at usq.edu.au Faculty of Sciences, USQ; http://www.sci.usq.edu.au/staff/dunn Aust. Centre for Sustainable Catchments: www.usq.edu.au/acsc This email (including any attached files) is confidential an...{{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.
[R] NaN when using dffits, stemming from lm.influence call
Hi all I'm getting a NaN returned on using dffits, as explained below. To me, there seems no obvious (or non-obvious reason for that matter) reason why a NaN appears. Before I start digging further, can anyone see why dffits might be failing? Is there a problem with the data? Consider: # Load data dep - read.table(http://www.sci.usq.edu.au/staff/dunn/Datasets/Books/Hand/Hand-R/factor1-R.dat;, header=TRUE) attach(dep) dep # Fit Poisson glm dep.glm2 - glm( Counts ~ factor(Depression) + factor(SLE) + factor(Children) + factor(Depression):factor(SLE), family=poisson( link=log) ) # Compute dffits dffits( dep.glm2 ) This produces the output: 1 2 3 4 5 6 1.4207746 -0.1513808NaN 0.9079142 -0.1032664 -1.0860289 7 8 0.4853797 3.8560863 NaN exists for Observation 3. I cannot understand why: there's nothing grossly unusual or bad about it. I look a bit closer, and it falls over in lm.influence when computing the deletion statistic sigma: lm.influence(dep.glm2)$sigma 12345678 0.914829 2.134279 NaN 2.186707 2.224885 1.934539 2.225115 1.957111 The rest of the results from lm.influence are OK; for example: lm.influence(dep.glm2)$wt.res 1 2 3 4 5 6 2.62840627 -0.88476903 -1.09492912 0.20247856 -0.23114458 -0.95123387 7 8 0.07521515 0.30208051 Use of debug( lm.influence ) indicates the NaN appears in this line of lm.influence: res - .Fortran(lminfl, model$qr$qr, n, n, k, as.integer(do.coef), model$qr$qraux, wt.res = e, hat = double(n), coefficients = if (do.coef) matrix(0, n, k) else double(0), sigma = double(n), tol = 10 * .Machine$double.eps, DUP = FALSE, PACKAGE = base)[c(hat, coefficients, sigma, wt.res)] I don't particularly wish to dig around in the Fortran if someone else can look at it and see my problem easily. But if I must... The appearance of the NaN seems odd, since (as I understand it) lm.influence(dep.glm2)$sigma computes sigma when each observation is removed in turn. So if I remove Observation 3 and try fitting the model, there are no problems or complaints: dep.glm3 - glm( Counts ~ factor(Depression) + factor(SLE) + factor(Children) + factor(Depression):factor(SLE), family=poisson( link=log), subset=(-3) ) This produces: dep.glm3 Call: glm(formula = Counts ~ factor(Depression) + factor(SLE) + factor(Children) + factor(Depression):factor(SLE), family = poisson(link = log), subset = (-3)) Coefficients: (Intercept) factor(Depression)1 5.4389 -4.1392 factor(SLE)1 factor(Children)1 -0.6503 -2.4036 factor(Depression)1:factor(SLE)1 3.9513 Degrees of Freedom: 6 Total (i.e. Null); 2 Residual Null Deviance: 695.9 Residual Deviance: 0.8535 AIC: 41.25 No problems, errors, or any signs of potential problems. In the changes to R 2.3.0 (in the NEWS file, eg http://mirror.aarnet.edu.au/pub/CRAN/src/base/NEWS) I find this: oInfluence measures such as rstandard() and cooks.distance() could return infinite values rather than NaN for a case which was fitted exactly. Similarly, plot.lm() could fail on such examples. plot.lm(which = 5) had to be modified to only plot cases with hat 1. (PR#8367) lm.influence() was incorrectly reporting 'coefficients' and 'sigma' as NaN for cases with hat = 1, and on some platforms not detecting hat = 1 correctly. The last sentence identifies NaN being reported for sigma, as I find with my data. But my data do not have hat = 1, but the hat diagonals are large. The troublesome Observation 3 does not have the largest hat value in the data though: hatvalues(dep.glm2) 1 2 3 4 5 6 7 8 0.1689061 0.1064651 0.9098542 0.9030814 0.3799079 0.6382790 0.9327408 0.9607654 And besides, I am using the most recent version of R (see below). BTW, the NaNs appear in the previous version of R also. So I'm flummoxed. As always, help appreciated. P. version _ platform i386-pc-linux-gnu arch i386 os linux-gnu system i386, linux-gnu status major 2 minor 3.1 year 2006 month 06 day01 svn rev38247 language R version.string Version 2.3.1 (2006-06-01) -- Dr Peter Dunn | Email: dunn at usq.edu.au Faculty of Sciences, University of Southern Queensland and the Australian Centre for Sustainable Catchments CRICOS: QLD 00244B | NSW 02225M | VIC 02387D | WA 02521C __ R
[R] R/S-Plus equivalent to Genstat predict: predictions over averages of covariates
Hi all I'm doing some things with a colleague comparing different sorts of models. My colleague has fitted a number of glms in Genstat (which I have never used), while the glm I have been using is only available for R. He has a spreadsheet of fitted means from each of his models obtained from using the Genstat predict function. For example, suppose we fit the model of the type glm.out - glm( y ~ factor(F1) + factor(F2) + X1 + poly(X2,2) + poly(X3,2), family=...) Then he produces a table like this (made up, but similar): F1(level1) 12.2 F1(level2) 14.2 F1(level3) 15.3 F2(level1) 10.3 F2(level2) 9.1 X1=010.2 X1=0.5 10.4 X1=110.4 X1=1.5 10.5 X1=210.9 X1=2.5 11.9 X1=311.8 X2=012.0 X2=0.5 12.2 X2=112.5 X2=1.5 12.9 X2=213.0 X2=2.5 13.1 X2=313.5 Each of the numbers are a predicted mean. So when X1=0, on average we predict an outcome of 10.2. To obtain these figures in Genstat, he uses the Genstat predict function. When I asked for an explanation of how it was done (ie to make the predictions, what values of the other covariates were used) I was told: So, for a one-dimensional table of fitted means for any factor (or variate), all other variates are set to their average values; and the factor constants (including the first, at zero) are given a weighted average depending on their respective numbers of observations. So for quantitative variables (such as pH), one uses the mean pH in the data set when making the predictions. Reasonable anmd easy. But for categorical variables (like Month), he implies we use a weighted average of the fitted coefficients for all the months, depending on the proportion of times those factor levels appear in the data. (I hope I explained that OK...) Is there an equivalent way in R or S-Plus of doing this? I have to do it for a number of sites and species, so an automated way would be useful. I have tried searching to no avail (but may not be searching on the correct terms), and tried hard-coding something myself as yet unsuccessfully: The poly terms and the use of the weighted averaging over the factor levels are proving a bit too much for my limited skills. Any assistance appreciated. (Any clarification of what I mean can be provided if I have not been clear.) Thanks, as always. P. version _ platform i386-pc-linux-gnu arch i386 os linux-gnu system i386, linux-gnu status major2 minor1.0 year 2005 month04 day 18 language R -- Dr Peter Dunn | Senior Lecturer in Statistics Faculty of Sciences, University of Southern Queensland Web:http://www.sci.usq.edu.au/staff/dunn Email: dunn at usq.edu.au CRICOS: QLD 00244B | NSW 02225M | VIC 02387D | WA 02521C __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Help converting a function from S-Plus to R: family$weight
Hi all I am converting an S-Plus function into R. The S-Plus code uses some of the glm families, and family objects. The family objects in S-Plus and R have many different features, for example: In R: names(Gamma()) [1] family link linkfunlinkinvvariance [6] dev.resids aicmu.eta initialize validmu [11] valideta In S-Plus: names(Gamma()) [1] family names link inversederiv [6] initialize variance deviance weight My question concerns the variable weight in the S-Plus function. I'm not sure what it is. (I have searched the S-Plus mailing list archive, and my S-Plus for linux 6.1 documentation.) For almost all family objects, the weight variable is the same as variance, just weighted (and the former as a function; the later as an expression): Gamma()$variance function(mu) mu^2 Gamma()$weight expression(w * mu^2.) The same applies for most families. So I thought I could determine what this weight variable was. But alas--not the inverse,gaussian: inverse.gaussian()$variance function(mu) mu^3 inverse.gaussian()$weight expression(w/((sqrt(family$variance(mu)) * family$deriv(mu))^2.)) So: - can anyone tell me what this expression weight represents? - why is the inverse.gaussian family different than all others? Thanks in advance. P. My S-Plus version: version Version 6.2.1 for Linux 2.4.18 : 2003 My R version: version _ platform i386-pc-linux-gnu arch i386 os linux-gnu system i386, linux-gnu status major2 minor1.0 year 2005 month04 day 18 language R -- Dr Peter Dunn | Senior Lecturer in Statistics Faculty of Sciences, University of Southern Queensland Web:http://www.sci.usq.edu.au/staff/dunn Email: dunn at usq.edu.au CRICOS: QLD 00244B | NSW 02225M | VIC 02387D | WA 02521C __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] substitute/paste question for using Greek in plot titles
Hi all I am having troubles making sense of why code (1) below fails but code (2) below works. Code (1): phi.1 - 1 plot(0 ~ 0, + main=substitute(paste(A vaue for ,phi, = ,phival), list(phival=phi.1)) ) Error in paste(The two deviances for , phi, = , 2) : Object phi not found But this works: Code (2): plot(0,0, + main=substitute(paste(A value for ,phi, = ,phival), list(phival=phi.1)) ) It appears that if the plot command takes the formula style entry, the substitue/paste fails. Is this documented as a feature (I couldn't find it if that is the case), or is it a bug? If it is a feature, it is a subtle difference between (1) and (2) that has potential to be quite frustrating! Perhaps I should just upgrade to version 2.0.0, though I can't see anything in the Release Notes that might cause this. Thanks. P. version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major1 minor9.1 year 2004 month06 day 21 language R -- Dr Peter Dunn (USQ CRICOS No. 00244B) Web:http://www.sci.usq.edu.au/staff/dunn Email: dunn @ usq.edu.au Opinions expressed are mine, not those of USQ. Obviously... __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Using xtable with summaries of lm objects
Hi all Suppose I do the following: set.seed(1000) library(xtable) x - runif( 10 ) y - 1 + 2*x + rnorm( length(x) ) test.lm - lm( y ~ x ) summary( test.lm ) xtable ( summary( test.lm ) ) The final xtable output follows: % latex table generated in R 1.8.1 by xtable 1.2-2 package % Tue Jun 22 09:56:36 2004 \begin{table}[ht] \begin{center} \begin{tabular}{r} \hline Estimate Std. Error t value Pr($$$|$t$|$) \\ \hline (Intercept) 0.5731 0.4396 1.30 0.2286 \\ x 1.9680 0.8894 2.21 0.0578 \\ \hline \end{tabular} \end{center} \end{table} Notice this line: Estimate Std. Error t value Pr($$$|$t$|$) \\ This will not LaTeX correctly, as teh string `$$' occurs; presumably it should read something like: Estimate Std. Error t value Pr({$$}{$|$}t$|$) \\ or (better IMHO): Estimate Std. Error $t$ value Pr($|t|$) \\ I searched the archives, and couldn't find any reference to this bug; perhaps its just me! Is there a known workaround (as I want to auto-generate these table using Sweave; I know I could cut-and-paste the table, and correct as appropriate). Thanks as always. P. version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major1 minor8.1 year 2003 month11 day 21 language R -- Dr Peter Dunn (USQ CRICOS No. 00244B) Web:http://www.sci.usq.edu.au/staff/dunn Email: dunn @ usq.edu.au Opinions expressed are mine, not those of USQ. Obviously... __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Printing ps pictures with transparent b'ground
Hi all I wish to create a ps file of a picture produced in R. With my limited R, I see two ways: 1. Print direct to the postscript device 2. Print to the screen, and save to ps using dev.print. I want a white (not transparent) background. Option 1 above works fine, but 2 does not: even when I say I want a white background, I get transparent; perhaps I misread the help files. Here's some R code: ### Method 1 ### - print straight to postscript device postscript(horizontal=FALSE, onefile=FALSE, bg=white, width=4, height=4, paper=special, file=testfile.eps ) curve( dnorm, from=-3, to=3) dev.off() ### Method 2 ### - print to screen, and save using postscript x11(width=4, height=4) curve( dnorm, from=-3, to=3) dev.print( postscript, horizontal=FALSE, onefile=FALSE, bg=white, width=4, height=4, paper=special, file=testfile2.eps ) I then want to place these files in a LaTeX prosper document for a presentation. A typical (minimal) prosper file is: \documentclass[pdf,colorBG,slideColor,whitecross]{prosper} \begin{document} \begin{slide}{Print to \textsc{ps} direct} \includegraphics{testfile.eps} \end{slide} \begin{slide}{Print to screen first} \includegraphics{testfile2.eps} \end{slide} \end{document} The whitecross class provides a blue background for the presentation. testfile.eps appears with a white background on the slides, but testfile2.eps has a transparent background. I'd apprecaite if someone could explain why the two are not equivalent, or how I can coerce the second option to have a white background? Or even explain my misunderstandings (assuming (with high probability) that I have some). Thanks. P. version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major1 minor8.1 year 2003 month11 day 21 language R -- Dr Peter Dunn (USQ CRICOS No. 00244B) Web:http://www.sci.usq.edu.au/staff/dunn Email: dunn @ usq.edu.au Opinions expressed are mine, not those of USQ. Obviously... __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R workshop in Australia
Need some help with R? An R workshop, led by John Maindonald, is planned for the 1st October at the University of Southern Queensland, Toowoomba, Australia. The workshop is being organised by the Queensland branch of the Statistical Society of Australia as part of their conference. The workshop consists of a morning session with John Maindonald, the author of the forthcoming book Data Analysis and Graphics Using R: An Example-Based Approach (with John Braun) This will be followed by a closer look at some other R packages in the afternoon (Bioconductor, nlme, etc). The cost for the one-day workshop is only $50 for the whole day (includes notes, morning and afternoon tea, but not lunch). Anyone interested in attending can find out more by looking at http://www.sci.usq.edu.au/staff/dunn/qstatconf/workshops.html Registration forms are available from http://www.sci.usq.edu.au/staff/dunn/qstatconf/registration.html Anyone is, of course, welcome to attend the conference also, but it is not necessary if you just wish to attend the R workshop. -- Ross Darnell Organising committee Email: [EMAIL PROTECTED] -- Dr Peter Dunn (USQ CRICOS No. 00244B) Web:http://www.sci.usq.edu.au/staff/dunn Email: dunn @ usq.edu.au Opinions expressed are mine, not those of USQ. Obviously... __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] R workshop in Australia
Need some help with R? An R workshop, led by John Maindonald, is planned for the 1st October at the University of Southern Queensland, Toowoomba, Australia. The workshop is being organised by the Queensland branch of the Statistical Society of Australia as part of their conference. The workshop consists of a morning session with John Maindonald, the author of the forthcoming book Data Analysis and Graphics Using R: An Example-Based Approach (with John Braun) This will be followed by a closer look at some other R packages in the afternoon (Bioconductor, nlme, etc). The cost for the one-day workshop is only $50 for the whole day (includes notes, morning and afternoon tea, but not lunch). Anyone interested in attending can find out more by looking at http://www.sci.usq.edu.au/staff/dunn/qstatconf/workshops.html Registration forms are available from http://www.sci.usq.edu.au/staff/dunn/qstatconf/registration.html Anyone is, of course, welcome to attend the conference also, but it is not necessary if you just wish to attend the R workshop. -- Peter Dunn Organising committee Email: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Sweave: pass scale parameter to includegraphics?
Hi all I'm using Sweave and find it a treat. But one question: I use Sweave to create my pictures which are automatically included into LaTeX. For example, in the file test.Snw, I may have: % LaTeX stuff \begin{figure} fig=true,width=5,height=5= x1 - seq(1,5, length=10) x2 - sin(x1) plot(x1,x2) @ \caption{Plot} \end{figure} % More LaTeX This produces the LaTeX file test.tex with the (example) chuck: % LaTeX stuff \begin{figure} \includegraphics{test-001} \caption{Plot} \end{figure} % More LaTeX stuff But what if I want the chunk to be, for example, \includegraphics[scale=0.6]{test-001} rather than the standard, no frills \includegraphics command? (Why? Because I create a picture that I want small! Changing width and height within the = only changes the appearance of the picture--it alters the x11 window the plot is produced in, not the final size in my document.) How can I inform Sweave to create this in the LaTeX code (not universally, but in the occasional picture)? More generally, how can I inform Sweave to pass these types of parameters to the \includegraphics command? I have searched archives and all the (obvious to me) places, but haven't found the solution. Thanks again, P. -- Dr Peter Dunn (USQ CRICOS No. 00244B) Web:http://www.sci.usq.edu.au/staff/dunn Email: dunn @ usq.edu.au Opinions expressed are mine, not those of USQ. Obviously... __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Plotting (mixed) line types and legends
Hi all I have a question about plotting line types and legends. Here's a short piece of code to demonstrate: x - y - seq(1,10) plot(x,y, type =l, lty=33) lines(x,y+1, lty=1) legend( 8,2,legend=c(lty=1,lty=\33\), lty=c(1,33) ) On my system (see below), the line types in the legend are not the same as in the plot--in particular, lty=1. (In the plot, the lty=1 is solid as expected; in the legend, it is dots close together.) Is this because I shouldn't mix different ways of defining line types in the legend? (ie stick to lty=c(1,2) only, for example)? If so, I couldn't find it documented. Any explanation appreciated. If anyone know hows to do such a thing (ie define different line types in the legend), I'd love to hear. (And yes, I need to do it--the example above was a short snippet that just demos the problem.) P. My system: version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major1 minor7.0 year 2003 month04 day 16 language R -- Dr Peter Dunn (USQ CRICOS No. 00244B) Web:http://www.sci.usq.edu.au/staff/dunn Email: dunn @ usq.edu.au Opinions expressed are mine, not those of USQ. Obviously... __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] The best way to end up with WMF files
Hi all I am doing some stats work for a group of biologists who require windows metafiles (*.wmf) for their publications. To create these, I appear to have two choices: 1. Restart my machine in Windows and use savePlot 2. Keep my machine in linux, save as another format, then convert. I'd rather stay in linux; but how do I get wmf files? I looked at using ImageMagick's convert, but it appears only to *read* wmf files and not write them according to the help (not that I could get it to read them when I tried... but that's another story). And if I do create another format first and eventually end up with a wmf, what is the best way to get there without loosing quality on the way through the conversion(s)? So my question is this: How can I end up with a wmf files using linux, without sacrificing too much (any?) quality on the way? I looked in the Mail archives and couldn't find anything useful. Thanks as always, P. -- Dr Peter Dunn (USQ CRICOS No. 00244B) Web:http://www.sci.usq.edu.au/staff/dunn Email: dunn @ usq.edu.au Opinions expressed are mine, not those of USQ. Obviously... __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help