Re: [R] Rcmder Error

2008-03-25 Thread Richard M. Heiberger
That type of error often means a data problem, for example dividing by standard deviation zero, or something similar. Please look at your data values. Do you have enough items at each level of x that standard deviations can be calculated? __ R-help@r-p

Re: [R] R.app "incompatable" with Emacs

2008-03-21 Thread Richard M. Heiberger
Emacs normally recognizes line endings and opens the file correctly. Therefore the first place to look is in the file itself. When some of the lines have ^M and others do not, then emacs assumes you have LF-only line endings and displays the ^M character. The preventive action is to correct the o

Re: [R] R GUI question

2008-03-19 Thread Richard M. Heiberger
Look at Rcmdr as the base for your additional menu functions. I am using it for my introductory courses and have added my own menu items. >From CRAN, download and install Rcmdr and read it's documentation. Also from CRAN you can download and install my addin library RcmdrPlugin.HH The latter will s

Re: [R] ls() and classes

2008-03-18 Thread Richard M. Heiberger
Correction to my thinko sapply(ls(), function(x) class(get(x))) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal

Re: [R] ls() and classes

2008-03-18 Thread Richard M. Heiberger
sapply(ls(), class) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] source(echo=TRUE) bug (was: source() behavior I don't understand)

2008-03-09 Thread Richard M. Heiberger
Ok, I'll write something and try it out. Rich -Original Message- From: Duncan Murdoch [mailto:[EMAIL PROTECTED] > source() is pure R code, so if you want a function that behaves > differently, you can do it fairly easily yourself. __ R-help@r

Re: [R] source(echo=TRUE) bug (was: source() behavior I don't understand)

2008-03-09 Thread Richard M. Heiberger
surrounding them with blank lines and using C-c C-c. Rich -Original Message- From: Duncan Murdoch [mailto:[EMAIL PROTECTED] Sent: Sunday, March 09, 2008 10:52 PM To: Richard M. Heiberger Cc: r-help@r-project.org Subject: Re: [R] source(echo=TRUE) bug (was: source() behavior I don't under

Re: [R] source(echo=TRUE) bug (was: source() behavior I don't understand)

2008-03-09 Thread Richard M. Heiberger
Thanks Duncan, While there, can you give a new optional argument that will permit the echo of blanks and comments? Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-proj

[R] source() behavior I don't understand

2008-03-09 Thread Richard M. Heiberger
temp.ttt <- "ttt <- 1\nttt" conn.ttt <- textConnection(temp.ttt) source(conn.ttt, echo=TRUE) ## name of variable is echoed close(conn.ttt) cat(file="c:/temp/temp.R", temp.ttt) ## name of variable not echoed source("c:/temp/temp.R", echo=TRUE) temp.abc <- "abc <- 1\nabc" conn.abc <- textConnecti

Re: [R] "Inverting" a list

2008-02-06 Thread Richard M. Heiberger
A more primitive method is about 5 times faster than Gabor's. L <- list( a = c("1", "2", "3"), b = c("1"), d = c("2", "4") ) system.time( for (i in 1:100) {t1 <- unlist(L) names(t1) <- rep(names(L), lapply(L, length)) tapply(names(t1), t1, c) } ) system.time(

Re: [R] is it safe to replace every "<-" by "=" in R code?

2008-01-14 Thread Richard M. Heiberger
The answer in emacs is always "Yes". Type _ twice, and it will become an underscore. See C-h k _ For the full help page. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeffrey J. Hallman Is there a way to turn this off? I sometimes have to use variabl

Re: [R] Ceiling to the nearest ten?

2008-01-14 Thread Richard M. Heiberger
> a <- 1:10*4 > ceiling(a/10)*10 [1] 10 10 20 20 20 30 30 40 40 40 > -Original Message- Lauri Nikkinen Is there a function for ceiling to the nearest ten? a <- 1:10*4 a [1] 4 8 12 16 20 24 28 32 36 40 The resulting vector should look like this ("ceiling to the nearest ten") [1] 10 10

Re: [R] is it safe to replace every "<-" by "=" in R code?

2008-01-13 Thread Richard M. Heiberger
Most R users believe that there is a clear distinction between " <- " and "=". Gabor's example is a wonderful illustration of that distinction. Most users recommend " <- " for assignment for greater clarity and readability. The important characteristic for readability is the space on both sides of

Re: [R] Hmisc latex() does not want to work

2008-01-13 Thread Richard M. Heiberger
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Kane Sent: Sunday, January 13, 2008 03:56 PM ## Not run: latex(x) # creates x.tex in working directory w <- latex(x, file='/tmp/my.tex') - I think there

[R] predict.lm removes rownames for a single row. Why?

2008-01-04 Thread Richard M. Heiberger
predict.lm keeps row names when working from several rows in newdata, but always removes rowname from a single row. The rownames are removed by the line in predict.lm predictor <- drop(X[, piv, drop = FALSE] %*% beta[piv]) What is the reason for that decision? I usually want to retain the row

Re: [R] bug Rcmdr

2008-01-04 Thread Richard M. Heiberger
John, It's worse than a semi-colon problem. It is an error in a self-referential statement 'a <- a+5'. Type those lines as three separate lines in the Rcmdr Script Window and you still get the wrong answer. This is from 1.3-9. > a<-2 > a<-a+5 > a [1] 12 Rich -Original Message-

[R] fortune warning

2007-12-17 Thread Richard M. Heiberger
fortune("help") ## or any quoted string gives a warning Warning message: In grep(which, fort, useBytes = TRUE) : argument 'useBytes = TRUE' will be ignored in version.string R version 2.6.1 (2007-11-26) __ R-help@r-project.org mailing list https://s

Re: [R] Plot question

2007-12-14 Thread Richard M. Heiberger
The easiest way would be to use the HH package, which you can get from CRAN. Marc's example is limited to integers on the X axis. Using positioned(), which is an extension to ordered(), allows arbitrary values. Building on that example require(HH) CV <- rnorm(100) FV <- sample(c(-1.4, 3.2, 5),

Re: [R] Writing a file to the disk

2007-12-12 Thread Richard M. Heiberger
Since your target is a spreadsheet on Windows, consider writing directly to the spreadsheet. Use either the package xlsReadWrite or the RExcel interface which allows you to embed R functions inside Excel cells. Look at the main RExcel/rcom site http://sunsite.univie.ac.at/rcom/ and consider joini

Re: [R] Writing a file to the disk

2007-12-12 Thread Richard M. Heiberger
Since your target is a spreadsheet on Windows, it would make sense to write directly to the spreadsheet. You can use either the xlsReadWrite package, Description: Read and write Excelfiles natively (v97-2003/BIFF8) or RExcel, which allows you to imbed R functions inside Excel cells. Look at the

Re: [R] Using R function in Excel

2007-12-07 Thread Richard M. Heiberger
You are looking for RExcel, which does exactly that. Full documentation and examples are included in the package. http://sunsite.univie.ac.at/rcom/download/devel/ If you don't have R-2.6.1 yet, get the whole R system with the RExcel installed RAndFriendsSetup2061V1.82.exe Otherwise, just get

Re: [R] ftable as latex (with Hmisc?)

2007-11-28 Thread Richard M. Heiberger
I think this does what you are asking for. It should be relatively easy to write a method latex.ftable() based on this. One or two row.vars and one or two col.vars should be straightforward (with n.rgroup and n.cgroup used for the second row and column). Rich start here df = data.frame(d

Re: [R] Dot plots in R

2007-11-24 Thread Richard M. Heiberger
Yes, with the HH package. require(HH) dotplot(sample(0:9, 50, replace=TRUE), panel=panel.dotplot.tb) dotplot(rep(1:5,10) ~ sample(0:9, 50, replace=TRUE), panel=panel.dotplot.tb) dotplot(rep(1:5,10) ~ sample(0:9, 50, replace=TRUE) | rep(c(1,1,1,2,2),10), panel=panel.dotplot.tb) dotplot(~ sample(0:9

Re: [R] Ancova doesn't return test statistics

2007-11-15 Thread Richard M. Heiberger
Your model is fully saturated. It specifies terms that use up all degrees of freedom. There are no degrees of freedom left over for a Residual term and therefore there is no denominator for the tests. When you drop one term, then those degrees of freedom are left over, that is they form the Res

Re: [R] bug in multcomp?

2007-11-07 Thread Richard M. Heiberger
The only obvious typo is the misspelling of "Tukey". Uppercase is necessary. But that is not the cause of the current error. I can't duplicate the problem from your description. Look at the data.frame data_mcp. If that doesn't give you the hint, then you will need to send the data to the list,

Re: [R] xtable.by

2007-11-05 Thread Richard M. Heiberger
## I would use latex() for this example. library(Hmisc) team.dat <- ' GK Paul Robinson LB Lucus Radebe DC Michael Duberry DC Dominic Matteo RB Didier Domi MC David Natty MC Eirik Bakke MC Jody Morris FW Jamie Mcmaster ST Alan Smith ST Mark Viduka ' team <- read.table(textConnection(team.dat),

Re: [R] multicomp plotting

2007-10-23 Thread Richard M. Heiberger
The multicomp package was replaced about a year ago with the multcomp package. Your sig.data can be plotted with the multcomp package with the following code. require(multcomp) tmp <- list(confint=sig.data) attr(tmp, "type") <- "none" old.oma <- par(oma=c(0,1,0,0)) multcomp:::plot.confint.glht(tm

Re: [R] Import from excel 2007

2007-10-16 Thread Richard M. Heiberger
The best way to read or write Excel files is with the RExcel package. The development package available from http://sunsite.univie.ac.at/rcom/download/devel/RExcel.installer_1.80-14.zip reads both Excel 2003 and Excel 2007 files. In this development release, the installer is structured as an ord

Re: [R] Dice simulation: Getting rep to re-evaluate sample()?

2007-10-08 Thread Richard M. Heiberger
rep( sum(sample(1:6,100,replace=T)), times=10) Read carefully what you wrote. You asked R to sum a single sample, then make ten copies of the sum. You need to take ten samples, then sum each. apply() would be helpful. -Original Message- I'm trying to get R to simulate the sum

Re: [R] Linux editor for R+LaTeX, but not Emacs

2007-10-05 Thread Richard M. Heiberger
What are your criteria for friendliness? What features are you missing in emacs that you wish were there? Are these ESS features or LaTeX related features? Rich -Original Message- want something like Emacs (of course including auctex and ess), but not Emacs. Something like Tinn-R [htt

Re: [R] how to make an orthogonal contrasts matrix?

2007-09-12 Thread Richard M. Heiberger
tmp <- c(7,7,7,7, -4,-4,-4,-4,-4,-4,-4) tmpf <- factor(letters[1:11]) tmpf contrasts(tmpf) contrasts(tmpf) <- tmp contrasts(tmpf) zapsmall(crossprod(contrasts(tmpf))) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEAS

Re: [R] Multiple contrast of ANOVA

2007-09-11 Thread Richard M. Heiberger
Download the multcomp package for multiple comparisons. You might also want to use the MMC functions in the HH package to display the contrasts. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

<    4   5   6   7   8   9