[Rd] Dropping unused levels of a factor that has "NA" as a level

2006-07-11 Thread J. Hosking
Is this a bug? > f1 <- factor(c("a", NA), levels = c("a", "NA") ) > f2 <- f1[, drop = TRUE] > f2 [1] a Levels: a I would have expected f2 to have only one level, "a". It seems to me that the code in [.factor does not follow the advice in help("factor") on how to set factor co

[Rd] Problems after lm(..., qr=FALSE)

2006-04-26 Thread J. Hosking
The documentation for lm() indicates that the 'qr' component of an lm object is optional. But some functions do not behave well when this component is absent: summary() gives an error and predict() returns all zeroes. Example: > x <- 1:10; y <- x^2 > mm <- lm(y~x, qr=FALSE) > summary(m

[Rd] addmargins

2006-02-13 Thread J. Hosking
> addmargins(UCBAdmissions, FUN = list(Total=sum)) works with no problems, but consider: > myFUN <- list(Total=sum) > addmargins(UCBAdmissions, FUN = myFUN) Error in "names<-.default"(`*tmp*`, value = "") : names() applied to a non-vector Is this a bug? > R.version _ pla

[Rd] tempdir() in R-2.2.1 under Windows

2006-01-15 Thread J. Hosking
The documentation for tempdir() and tempfile() on R-2.2.1 for Windows says that "Both will use backslash as the path separator", but in practice I see a forward slash: > tempdir() [1] "C:\\DOCUME~1\\ADMINI~1\\LOCALS~1\\Temp/RtmpGqB7ob" > tempfile() [1] "C:\\DOCUME~1\\ADMINI~1\\LOCALS~1\\Te

[Rd] strwrap

2005-09-01 Thread J. Hosking
The maximum length of a character string returned by strwrap, i.e. max(nchar(strwrap(x,width))), never in my experience exceeds width-2 (unless x contains a word that is longer than this). This is not exactly a bug -- width is described only as a "target column for wrapping lines" -- but seems odd.

[Rd] qgamma with first argument 1

2005-07-09 Thread J. Hosking
> qgamma(1,1.1) [1] Inf as expected. But for shape parameter between 0.16 and 1: > qgamma(1,.5) [1] NaN Warning message: NaNs produced in: qgamma(p, shape, scale, lower.tail, log.p) and for shape parameter 0.16 or less: > qgamma(1,.1) [1] 99.42507 Arguments close to 1

Re: [Rd] upgrading an R installation to next versoin

2005-06-30 Thread J. Hosking
Gabor Grothendieck wrote: > On 6/30/05, J. Hosking <[EMAIL PROTECTED]> wrote: > ... >> I keep a separate directory ...\R\library for nonstandard packages, >> with environment variable R_LIBS set to the directory name. > > > Do you mean your R_LIBS has two

Re: [Rd] upgrading an R installation to next versoin

2005-06-30 Thread J. Hosking
Gabor Grothendieck wrote: > When I install a new version of R (Windows XP) I have to: > > 1. copy my rw\etc\Rprofile.site file to the new installation > > 2. copy the rw\share\texmf files to the tex subfolder of the >miktex root directory and then refresh the miktex name database >