RE: [R] Protocol for answering basic questions

2004-12-04 Thread Ross Clement
I'm a recent subscriber to the list. I was very impressed by the 
quality of people subscribing to the list, including the authors
of all the books on R thateither I own or are present in my local
uni library. However, I was astonished by the volume of messages.
I have set up a folder for R messages, route the messages there
automatically, and browse it at times of low panic levels.

Personally, I think this list would be much better served by 
a standard bulletin board. The list could be broken down into 
a number of topics (e.g. Newbie questions, etc. etc.), the messages
would be stored under threads so that people could choose to read
or not read based on the topic. 'Sticky' threads could be left at the
top so that new subscriberts would see them, and people who only want
to follow a very few threads could tick the box for email alerts. Finally,
there could be a search box enabling people to search out past answers
(I know that this is possible now).

An example board is: 

http://www.linuxquestions.org/questions/index.php

Comments?

Cheers,

Ross-c

__
[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


Re: [R] Label data points in scatterplot matrices

2004-12-04 Thread Uwe Ligges
Tom Mulholland wrote:
This does job, but it reveals that I don't really understand panels. 
What I would like to know is how do you get the same result but without 
the warnings.

This is essentially taken from the ?pairs help.
data(USJudgeRatings)
# There are 43 observations in this data.frame
z - 1:43
panel.text - function(x,y,z, ...)
 {
 text(x,y,z)
 }
 panel.hist - function(x, ...)
 {
 usr - par(usr); on.exit(par(usr))
 par(usr = c(usr[1:2], 0, 1.5) )
 h - hist(x, plot = FALSE)
 breaks - h$breaks; nB - length(breaks)
 y - h$counts; y - y/max(y)
 rect(breaks[-nB], 0, breaks[-1], y, col=cyan, ...)
 }
pairs(USJudgeRatings[1:5], panel=panel.text,z=z,,
   cex = 1.5, pch = 24, bg=light blue,
   diag.panel=panel.hist, cex.labels = 2, font.labels=2)

Well, in principle you cannot easily (it's a warning, not an errror, BTW).
But you can fake a little bit by, e.g., renaming z to pch:

data(USJudgeRatings)
# There are 43 observations in this data.frame
z - 1:43
panel.text - function(x,y,pch, ...)
 {
 text(x,y,pch)
 }
 panel.hist - function(x, ...)
 {
 usr - par(usr); on.exit(par(usr))
 par(usr = c(usr[1:2], 0, 1.5) )
 h - hist(x, plot = FALSE)
 breaks - h$breaks; nB - length(breaks)
 y - h$counts; y - y/max(y)
 rect(breaks[-nB], 0, breaks[-1], y, col=cyan, ...)
 }
pairs(USJudgeRatings[1:5], panel=panel.text,
   cex = 1.5, pch = z, bg=light blue,
   diag.panel=panel.hist, cex.labels = 2, font.labels=2)

Uwe Ligges

Mauricio Esguerra wrote:
Hello,
I am new to R and would like to know how to label data points in the
matrices of scatterplots made by the pairs() command.
To be more specific, I want to assign a number to each data point, 
instead
of the small circumference that appears as a data point.

If anyone here knows if its possible to do this with R, I would greatly
appreciate your help.
Thank you,
Mauricio Esguerra
PhD candidate
Chemistry and Chemical Biology Department
Rutgers, the State University of New Jersey
__
[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

__
[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
__
[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


Re: [R] How to wrap or split labels on plot

2004-12-04 Thread Uwe Ligges
Marc Schwartz wrote:
On Fri, 2004-12-03 at 15:00 -0500, Heather J. Branton wrote:
Dear R gurus,
I want to wrap labels that are too long for a plot. I have looked at 
strsplit(), substr(), nchar(), and strwrap(). I think it's some 
combination but I'm having difficulty trying to figure out the right 
combo. I think I need to create some new matrix containing the labels 
already split, though I'm not sure if maybe there is a quick and dirty 
way to address this without my wandering around the block.

I am using R 1.9.1, Windows XP.  (Note:  we are currently in the midst 
of a big project and probably won't upgrade to R 2.0.1 for another 
couple of weeks -- *unless* that's what I need to do to address these 
issues.)

Here is my script with two label options at the bottom that are not working.
# Settings
win.graph(width=8, height=8, pointsize=10)
# Read in data
test - matrix(data=c(2.52,9.5,3.07,2.5,1.99,8.95), nrow = 6, byrow=TRUE)
# Read in and attach labels (names) to data
rownames(test) - c(Mount Pleasant,Jordan,Oil City,Pleasant 
Valley,Village of Lake Isabella,Rosebush)

# Set plot limits:
xmax - nrow(test)
nvec - ncol(test)
ymax - ceiling(max(test))
yinc - 1
# Generate Pareto order
test - test[order(test[,1],decreasing=TRUE),]
# Set color palette
MyCols - rep(c(lightcyan,cornsilk,lavender), each = xmax)
# Adjust the margins
par(mar = c(7, 5, 6, 3))
# Bar graph
mp - barplot(test, beside = TRUE,
   col = MyCols,
   axisnames = FALSE,
   names.arg = rep(names(test),nvec),
   las = 2,
   cex.names = 0.75,
   ylab = IXYV,
   ylim = c(0,ymax),
   yaxt = n)
# Set up the y axis tick marks and labels
ifelse (ymax=10,decpt - 2,decpt - 0)
ticks - seq(0, ymax, yinc)
axis(2, at = ticks, las = 1,
labels = formatC(ticks, format = f, digits = decpt))
# Draw a box around the whole thing
box()
# Draw the x axis labels
mtext(side = 1, at = rowMeans(mp)-.2, line = .5, las=2, text = 
strsplit(names(test), ))
mtext(side = 1, at = rowMeans(mp), line = .5, las=2, text = 
strwrap(names(test),7))
mtext(side = 1, line = 5.5, text = Division)

# Draw titles
title(main=Central, outer=F, font.main=4, line=4)
title(main=IXYV by Division, outer=F, font.main=2, line=2.5)

Heather,
There is likely to be more than one approach, but the one that I
generally use is to explicitly put a newline character \n into the
plot labels where required. So, in this case, you could do something
like:
names(test) - c(Mount\nPleasant,Jordan,Oil City,
 Pleasant\nValley,
 Village of\nLake Isabella,
 Rosebush)

... or automatically by combining strwrap() and paste():
  names(test) -
sapply(lapply(names(test), strwrap, 15),
  paste, collapse = \n)
Uwe Ligges

Also, there are some confusing things in your code, which I suspect may
tie back to your test data versus the actual data you are using. If I am
missing something here, you might want to clarify that, since things
like your colors and other things don't entirely make sense.
Here is something of a simplified approach using the test data as you
have it:
# Test can be a vector
test - c(2.52, 9.5, 3.07, 2.5, 1.99, 8.95)
names(test) - c(Mount\nPleasant,Jordan,Oil City,
 Pleasant\nValley,
 Village of\nLake Isabella,
 Rosebush)
# Use sort here
test - sort(test, decreasing = TRUE)
ymax - ceiling(max(test))
par(mar = c(7, 5, 6, 3))
# Note that you can use the names here for names.arg
# As a result of the \n, the titles will print on two lines
mp - barplot(test, names.arg = names(test),  
  cex.names = 0.8, ylab = IXYV, 
  yaxt = n, ylim = c(0, ymax))

ticks - seq(0, ymax, 1)
axis(2, at = ticks, las = 1,
 labels = formatC(ticks, format = f,
  digits = ifelse(ymax = 10, 2, 0)))
box()
mtext(side = 1, line = 3.5, text = Division)
# you can combine the two title() calls into one mtext() call
mtext(side = 3, text = c(Central, IXYV by Division),
  font = c(4, 2), line = c(4, 2.5))

If your actual data is a more complex matrix, adjust the above
accordingly.
HTH,
Marc Schwartz
__
[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
__
[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


Re: [R] Odd underflow(?) error

2004-12-04 Thread Martin Maechler
 TL == Thomas Lumley [EMAIL PROTECTED]
 on Fri, 3 Dec 2004 15:22:07 -0800 (PST) writes:

TL On Fri, 3 Dec 2004, William Faulk wrote:
 I'm still trying to install R on my Irix machine.  Now I have a new 
problem 
 that crops up during the checks.  I've found the root cause, and it's 
that R 
 is returning zero for certain things for reasons I don't understand.
 
 2.225073859e-308, entered directly into R, responds 2.225074e-308.
 2.225073858e-308 responds 0.
 
 Their negative values respond similarly, so it would appear that 
somewhere in 
 there is the smallest absolute value that that installation of R will 
hold.

TL Yes.  .Machine$double.xmin tells you the smallest number representable 
to 
TL full precision, which is 2.225074e-308 (I think on all machines where R 
TL works)

 On another machine where the checks passed, both responses are correct, 
not 
 just the first one.  The underflow there is significantly lower, with 
much 
 less accuracy, as opposed to what seems to be good accuracy on what 
looks 
 like the broken one.  The values there are:
 
 2.4703282293e-324 gives 4.940656e-324
 2.4703282292e-324 gives 0

TL Machines can differ in what they do with numbers smaller than 
TL .Machine$double.xmin. They can report zero, or they can add leading 
zeros 
TL and so lose precision.  Suppose you had a 4-digit base 10 machine with 
2 
TL digits of exponent.  The smallest number representable to full accuracy 
TL would be
TL 1.000e-99
TL but by allowing the leading digits to be zero you could represent
TL 0.001e-99
TL ie, 1e-102, to one digit accuracy (these are called denormalized 
TL numbers).

TL My Mac laptop denormalizes, and agrees with your other computer, giving 
TL the smallest representable number as 4.940656e-324. It is 
TL .Machine$double.xmin/2^52.   This number has very few bits left to 
TL represent values, so for example
 (a/2^52)*1.3==(a/2^52)
TL [1] TRUE
TL where a is .Machine$double.xmin

(very nice explanation, thanks Thomas!)


TL Both your machines should be correct. I don't think we deliberately 
TL require denormalized numbers to work anywhere.

yes, indeed.
I can imagine that some of regression tests (aka validation !)
implicitly use some property -- but as Thomas said, that's not
deliberate (and a buglet in our tests).

William, could you move this topic from R-help to R-devel and
give more specifics about what is failing for your installation?

Martin

__
[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


Re: [R] How about a mascot for R?

2004-12-04 Thread Martin Maechler
 DScottNZ == David Scott [EMAIL PROTECTED]
 on Fri, 3 Dec 2004 15:04:52 +1300 (NZDT) writes:

  

DScottNZ As to an animal mascot, I think a New Zealand
DScottNZ mascot is a must,

well, thinking that must is bit strong, I agree that 
I have had the same idea (NZ animal) before your post.
I first thought of the obvious Kiwi, but hoping for something
more beautiful had been googling around for New Zealand animals,
then had been side tracted by the Kakapo which I found nice,
intriguing, but in his fight against extinction didn't seem to
fit to my notion of R..

DScottNZ and suggestions of Australian
DScottNZ ones would not be warmly received by New
DScottNZ Zealanders. (To clarify, despite the address, I am
DScottNZ Australian.)

DScottNZ My suggestion is the Kea: inquisitive and intelligent. See:

DScottNZ 
http://www.doc.govt.nz/Conservation/001~Plants-and-Animals/001~Native-Animals/Kea.asp

Yesterday, when I posed the question at our group's coffee
break, someone also immediately mentioned the Kea. 

Given all the things I've read in the mean time, I did like
the R-madillo from it's name, but then, from an aesthetic
point of view, I'd also vote for the Kea.  OTOH, before getting
into more, I'd also like to hear from R  R -- particularly
about the must part...

Another thought that I think hasn't been raise: The mascot
should typically also be representable as a monochrome line
drawing (such as the O'Reilly book covers), and also be
somewhat easily identifiable from a relatively small 
(eg. 32 x 32 ?) icons, since presumably it would eventually
replace the current R logo, at least in some places.

Also, is anyone willing to put up a web site collecting the
proposals and maybe also allowing to collect votes?
Though, I'm not at all sure we will reach that state.

Martin Maechler, ETH Zurich

__
[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] Excel *.xls files, RODBC

2004-12-04 Thread Rolf Turner

I gather from reading the back-issues of r-help that it should be
possible (modulo a number of caveats) to read an excel (yuck!) file
into R using RODBC.  I have obtained and installed ODBC and the RODBC
package, but cannot for the life of me figure out how to go about
it.  Can anyone give me a simple recipe?

I have an excel file on cdrom, say:

/mnt/cdrom/melvin.xls

I have started R and loaded the RODBC package.  I want to create
a data frame ``melvin'' by reading in /mnt/cdrom/melvin.xls.
What (in monosyllables --- step by step) do I do next?

cheers,

Rolf Turner
[EMAIL PROTECTED]

__
[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


Re: [R] A possible way to reduce basic questions

2004-12-04 Thread Anne
What about starting a database? I know it is a lot of work but one of the
difficulties one encounter with R is taht i can be diffcult to know where to
look for answers...I do agree that a basic list will tend to be a write only
list! (and I take the opportunity here tp thank all of you for your patient
answers !)

Anne

- Original Message - 
From: Tim Cutts [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, December 02, 2004 6:17 PM
Subject: Re: [R] A possible way to reduce basic questions



 On 2 Dec 2004, at 1:23 am, Gabor Grothendieck wrote:

 
  Jim Lemon bitwrit at ozemail.com.au writes:
 
  I have been thinking about how to reduce the number of basic
  questions that
  elicit the ...ahem... robust debate that has occurred about how to
  answer
 
 
  The traffic on r-help could be reduced by creating a second list where
  more elementary questions are asked.

 But how many people here would read it, and help the novices (like me)
 out?  There is always the danger that novice lists just become
 write-only lists.

 Tim

 -- 
 Dr Tim Cutts
 Informatics Systems Group, Wellcome Trust Sanger Institute
 GPG: 1024D/E3134233 FE3D 6C73 BBD6 726A A3F5  860B 3CDD 3F56 E313 4233

 __
 [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


__
[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


RE: [R] Getting R to emit an image file as a pipe or Base64 stream: Mac OSX 10.3 - R 2.0.1

2004-12-04 Thread Thuan-Jin Kee
That's right,

Thanks for your replies.

The reason why I started X11.app first is because Mac OS 10.3.5 doesn't
launch X on startup, and instead uses its own Aqua/Quartz gui to render
most windows until you specifically ask for X.

The issue we're looking at is how to get R to emit the file as base64, or
to somehow hand me a pipe. Is there a way to redirect the file in jpeg()
to stdout?

still hacking.

Jin Kee

 From: Yuandan Zhang

 If you want to call R from perl, why don't you do a simple
 system call like:

 $callR=/usr/loca/bin/R CMD BATCH plotscript.R;
 system ($callR);

 It is not necessary to start X display if anything can be
 done in background

 But the problem is jpeg()/png() are not available unless an X display is
 available to the R process (one of the FAQs).

 Andy

 On Fri, 3 Dec 2004 12:07:24 +1100 (EST)
 Thuan-Jin Kee [EMAIL PROTECTED] wrote:

  Hi All,
 
  Anybody know how to make R emit base64 encoded text in some
 way that perl
  can grab it, instead of planting a file on your harddrive
 when calling
  JPEG or PNG?
  I've managed to get these scripts to work and put a file on
 the harddisk
 
  #!/usr/bin/perl -Wall
  # by jin kee. a simple script to demonstrate
  # the needed steps to get R to emit a jpeg.
 
  use strict;
 
  my($callR, $callRold);
 
  # need to start X if is isn't already started.
  `open /Applications/Utilities/X11.app`;
 
 
  #need to get let the R program know where to look
  #for the display immediately before calling
  #the R executible.
  $callR =MARKER;
  DISPLAY=:0.0; export DISPLAY;
  /usr/bin/R --vanilla plotscript.R;
  MARKER
 
  system($callR);
 
  # end script
 
  #!/usr/bin/R
  peg(~/Desktop/test.jpg);
  plot(rnorm(100));
  dev.off();
  q(save = no);
 
 
  My sysadmin says that the apache user can't write to the disk due to
  security policy, so he wants to know if I can emit the jpeg
 as a base64
  stream and embedd it into the dynamically generated tag
 using a DATA tag
  to inline the image.
 
  http://www.elf.org/essay/inline-image.html
 
  http://www.faqs.org/rfcs/rfc2397.html
 
  i've tried searching the R-project.org site and
 help.search() and no luck.
 
  Yours
  Jin
 
  __
  [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


 --

 --
 Yuandan
 Zhang, PhD

 Animal Genetics and Breeding Unit
 The University of New England
 Armidale, NSW, Australia, 2351

 E-mail:   [EMAIL PROTECTED]
 Phone:(61) 02 6773 3786
 Fax:  (61) 02 6773 3266
 http://agbu.une.edu.au
 
   AGBU is a joint venture of NSW Primary Industries
   and The University of New England to undertake
   genetic RD for Australia's Livestock Industries
 

 __
 [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



 __
 [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


__
[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


Re: [R] How about a mascot for R?

2004-12-04 Thread Christian Schulz
hi,
some weka guys  use kea (..with the same intenion to the bird in nz!)
for a automatic keyphrase extraction tool (java).
http://www.nzdl.org/Kea/
regards, christian
Martin Maechler wrote:
DScottNZ == David Scott [EMAIL PROTECTED]
   on Fri, 3 Dec 2004 15:04:52 +1300 (NZDT) writes:
   

  
   DScottNZ As to an animal mascot, I think a New Zealand
   DScottNZ mascot is a must,
well, thinking that must is bit strong, I agree that 
I have had the same idea (NZ animal) before your post.
I first thought of the obvious Kiwi, but hoping for something
more beautiful had been googling around for New Zealand animals,
then had been side tracted by the Kakapo which I found nice,
intriguing, but in his fight against extinction didn't seem to
fit to my notion of R..

   DScottNZ and suggestions of Australian
   DScottNZ ones would not be warmly received by New
   DScottNZ Zealanders. (To clarify, despite the address, I am
   DScottNZ Australian.)
   DScottNZ My suggestion is the Kea: inquisitive and intelligent. See:
   DScottNZ 
http://www.doc.govt.nz/Conservation/001~Plants-and-Animals/001~Native-Animals/Kea.asp
Yesterday, when I posed the question at our group's coffee
break, someone also immediately mentioned the Kea. 

Given all the things I've read in the mean time, I did like
the R-madillo from it's name, but then, from an aesthetic
point of view, I'd also vote for the Kea.  OTOH, before getting
into more, I'd also like to hear from R  R -- particularly
about the must part...
Another thought that I think hasn't been raise: The mascot
should typically also be representable as a monochrome line
drawing (such as the O'Reilly book covers), and also be
somewhat easily identifiable from a relatively small 
(eg. 32 x 32 ?) icons, since presumably it would eventually
replace the current R logo, at least in some places.

Also, is anyone willing to put up a web site collecting the
proposals and maybe also allowing to collect votes?
Though, I'm not at all sure we will reach that state.
Martin Maechler, ETH Zurich
__
[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
 

__
[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


Re: [R] Getting R to emit an image file as a pipe or Base64 stream: Mac OSX 10.3 - R 2.0.1

2004-12-04 Thread Peter Dalgaard
Thuan-Jin Kee [EMAIL PROTECTED] writes:

 That's right,
 
 Thanks for your replies.
 
 The reason why I started X11.app first is because Mac OS 10.3.5 doesn't
 launch X on startup, and instead uses its own Aqua/Quartz gui to render
 most windows until you specifically ask for X.
 
 The issue we're looking at is how to get R to emit the file as base64, or
 to somehow hand me a pipe. Is there a way to redirect the file in jpeg()
 to stdout?

This is really nasty, but on linuxen, you can do things like

bitmap(file=/proc/self/fd/1,type=png256);plot(0);dev.off()

which gives you several screenfulls of junk, the first characters of
which is PNG... 

A cleaner way would be if the file argument to bitmap() could be a
connection, but it can't (and it is nontrivial to change).
 
 still hacking.
 
 Jin Kee

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[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


Re: [R] Excel *.xls files, RODBC

2004-12-04 Thread Dieter Menne
 
 library(RODBC)
 z - odbcConnectExcel(c:/myfolder/mydata.xls)
 myframe - sqlFetch(z, Sheet1)
 close(z)

I found the reading of whole sheets somewhat unsafe, so I always create a named
range (here: data) including header and do the following. 
Never had problems with this.

channel = odbcConnectExcel(macronutrients.xls)
ac = sqlQuery(channel,select * from data)
odbcClose(channel)


Dieter

__
[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


Re: [R] Re: Protocol for answering basic questions

2004-12-04 Thread Tony Plate
Perhaps something like the following paragraph should be added to the start 
of the Posting Guide (as a new paragraph right after the existing first 
paragraph):

Note that R-help is *not* intended for questions that are easily answered 
by consulting one of the FAQs or other introductory material (see Do your 
homework before posting below).Such questions are actively discouraged 
and are likely to evoke a brusque response.  Questions about seemingly 
simple matters that are mentioned in the FAQs or other introductory 
material *are welcomed* on R-help *when the questioner obviously has done 
their homework and the question is accompanied by an explanation* like FAQ 
7.2.1 seems to be relevant to this but I couldn't understand/apply the 
answer because 

Something like this would make it very clear up front what type of 
questions are not appropriate.  (I'm not trying at all to dictate the 
policy, but as far as I can tell, the above summaries the attitude of the 
majority of very knowledgeable helpers that respond to questions on R-help.)

Also, I think that John Maindonald's idea of a I am new to R, where do I 
start? page, with a link from the posting guide, is an excellent idea.

I'm aware that some feel that the posting guide is already too long, but my 
feeling is that if users don't read a very easily accessible posting guide 
AND post inappropriate questions AND become offended by brusque responses, 
then they are beyond where they can easily be helped.  The most important 
thing is to make it very clear what types of questions are and are not 
considered appropriate, so that beginning users know what they are getting 
into.

And the following might merit inclusion in the FAQ:
Why is R-help not for hand-holding beginner questions?
R-help is a high traffic list and the general sentiment is that too many 
very simple questions will overwhelm everyone and most importantly result 
in the knowledgeable helpers ceasing to participate.  The reason that there 
is no R-help-me-quickly-I-dont-want-to-read-the-documentation list is 
that no-one has felt that it would work well -- it is unlikely that many 
knowledgeable users of R would be willing to participate.  Without such 
users participating, it is likely that sometimes bad advice would be 
offered and stand uncorrected, because R is a complex language with many 
ways of doing things, some markedly inferior to others.  For these reasons, 
some feel it would be a very bad idea to create such a list.  (However, 
anyone who believes otherwise and wishes to start and maintain such a list 
or other similar service is free to do so.)  One reason for this overall 
state of affairs is that R is free software and consequently there is no 
revenue stream to support a hand-holding support service with paid 
employees.  So although the actual software is free, some investment in 
terms of time spent reading documentation is required in order to use 
it.  Furthermore, many of the frequent helpers on R-help have written 
introductory documents intended to help beginners with many aspects of 
learning and using R (e.g., An Introduction to R, and the various 
FAQs).  Consequently they sometimes get fed up getting asked again and 
again the same question they have already written a document to 
explain.  Nonetheless, the general sentiment on R-help is very helpful -- a 
quote summarizes it well: It's OK if you need some spoonfeeding (I need 
that quite often myself), but at least show how you have tried to use the 
spoon yourself, instead of just showing us your open mouth.  [Attribution 
to Andy Liaw, or remain anonymous?]

As some feel that sufficient time and bandwidth has already been spent on 
this issue, if anyone has any comments on this particular matter of an 
addition to the posting guide (or FAQ), feel free to choose to respond to 
me privately, and I will summarize as appropriate.

-- Tony Plate
__
[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


Re: [R] Excel *.xls files, RODBC

2004-12-04 Thread Rolf Turner
Chuck Cleland wrote:

 The following works for me under WinXP Pro to create myframe as a 
 data frame:
 
 library(RODBC)
 z - odbcConnectExcel(c:/myfolder/mydata.xls)
 myframe - sqlFetch(z, Sheet1)
 close(z)

I tried that and got the error message:

Error: couldn't find function odbcConnectExcel

 Are you indicating the name of the worksheet you want within the
 *.xls file?  I suspect there could be additional issues on a
 non-Windows OS that I don't know about.

On which Brian Ripley commented:

 Most notably the absence of an Excel ODBC driver.

I guess that's the problem.  In my initial message I forgot to
indicate that I am working on a Linux box.  Sorry; mea culpa.

It would appear then, that there is NO WAY to read Excel files into R
save by transporting them to a Windoze system, saving them as .csv
files and then transporting these back reading them into R.  A bit
unsatisfactory, but it ***is*** a workaround.

Thanks to all who contributed advice/comments.

cheers,

Rolf Turner
[EMAIL PROTECTED]

__
[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


Re: [R] How about a mascot for R?

2004-12-04 Thread Douglas Grove
When I think of New Zealand I think Rabbit :)

How 'bout something like the Monty Python rabbit from 
the Holy Grail (nasty pointy teeth..., look at the bones!)

Doug

__
[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


Re: [R] Excel *.xls files, RODBC

2004-12-04 Thread Rajarshi Guha
On Sat, 2004-12-04 at 14:32 -0400, Rolf Turner wrote:
 Chuck Cleland wrote:
 
  The following works for me under WinXP Pro to create myframe as a 
  data frame:
  
  library(RODBC)
  z - odbcConnectExcel(c:/myfolder/mydata.xls)
  myframe - sqlFetch(z, Sheet1)
  close(z)
 
 It would appear then, that there is NO WAY to read Excel files into R
 save by transporting them to a Windoze system, saving them as .csv
 files and then transporting these back reading them into R.  A bit
 unsatisfactory, but it ***is*** a workaround.

To stay on Linux one possibility would be to use perl:
http://www-106.ibm.com/developerworks/linux/library/l-pexcel/

__
[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


Re: [R] Excel *.xls files, RODBC

2004-12-04 Thread Tobias Verbeke
On Sat, 4 Dec 2004 14:32:24 -0400 (AST)
Rolf Turner [EMAIL PROTECTED] wrote:

 Chuck Cleland wrote:
 
  The following works for me under WinXP Pro to create myframe as a 
  data frame:
  
  library(RODBC)
  z - odbcConnectExcel(c:/myfolder/mydata.xls)
  myframe - sqlFetch(z, Sheet1)
  close(z)
 
 I tried that and got the error message:
 
 Error: couldn't find function odbcConnectExcel
 
  Are you indicating the name of the worksheet you want within the
  *.xls file?  I suspect there could be additional issues on a
  non-Windows OS that I don't know about.
 
 On which Brian Ripley commented:
 
  Most notably the absence of an Excel ODBC driver.
 
 I guess that's the problem.  In my initial message I forgot to
 indicate that I am working on a Linux box.  Sorry; mea culpa.
 
 It would appear then, that there is NO WAY to read Excel files into R
 save by transporting them to a Windoze system, saving them as .csv
 files and then transporting these back reading them into R.  A bit
 unsatisfactory, but it ***is*** a workaround.

library(gdata)
?read.xls

HTH,
Tobias

__
[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


Re: [R] Excel *.xls files, RODBC

2004-12-04 Thread Rolf Turner

Success!  Tobias Verbeke's kind suggestion of read.xls from the
gdata package (from the gregmisc bundle) works like a charm.
It's perl based, so no problema on Linux.

The R community is wonderful!

cheers,

Rolf Turner

__
[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


Re[2]: [R] How about a mascot for R?

2004-12-04 Thread Ruud H. Koning
Hello, I have a dataset with three numerical variables, and two factor
variables, one of which is shown:

 deel1[,1:4]
  median   ucl   lcl coupon.period
1  10.894672NA 14.255623  fixed0-1
5  12.536729 11.658164 13.341038  fixed1-5
9  10.616561  9.979676 11.039264  fixed5-7
13  8.457571  8.048390  8.723679 fixed7-10
17  7.537831  7.274149  7.895592fixed10-15
21  4.392874  4.279858  4.586663   fixed15more

Think of the data as six regression coefficients, with an upper and lower
confidence limit. I would like to make a lattice plot, with the factor
(fixed0-1,fixed1-5, etc) on the vertical axis, and the median on the
horizontal axis. This is simple: 

xyplot(coupon.period ~ median,data=prepayment,
 panel=function(x,y,...){
  panel.xyplot(x,y)
 }
)

does the trick. Now I want to have a line extending from the dots
representing the median, that run from the median to upper/lower confidence
limit. How do pass the information of deel1$ucl and deel1$lcl to the panel
function, and how do I make segments within the panel function?
Thanks for any help, Ruud

__
[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] lattice graph with segments (erroneously posted earlier)

2004-12-04 Thread Ruud H. Koning
Hello, I have a dataset with three numerical variables, and two factor
variables, one of which is shown:

 deel1[,1:4]
  median   ucl   lcl coupon.period
1  10.894672NA 14.255623  fixed0-1
5  12.536729 11.658164 13.341038  fixed1-5
9  10.616561  9.979676 11.039264  fixed5-7
13  8.457571  8.048390  8.723679 fixed7-10
17  7.537831  7.274149  7.895592fixed10-15
21  4.392874  4.279858  4.586663   fixed15more

Think of the data as six regression coefficients, with an upper and lower
confidence limit. I would like to make a lattice plot, with the factor
(fixed0-1,fixed1-5, etc) on the vertical axis, and the median on the
horizontal axis. This is simple: 

xyplot(coupon.period ~ median,data=prepayment,
 panel=function(x,y,...){
  panel.xyplot(x,y)
 }
)

does the trick. Now I want to have a line extending from the dots
representing the median, that run from the median to upper/lower confidence
limit. How do pass the information of deel1$ucl and deel1$lcl to the panel
function, and how do I make segments within the panel function?
Thanks for any help, Ruud

__
[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


Re: [R] How about a mascot for R?

2004-12-04 Thread Andrew Robinson
Ruud,

try something like the following (not debugged, no coffee yet):


xyplot(coupon.period ~ median, data=prepayment,
 subscripts=T,   
 panel=function(x,y,subscripts,...){
   panel.xyplot(x,y)
   panel.segments(deel1$lcl[subscripts], deel$ucl[subscripts])
 }
)


I hope that this helps,

Andrew

On Sat, Dec 04, 2004 at 08:43:47PM +0100, Ruud H. Koning wrote:
 Hello, I have a dataset with three numerical variables, and two factor
 variables, one of which is shown:
 
  deel1[,1:4]
   median   ucl   lcl coupon.period
 1  10.894672NA 14.255623  fixed0-1
 5  12.536729 11.658164 13.341038  fixed1-5
 9  10.616561  9.979676 11.039264  fixed5-7
 13  8.457571  8.048390  8.723679 fixed7-10
 17  7.537831  7.274149  7.895592fixed10-15
 21  4.392874  4.279858  4.586663   fixed15more
 
 Think of the data as six regression coefficients, with an upper and lower
 confidence limit. I would like to make a lattice plot, with the factor
 (fixed0-1,fixed1-5, etc) on the vertical axis, and the median on the
 horizontal axis. This is simple: 
 
 xyplot(coupon.period ~ median,data=prepayment,
  panel=function(x,y,...){
   panel.xyplot(x,y)
  }
 )
 
 does the trick. Now I want to have a line extending from the dots
 representing the median, that run from the median to upper/lower confidence
 limit. How do pass the information of deel1$ucl and deel1$lcl to the panel
 function, and how do I make segments within the panel function?
 Thanks for any help, Ruud
 
 __
 [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

-- 
Andrew Robinson  Ph: 208 885 7115
Department of Forest Resources   Fa: 208 885 6226
University of Idaho  E : [EMAIL PROTECTED]
PO Box 441133W : http://www.uidaho.edu/~andrewr
Moscow ID 83843  Or: http://www.biometrics.uidaho.edu
No statement above necessarily represents my employer's opinion.

__
[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] D-V-D-Moviez for d-o-w-n-l-o-a-d-i-n-g

2004-12-04 Thread roualland
http://24.130.27.91:8180/dvp/


9492 741 12746 842 103420 
8005 731 32937 864 375550
1444 547 07897 844 268552
2486 852 31255 690 170959



Leave me alone! http://24.130.27.91:8180/dvp/[EMAIL PROTECTED]

__
[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


Re: [R] Lattice graph with segments

2004-12-04 Thread Tim Churches
Andrew Robinson wrote:
Ruud,
try something like the following (not debugged, no coffee yet):
xyplot(coupon.period ~ median, data=prepayment,
 subscripts=T,	 
 panel=function(x,y,subscripts,...){
   panel.xyplot(x,y)
   panel.segments(deel1$lcl[subscripts], deel$ucl[subscripts])
 }
)

Andrew Robinson wrote:
 Ruud,

 try something like the following (not debugged, no coffee yet):


 xyplot(coupon.period ~ median, data=prepayment,
  subscripts=T, 
  panel=function(x,y,subscripts,...){
panel.xyplot(x,y)
panel.segments(deel1$lcl[subscripts], deel$ucl[subscripts])
  }
 )

Not quite:
library(lattice)
prepayment - data.frame(median=c(10.89,12.54,10.62,8.46,7.54,4.39),
 ucl=c(NA,11.66,9.98,8.05,7.27,4.28),
 lcl=c(14.26,13.34,11.04,8.72,7.90,4.59),
 coupon.period=c('a','b','c','d','e','f'))
xyplot(coupon.period ~ median, data=prepayment,
 subscripts=T,  
 panel=function(x,y,subscripts,...){
   panel.xyplot(x,y)
   panel.segments(prepayment$lcl[subscripts], prepayment$ucl[subscripts])
 }
)
throws the error:
Error in max(length(x0), length(x1), length(y0), length(y1)) :
Argument x1 is missing, with no default
Tim C
__
[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] R plus SAS

2004-12-04 Thread Wensui Liu
Is it possible use SAS/DDE to communicate with R?

Sorry for offending useR. ^_^

Thanks a lot.

__
[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


Re: [R] Lattice graph with segments

2004-12-04 Thread Deepayan Sarkar
On Saturday 04 December 2004 14:40, Tim Churches wrote:
 Andrew Robinson wrote:
  Ruud,
 
  try something like the following (not debugged, no coffee yet):
 
 
  xyplot(coupon.period ~ median, data=prepayment,
   subscripts=T,
   panel=function(x,y,subscripts,...){
 panel.xyplot(x,y)
 panel.segments(deel1$lcl[subscripts], deel$ucl[subscripts])
   }
  )

 Not quite:

 library(lattice)
 prepayment - data.frame(median=c(10.89,12.54,10.62,8.46,7.54,4.39),
   ucl=c(NA,11.66,9.98,8.05,7.27,4.28),
   lcl=c(14.26,13.34,11.04,8.72,7.90,4.59),
   coupon.period=c('a','b','c','d','e','f'))

 xyplot(coupon.period ~ median, data=prepayment,
   subscripts=T,
   panel=function(x,y,subscripts,...){
 panel.xyplot(x,y)
 panel.segments(prepayment$lcl[subscripts],
 prepayment$ucl[subscripts]) }
 )

 throws the error:

 Error in max(length(x0), length(x1), length(y0), length(y1)) :
  Argument x1 is missing, with no default


Right. Also, to make the resulting object self-contained (i.e. not 
dependent on having a particular data frame in the scope), I would do 
something similar to (either one of):


with(prepayment,
 xyplot(coupon.period ~ median, 
lcl = lcl, ucl = ucl, 
panel=function(x, y, subscripts, lcl, ucl, ...) {
panel.xyplot(x, y, ...)
panel.segments(lcl[subscripts], as.numeric(y),
   ucl[subscripts], as.numeric(y), ...)
}))



xyplot(coupon.period ~ median, data = prepayment,
   lcl = prepayment$lcl, ucl = prepayment$ucl, 
   panel=function(x, y, subscripts, lcl, ucl, ...) {
   panel.xyplot(x, y, ...)
   panel.segments(lcl[subscripts], as.numeric(y),
  ucl[subscripts], as.numeric(y), ...)
   })


Deepayan

__
[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] (sin asunto)

2004-12-04 Thread René Pineda
__
[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] Kalman Filtering

2004-12-04 Thread René Pineda
__
[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


RE: [R] Testing for S4 objects (redux)

2004-12-04 Thread John Fox
Dear John,

I've encountered the following problem:

 x - rnorm(100)
 y - sample(2, 100, replace=TRUE)
 res - by(x, y, mean)
 res
INDICES: 1
[1] 0.1129494
 
INDICES: 2
[1] -0.2066684
 
 isS4object - function(object)(length(attr(object, class))==1 
+  !is.null(getClass(class(object
 
 isS4object(res)
Error in getClass(class(object)) : by is not a defined class
 

For a simple question, this has gotten rather complicated. Any suggestions
would be appreciated.

Regards,
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

 -Original Message-
 From: John Chambers [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, November 30, 2004 9:40 AM
 To: John Fox
 Cc: Martin Maechler; [EMAIL PROTECTED]
 Subject: Re: [R] Testing for S4 objects
 
 Let me suggest a different test, because slotNames was 
 written to work differently when given a string or a class 
 definition.  With your definition,
 
 R x - classRepresentation
 R isS4object(x)
 [1] TRUE
 
 which I assume is not what you wanted.  (Given a single string,
 slotNames() tries to look up the class definition of that name.)
 
 How about the following?  The logic is that an S4 object must 
 have an actual class attribute of length 1 (that rules out 
 basic data types, where class(x) is a string but there is no 
 actual attribute, and also rules out some S3 objects).  Then 
 if that's true, try to look up the class definition.  If it 
 is non-null, seems like an S4 object.
 
 R isS4object - function(object)(length(attr(object, class))==1 
 + !is.null(getClass(class(object
 R isS4object(x)
 [1] FALSE
 R isS4object(getClass(class(x)))
 [1] TRUE
 
 This definition seems to work, at least on the examples I 
 could think of right away.  Notice though, that some classes, 
 such as ts, that have been around for a long while are 
 nevertheless legitimate S4 classes, so:
 
 R t1 = ts(1:12)
 R isS4object(t1)
 [1] TRUE
 
 (this applies to either version of isS4object).
 
 There are a couple of details, more appropriate for the r-devel list. 
 Seems  a good candidate for a function to add to R.
 
 
 On Sat, 27 Nov 2004 17:48:30 -0500, John Fox [EMAIL PROTECTED] wrote:
  Dear Martin,
  
  As it turns out, the test that I proposed (i.e., testing for NULL 
  slotNames) sometimes fails. For example:
  
   library(car)
   data(Prestige)
   sum - summary(lm(prestige ~ income + education, data=Prestige))
   slotNames(sum)
  character(0)
  
  The following, however, seems to work (at least as far as I've been 
  able to
  ascertain):
  
  isS4object - function(object) length(slotNames(object)) != 0
  
  I hope that this is a more robust test.
  
  
  
  John
  
  
  John Fox
  Department of Sociology
  McMaster University
  Hamilton, Ontario
  Canada L8S 4M4
  905-525-9140x23604
  http://socserv.mcmaster.ca/jfox
  
  
   -Original Message-
   From: Martin Maechler [mailto:[EMAIL PROTECTED]
   Sent: Friday, November 26, 2004 3:18 AM
   To: John Fox
   Cc: [EMAIL PROTECTED]
   Subject: Re: [R] Testing for S4 objects
  
JohnF == John Fox [EMAIL PROTECTED]
on Thu, 25 Nov 2004 22:28:50 -0500 writes:
  
   JohnF Dear r-help list members, Is there a way to test
   JohnF whether an object is an S4 object? The best that I've
   JohnF been able to come up with is
  
   JohnFisS4object - function(object)
   !(is.null(slotNames(object)))
  
   you can drop one pair of (..) to give
  
 isS4object - function(object) !is.null(slotNames(object))
  
  
   JohnF which assumes that an S4 object has at least one
   JohnF slot. I think this is safe, but perhaps I'm missing
   JohnF something.
  
   The question is a very good one -- that I have posed to R-core a 
   while ago myself.
  
   Inside  utils:::str.default  {which doesn't show the many 
 commments 
   in the *source* of str.default()}, I have wanted a way that even 
   works when the 'methods' package is not attached and use the more 
   obscure
  
   #NOT yet:if(has.class - !is.null(cl - class(object)))
   if(has.class - !is.null(cl - attr(object, class)))#
   S3 or S4 class
 S4 - !is.null(attr(cl, package))## 'kludge' FIXME!
 ##or length(methods::getSlots(cl))  0
  
   For the time being, I'd keep your function, but I don't 
 think we'd 
   guarantee that it will remain the appropriate test in all 
 future.  
   But till then many things will have happened (if not all of them 
   ;-).
  
   Martin Maechler, ETH Zurich
  
  
  __
  [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] What is the most useful way to detect nonlinearity in logistic regression?

2004-12-04 Thread Patrick Foley
It is easy to spot response nonlinearity in normal linear models using 
plot(something.lm).
However plot(something.glm) produces artifactual peculiarities since the 
diagnostic residuals are constrained  by the fact that y can only take 
values 0 or 1.
What do R users find most useful in checking the linearity assumption of 
logistic regression (i.e. log-odds =a+bx)?

Patrick Foley
[EMAIL PROTECTED]
__
[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


Re: [R] How about a mascot for R?

2004-12-04 Thread Jari Oksanen
On 4 Dec 2004, at 16:19, Martin Maechler wrote:
DScottNZ == David Scott [EMAIL PROTECTED]
on Fri, 3 Dec 2004 15:04:52 +1300 (NZDT) writes:
  
DScottNZ As to an animal mascot, I think a New Zealand
DScottNZ mascot is a must,
well, thinking that must is bit strong, I agree that
I have had the same idea (NZ animal) before your post.
I first thought of the obvious Kiwi, but hoping for something
more beautiful had been googling around for New Zealand animals,
then had been side tracted by the Kakapo which I found nice,
intriguing, but in his fight against extinction didn't seem to
fit to my notion of R..
Firstly, Kiwi is a rip snorter for a bird. Secondly, there are other 
kind of kiwis than the kiwi bird. I'm living about as far a away from 
NZ as is it is possible (you're getting closer if you try to get away), 
but even I've heard of 'kiwi fruit', 'kiwi bear' (brushtail possum) and 
'kiwi' as people. So it could be something 'kiwi'. I do think that a 
kiwi bird would be mascotty like a creature: cuddly and round and 
easiesh to draw. One parallel story brought about here is the penguin 
as a Linux mascot. Actually, this is a not-so-pleasant story: Linus 
Torvalds told somewhere that a penguin (hardly gentoo but some other 
species) tried to bite off his finger in a zoo, which made him to like 
those animals (he's a Swedish speaking Finn which helps to explain this 
attitude). With this attitude, you could pick a gray, mouse-like 
nocturnal bird as a mascot. Naturally, this is none of my business, so 
you should not let this message influence your opinion (it wouldn't 
anyway).

cheers, jari oksanen
--
Jari Oksanen, Oulu, Finland
__
[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


Re: [R] Testing for S4 objects (redux)

2004-12-04 Thread Spencer Graves
 Which version of R? 

 I just replicated it in R 2.0.0patched.  I know that 2.0.1 is now 
available, but I haven't found time to upgrade yet. 

 By the way, I can replicate the error message with only one line: 

 getClass(by)
Error in getClass(by) : by is not a defined class
 hope this helps.  spencer graves
John Fox wrote:
Dear John,
I've encountered the following problem:
 

x - rnorm(100)
y - sample(2, 100, replace=TRUE)
res - by(x, y, mean)
res
   

INDICES: 1
[1] 0.1129494
 
INDICES: 2
[1] -0.2066684
 

isS4object - function(object)(length(attr(object, class))==1 
   

+  !is.null(getClass(class(object
 

isS4object(res)
   

Error in getClass(class(object)) : by is not a defined class
 

For a simple question, this has gotten rather complicated. Any suggestions
would be appreciated.
Regards,
John

John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

 

-Original Message-
From: John Chambers [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 30, 2004 9:40 AM
To: John Fox
Cc: Martin Maechler; [EMAIL PROTECTED]
Subject: Re: [R] Testing for S4 objects

Let me suggest a different test, because slotNames was 
written to work differently when given a string or a class 
definition.  With your definition,

R x - classRepresentation
R isS4object(x)
[1] TRUE
which I assume is not what you wanted.  (Given a single string,
slotNames() tries to look up the class definition of that name.)
How about the following?  The logic is that an S4 object must 
have an actual class attribute of length 1 (that rules out 
basic data types, where class(x) is a string but there is no 
actual attribute, and also rules out some S3 objects).  Then 
if that's true, try to look up the class definition.  If it 
is non-null, seems like an S4 object.

R isS4object - function(object)(length(attr(object, class))==1 
+ !is.null(getClass(class(object
R isS4object(x)
[1] FALSE
R isS4object(getClass(class(x)))
[1] TRUE
This definition seems to work, at least on the examples I 
could think of right away.  Notice though, that some classes, 
such as ts, that have been around for a long while are 
nevertheless legitimate S4 classes, so:

R t1 = ts(1:12)
R isS4object(t1)
[1] TRUE
(this applies to either version of isS4object).
There are a couple of details, more appropriate for the r-devel list. 
Seems  a good candidate for a function to add to R.

On Sat, 27 Nov 2004 17:48:30 -0500, John Fox [EMAIL PROTECTED] wrote:
   

Dear Martin,
As it turns out, the test that I proposed (i.e., testing for NULL 
slotNames) sometimes fails. For example:

 

library(car)
data(Prestige)
sum - summary(lm(prestige ~ income + education, data=Prestige))
slotNames(sum)
   

character(0)
The following, however, seems to work (at least as far as I've been 
able to
ascertain):

isS4object - function(object) length(slotNames(object)) != 0
I hope that this is a more robust test.

John

John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox

 

-Original Message-
From: Martin Maechler [mailto:[EMAIL PROTECTED]
Sent: Friday, November 26, 2004 3:18 AM
To: John Fox
Cc: [EMAIL PROTECTED]
Subject: Re: [R] Testing for S4 objects
   

JohnF == John Fox [EMAIL PROTECTED]
   on Thu, 25 Nov 2004 22:28:50 -0500 writes:
 

   JohnF Dear r-help list members, Is there a way to test
   JohnF whether an object is an S4 object? The best that I've
   JohnF been able to come up with is
   JohnFisS4object - function(object)
!(is.null(slotNames(object)))
you can drop one pair of (..) to give
 isS4object - function(object) !is.null(slotNames(object))
   JohnF which assumes that an S4 object has at least one
   JohnF slot. I think this is safe, but perhaps I'm missing
   JohnF something.
The question is a very good one -- that I have posed to R-core a 
while ago myself.

Inside  utils:::str.default  {which doesn't show the many 
   

commments 
   

in the *source* of str.default()}, I have wanted a way that even 
works when the 'methods' package is not attached and use the more 
obscure

   #NOT yet:if(has.class - !is.null(cl - class(object)))
   if(has.class - !is.null(cl - attr(object, class)))#
S3 or S4 class
 S4 - !is.null(attr(cl, package))## 'kludge' FIXME!
 ##or length(methods::getSlots(cl))  0
For the time being, I'd keep your function, but I don't 
   

think we'd 
   

guarantee that it will remain the appropriate test in all 
   

future.  
   

But till then many things will have happened (if not all of them 
;-).

Martin Maechler, ETH Zurich
   

__
[EMAIL PROTECTED] mailing list

Re: [R] AIC, AICc, and K

2004-12-04 Thread Spencer Graves
 I don't know the best way, but the following looks like it will 
work: 

tstDF - data.frame(x=1:3, y=c(1,1,2))
fit0 - lm(y~1, tstDF)
fitDF - lm(y~x, tstDF)
AIC(fitDF,fit0)
 df  AIC
fitDF  3 5.842516
fit0   2 8.001399
 The function AIC with only 1 argument returns only a single 
number.  However, given nested models, it returns a data.frame with 
colums df and AIC.  At least in this example (and I would think in all 
other contexts as well), df is the K you want. 
  
 hope this helps. 
 Spencer Graves

Benjamin M. Osborne wrote:
How can I extract K (number of parameters) from an AIC calculation, both to
report K itself and to calculate AICc?  I'm aware of the conversion from AIC -
AICc, where AICc = AIC + 2K(K+1)/(n-K-1), but not sure of how K is calculated
or how to extract that value from either an AIC or logLik calculation.
This is probably more of a basic statistics question than an R question, but I
thank you for your help.
-Ben Osborne
--
Botany Department
University of Vermont
109 Carrigan Drive
Burlington, VT 05405
[EMAIL PROTECTED]
phone: 802-656-0297
fax: 802-656-0440
__
[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
 

--
Spencer Graves, PhD, Senior Development Engineer
O:  (408)938-4420;  mobile:  (408)655-4567
__
[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] boot package

2004-12-04 Thread Nathan Leon Pace, MD, MStat
Hi,
I using the boot package 1.2-20 on R 2.0.1.
My statistics function estimates 6 parameters.
In a small percentage of resampled data sets my statistics function 
doesn't produce an estimate for one parameter and the boot function 
stops with an error.

I can write an ifelse(exists('parameter.estimate'), parameter.estimate, 
NA) statement within the statistic function to substitute an NA for the 
missing estimate value.

However, the boot.ci function to generate CIs from the boot object 
won't accept NAs.

My problem is writing code to impute a numeric value for the missing 
estimate. ifelse won't generate a numeric value if the test is mode 
logical.

Any suggestions?
Nathan
Nathan Leon Pace, MD, MStat Work:[EMAIL PROTECTED]
Department of AnesthesiologyHome:[EMAIL PROTECTED]
University of Utah  Work:801.581.6393
Salt Lake City, UtahHome:801.467.2925
Fax:801.581.4367
Cell:801.558.3987
__
[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


Re: [R] What is the most useful way to detect nonlinearity in logistic regression?

2004-12-04 Thread Peter Dalgaard
Patrick Foley [EMAIL PROTECTED] writes:

 It is easy to spot response nonlinearity in normal linear models using
 plot(something.lm).
 However plot(something.glm) produces artifactual peculiarities since
 the diagnostic residuals are constrained  by the fact that y can only
 take values 0 or 1.
 What do R users find most useful in checking the linearity assumption
 of logistic regression (i.e. log-odds =a+bx)?

Well, there's basically

- grouping
- higher-order terms
- smoothed residuals

A simple technique is to include a variable _both_ as a continuous
term and cut up into a factor (as in ~ age + cut(age,seq(30,70,10))).
The model that you are fitting is a bit weird but it gives you a clean
test for omitting the grouped term. A somewhat nicer variant of the
same theme is to do a linear spline (or a higher order one for that
matter) with selected knots.

Re. the smoothed residuals, you do need to be careful about the
smoother. Some of the robust ones will do precisely the wrong thing
in this context: You really are interested in the mean, not some
trimmed mean (which can easily amount to throwing away all your
cases...). Here's an idea:

x - runif(500)
y - rbinom(500,size=1,p=plogis(x))
xx - predict(loess(resid(glm(y~x,binomial))~x),se=T)
matplot(x,cbind(xx$fit, 2*xx$se.fit, -2*xx$se.fit),pch=20)

Not sure my money isn't still on the splines, though.

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[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


Re: [R] A possible way to reduce basic questions

2004-12-04 Thread Jonathan Baron
On 12/02/04 21:15, Anne wrote:
What about starting a database?

Of what?  Like the one in the  last line of my .sig?

-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron
R search page: http://finzi.psych.upenn.edu/

__
[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


RE: [R] Excel *.xls files, RODBC

2004-12-04 Thread Whit Armstrong
There is another way to read and write excel files using jakarta POI.
Hopefully, I'll have a package available in a week or so.  I have a working
example of writing a matrix from R to excel, but I haven't finished the read
excel portion of the code.  If anyone wants to give it a spin, contact me
off list and I'll send a copy.

http://jakarta.apache.org/poi/index.html

Regards,
Whit


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rolf Turner
Sent: Saturday, December 04, 2004 2:43 PM
To: [EMAIL PROTECTED]
Subject: Re: [R] Excel *.xls files, RODBC


Success!  Tobias Verbeke's kind suggestion of read.xls from the gdata
package (from the gregmisc bundle) works like a charm. It's perl based, so
no problema on Linux.

The R community is wonderful!

cheers,

Rolf Turner

__
[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

__
[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] Nice christmas presents! Men's Ladies' Watches. Gift Boxes.

2004-12-04 Thread red
http://24.130.27.91:8180/rl/

__
[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


RE: [R] Testing for S4 objects (redux)

2004-12-04 Thread John Fox
Dear Spencer,


 -Original Message-
 From: Spencer Graves [mailto:[EMAIL PROTECTED] 
 Sent: Saturday, December 04, 2004 8:00 PM
 To: John Fox
 Cc: 'John Chambers'; [EMAIL PROTECTED]; 'Martin Maechler'
 Subject: Re: [R] Testing for S4 objects (redux)
 
   Which version of R? 
 

Sorry -- this was with R 2.0.1 under Windows.

John

   I just replicated it in R 2.0.0patched.  I know that 
 2.0.1 is now available, but I haven't found time to upgrade yet. 
 
   By the way, I can replicate the error message with only 
 one line: 
 
   getClass(by)
 Error in getClass(by) : by is not a defined class
 
   hope this helps.  spencer graves
 
 John Fox wrote:
 
 Dear John,
 
 I've encountered the following problem:
 
   
 
 x - rnorm(100)
 y - sample(2, 100, replace=TRUE)
 res - by(x, y, mean)
 res
 
 
 INDICES: 1
 [1] 0.1129494
 
 INDICES: 2
 [1] -0.2066684
   
 
 isS4object - function(object)(length(attr(object, class))==1 
 
 
 +  !is.null(getClass(class(object
   
 
 isS4object(res)
 
 
 Error in getClass(class(object)) : by is not a defined class
   
 
 
 For a simple question, this has gotten rather complicated. Any 
 suggestions would be appreciated.
 
 Regards,
  John
 
 
 John Fox
 Department of Sociology
 McMaster University
 Hamilton, Ontario
 Canada L8S 4M4
 905-525-9140x23604
 http://socserv.mcmaster.ca/jfox
 
 
   
 
 -Original Message-
 From: John Chambers [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, November 30, 2004 9:40 AM
 To: John Fox
 Cc: Martin Maechler; [EMAIL PROTECTED]
 Subject: Re: [R] Testing for S4 objects
 
 Let me suggest a different test, because slotNames was 
 written to work 
 differently when given a string or a class definition.  With your 
 definition,
 
 R x - classRepresentation
 R isS4object(x)
 [1] TRUE
 
 which I assume is not what you wanted.  (Given a single string,
 slotNames() tries to look up the class definition of that name.)
 
 How about the following?  The logic is that an S4 object 
 must have an 
 actual class attribute of length 1 (that rules out basic 
 data types, 
 where class(x) is a string but there is no actual 
 attribute, and also 
 rules out some S3 objects).  Then if that's true, try to 
 look up the 
 class definition.  If it is non-null, seems like an S4 object.
 
 R isS4object - function(object)(length(attr(object, 
 class))==1 
 + !is.null(getClass(class(object
 R isS4object(x)
 [1] FALSE
 R isS4object(getClass(class(x)))
 [1] TRUE
 
 This definition seems to work, at least on the examples I 
 could think 
 of right away.  Notice though, that some classes, such as 
 ts, that 
 have been around for a long while are nevertheless legitimate S4 
 classes, so:
 
 R t1 = ts(1:12)
 R isS4object(t1)
 [1] TRUE
 
 (this applies to either version of isS4object).
 
 There are a couple of details, more appropriate for the 
 r-devel list. 
 Seems  a good candidate for a function to add to R.
 
 
 On Sat, 27 Nov 2004 17:48:30 -0500, John Fox 
 [EMAIL PROTECTED] wrote:
 
 
 Dear Martin,
 
 As it turns out, the test that I proposed (i.e., testing for NULL
 slotNames) sometimes fails. For example:
 
   
 
 library(car)
 data(Prestige)
 sum - summary(lm(prestige ~ income + education, data=Prestige))
 slotNames(sum)
 
 
 character(0)
 
 The following, however, seems to work (at least as far as 
 I've been 
 able to
 ascertain):
 
 isS4object - function(object) length(slotNames(object)) != 0
 
 I hope that this is a more robust test.
 
 
 
 John
 
 
 John Fox
 Department of Sociology
 McMaster University
 Hamilton, Ontario
 Canada L8S 4M4
 905-525-9140x23604
 http://socserv.mcmaster.ca/jfox
 
 
   
 
 -Original Message-
 From: Martin Maechler [mailto:[EMAIL PROTECTED]
 Sent: Friday, November 26, 2004 3:18 AM
 To: John Fox
 Cc: [EMAIL PROTECTED]
 Subject: Re: [R] Testing for S4 objects
 
 
 
 JohnF == John Fox [EMAIL PROTECTED]
 on Thu, 25 Nov 2004 22:28:50 -0500 writes:
   
 
 JohnF Dear r-help list members, Is there a way to test
 JohnF whether an object is an S4 object? The best that I've
 JohnF been able to come up with is
 
 JohnFisS4object - function(object)
 !(is.null(slotNames(object)))
 
 you can drop one pair of (..) to give
 
   isS4object - function(object) !is.null(slotNames(object))
 
 
 JohnF which assumes that an S4 object has at least one
 JohnF slot. I think this is safe, but perhaps I'm missing
 JohnF something.
 
 The question is a very good one -- that I have posed to R-core a 
 while ago myself.
 
 Inside  utils:::str.default  {which doesn't show the many
 
 
 commments
 
 
 in the *source* of str.default()}, I have wanted a way that even 
 works when the 'methods' package is not attached and use the more 
 obscure
 

RE: [R] What is the most useful way to detect nonlinearity in logisticregression?

2004-12-04 Thread John Fox
Dear Patrick,

Component+residual plots can be defined for generalized linear models
(including logistic regression) as for linear models, but they may require
smoothing for interpretation. See, e.g., the cr.plots() functions in the car
package, which works with glm objects.

I hope this helps,
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Patrick Foley
 Sent: Saturday, December 04, 2004 7:49 PM
 To: [EMAIL PROTECTED]
 Subject: [R] What is the most useful way to detect 
 nonlinearity in logisticregression?
 
 It is easy to spot response nonlinearity in normal linear 
 models using plot(something.lm).
 However plot(something.glm) produces artifactual 
 peculiarities since the diagnostic residuals are constrained  
 by the fact that y can only take values 0 or 1.
 What do R users find most useful in checking the linearity 
 assumption of logistic regression (i.e. log-odds =a+bx)?
 
 Patrick Foley
 [EMAIL PROTECTED]
 
 __
 [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

__
[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