Re: [R] repeat { readline() }

2006-01-08 Thread Prof Brian Ripley
Ctrl-Break works: see the rw-FAQ and README.rterm.  (You'll need a return 
to see a new prompt.)

It is related to your reading directly from the console, so Ctrl-C is 
getting sent to the wrong place, I believe.  (There's a comment from Guido 
somewhere in the sources about this, and this seems corroborated by the 
fact that Ctrl-C will interrupt under Rterm --ess.)

On Sun, 8 Jan 2006, Henrik Bengtsson wrote:

 Hi.

 Using Rterm v2.2.1 on WinXP, is there a way to interrupt a call like

  repeat { readline() }

 without killing the Command window?  Ctrl+C is not interrupting the loop:

 R : Copyright 2006, The R Foundation for Statistical Computing
 Version 2.2.1 Patched (2006-01-01 r36947)
 snip/snip

  repeat { readline() }
 ^C
 ^C
 ^C
 ^C

 On Unix it works.  The problem seems to get the interrupt signal to
 occur outside the readline() call so that repeat is interrupted. Doing

 repeat { readline(); Sys.sleep(3) }

 and it is likely that can generate an interrupt signal outside readline().

 It seem like readline()/readLines(n=1) or an underlying method catches
 the interrupt signal quietly and just waits for a symbol to come
 through.  Try readline() by itself and press Ctrl+C.  Maybe this is a
 property of the Windows Command terminal, I don't know, but is it a
 wanted feature and are R core aware of it?  Note that, in Rgui it is
 possible to interrupting such a loop by pressing ESC.

 Cheers

 Henrik

 __
 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


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] repeat { readline() }

2006-01-08 Thread hadley wickham
On a related note, does anyone know how to exit:

repeat { try( readline() ) }

The try block captures Ctrl-C.

Hadley

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Wikis etc.

2006-01-08 Thread Detlef Steuer
On Sat, 7 Jan 2006 13:51:24 -0500
Jonathan Baron [EMAIL PROTECTED] wrote:

 On 01/07/06 12:25, Dirk Eddelbuettel wrote:
  So my $0.02 would be to a) go for it, if possible but b) make it
  visible, and closely tied to R Core / CRAN / R News /   Which
  poses the chicken/egg problem of people running out of spare time to
  setup, admin, monitor, hand-hold the wiki, its database, watch out
  for spammers, etc.  Volunteers to do this, and maybe help Jon Baron
  on a first run using TWiki?
 
 Great.  I agree.  But there are now at least 3 proposals floating
 around.  Mine was to base the wiki on (I think) the individual
 help pages, each file in the help or html subdirectory of each
 package would be a wiki page.  Since there are about 17000 of
 these at last count - oh, my, could that really be true? - this
 must be automated.  It should be fairly easy, but I just haven't
 done it yet.  What this would amount to is an extended help
 system.
 
 Then there is the decision about what happens with updates.  I'm
 beginning to think that there is just no other way to handle this
 than to INCLUDE the latest version of each help file in the wicki
 page, have the comments come AFTER it, and just don't worry about
 it if the comments become out of date.  Eventually, someone will
 edit them if it is important.

Here I strongly disagree. Nothing is worse than searching for help and
stumble upon wrong hintsight. It is better to find nothing, than to
_think_ to have found an answer only to find it not working.

I was just bitten by outdated docu after updating qemu. Did cost some
time and frustration.

Think of the beginner left with useless, or worse, wrong advise.

Detlef


 
 But I'm not at all sure this is the best way to go.  Given that
 all the functions in each package are related, it might be better 
 to have one wiki page per package.  In this case, there is less
 difference between my proposal and the other existing wikis.
 
 It is possible that too many wikis is bad.  On the other hand, it 
 is possible that too few is bad.

May be true.

Have a nice sunday,
Detlef

 
  Hell, there are no rules here - we're trying to accomplish
  something.
-- Thomas A.
Edison
 
 I love this.
 
 Jon
 -- 
 Jonathan Baron, Professor of Psychology, University of Pennsylvania
 Home page: http://www.sas.upenn.edu/~baron
 
 __
 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


-- 
Keinen Gedanken zweimal denken, außer er ist schön. Unbekannte Quelle

__
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


Re: [R] [R-pkgs] sudoku

2006-01-08 Thread Detlef Steuer
Hey, you spoiled my course!

:-)

I planned using this as an excersise.
Alternative ideas anyone ...

Detlef

On Fri, 6 Jan 2006 11:43:44 -0500
Brahm, David [EMAIL PROTECTED] wrote:

 Any doubts about R's big-league status should be put to rest, now that
 we have a
 Sudoku Puzzle Solver.  Take that, SAS!  See package sudoku on CRAN.
 
 The package could really use a puzzle generator -- contributors are
 welcome!
 
 -- David Brahm ([EMAIL PROTECTED]) 
 
 
   [[alternative HTML version deleted]]
 
 ___
 R-packages mailing list
 [EMAIL PROTECTED]
 https://stat.ethz.ch/mailman/listinfo/r-packages
 
 __
 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


-- 
Keinen Gedanken zweimal denken, außer er ist schön. Unbekannte Quelle

__
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


Re: [R] repeat { readline() }

2006-01-08 Thread Prof Brian Ripley
On Sun, 8 Jan 2006, Prof Brian Ripley wrote:

 Ctrl-Break works: see the rw-FAQ and README.rterm.  (You'll need a return
 to see a new prompt.)

 It is related to your reading directly from the console, so Ctrl-C is
 getting sent to the wrong place, I believe.  (There's a comment from Guido
 somewhere in the sources about this, and this seems corroborated by the
 fact that Ctrl-C will interrupt under Rterm --ess.)

Although the comment is there (in psignal.c), on closer examination the 
cause is a change Guido made to getline.c, so Ctrl-C is treated as a 
character during keyboard input.  I doubt if that was intentional (0 is 
not the default state) and I have changed it for R-devel.\


 On Sun, 8 Jan 2006, Henrik Bengtsson wrote:

 Hi.

 Using Rterm v2.2.1 on WinXP, is there a way to interrupt a call like

  repeat { readline() }

 without killing the Command window?  Ctrl+C is not interrupting the loop:

 R : Copyright 2006, The R Foundation for Statistical Computing
 Version 2.2.1 Patched (2006-01-01 r36947)
 snip/snip

 repeat { readline() }
 ^C
 ^C
 ^C
 ^C

 On Unix it works.  The problem seems to get the interrupt signal to
 occur outside the readline() call so that repeat is interrupted. Doing

 repeat { readline(); Sys.sleep(3) }

 and it is likely that can generate an interrupt signal outside readline().

 It seem like readline()/readLines(n=1) or an underlying method catches
 the interrupt signal quietly and just waits for a symbol to come
 through.  Try readline() by itself and press Ctrl+C.  Maybe this is a
 property of the Windows Command terminal, I don't know, but is it a
 wanted feature and are R core aware of it?  Note that, in Rgui it is
 possible to interrupting such a loop by pressing ESC.

 Cheers

 Henrik

 __
 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


 -- 
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Wikis etc.

2006-01-08 Thread Kevin Gamble
Kris over at Wiki That! has a post today about what makes for a good  
wiki: http://www.wikithat.com/wiki_that/2006/01/wiki_of_the_wee_1.html

 Most wikis I’ve looked at are in danger of facing the same fate as  
 most websites and CMS - death by boredom. They are focused on  
 content that is used as reference for some off-line activity OR as  
 the end-result of an off-line activity.

 Collaboration and participation is more than just sharing  
 information and making it accessible. It’s all about the PROCESS of  
 planning and executing events, projects, tasks, and deliverables.  
 Content is boring - action is engaging. Make your wiki activity- 
 centric, not just data-centric (content).

If the wiki is a place where people just go to look things up --  
we're toast. It needs to be made into an active learning environment,  
a place where experts and beginners alike come to interact. Some to  
share their knowledge, and others to learn from the masters. It's the  
same dynamic  that makes the mailing list so active, and yet also  
what exposes its weakness (i.e. it doesn't scale well).

Kevin



Kevin J. Gamble. Ph.D.
Associate Director eXtension Initiative
Box 7647 NCSU
Raleigh, NC 27694-7641
v: 919.515.8447
c: 919.605.5815
AIM: k1v1n
Web: intranet.extension.org

__
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] Filters in waveslim

2006-01-08 Thread Amir Safari
 
  
  Dear R Users,
 For running  wavelet functions using dwt( ), modwt( ), and mra( ), a wavelet 
filter  algorithm is applied. For all these functions, default is la8 and  
other possibility is haar. In related documents, another  possibilities like 
as symlet and coiflet ... are not cited. 
  Besides la8 and haar, which wavelet filters can be used?
  Thank you for any help,
  Amir Safari
  


-

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] packages and tex files

2006-01-08 Thread Uwe Ligges
Erin Hodgess wrote:

 Dear R People:
 
 I am trying to build a package (yet again!)
 
 I have both PCTex and WinEdt.  I want the *.tex files to use WinEdt. 

Erin,

please check the R Installation and Administration manual on how to set 
up a working environment to build and install packages.
I don't know PCTex, it is not mentioned in the manual cited above, hence 
it might not work without some hiccups.

You do not need to care about .tex files, they are produced and 
afterwards compiled into the appropriate format automatically from .Rd 
files by the R tools. I have looked into the produced tex files only in 
very rare circumstances where some debugging of Rd files was required.

Or do you want to edit the Rd files in WinEdt? Then, I recommend to set 
up WinEdt appropriately to handle them in the same manner as LaTeX files.

 How should I set that, please?  Just in the path?

You LaTeX binaries must be in the path (but probably they already are ...).

 Also, where would I get Rd.sty, please?

The supported LaTeX distributions are told to look into the right place 
by the R CMD tools. And this is: path-to-R/share/texmf/Rd.sty

Uwe Ligges


 Thanks,
 R Version 2.2.1 Windows
 Sincerely,
 Erin Hodgess
 Associate Professor
 Department of Computer and Mathematical Sciences
 University of Houston - Downtown
 mailto: [EMAIL PROTECTED]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
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


Re: [R] exporting methods/classes

2006-01-08 Thread Uwe Ligges
Erin Hodgess wrote:

 Dear R People:
 
 I'm still struggling with sending methods and classes as part of 
 creating a new package.
 
 Where does the .onLoad function go?  Within R itself or in a file
 in one of the new package directories?

Simply save the .onLoad function in some .R file (e.g. zzz.R) in the 
package's ./R directory.



 Here are my latest efforts:
 
 
 Here's the last part of the woof1-Ex.Rout
 
 
library('woof1')
 
 Error in loadNamespace(package, c(which.lib.loc, lib.loc), 
 keep.source = keep.source) : 
   in 'woof1' classes for export not defined: dog
 Error: package/namespace load failed for 'woof1'
 Execution halted

So this looks like you have defined S4 classes for export in your 
Namespace but you have no call that starts with

setClass(dog, ..

in the R code in your package, hence the class dog is undefined.


 Here's the NAMESPACE
 importFrom(graphics,plot)
 exportClasses(dog)
 exportMethods(plot,show)


You don't export any other functions?


Uwe Ligges




 
 thanks yet again,
 Sincerely,
 Erin 
 mailto: [EMAIL PROTECTED]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
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


Re: [R] Wikis etc.

2006-01-08 Thread phgrosjean
Hello all,

Sorry for not taking part of this discussion earlier, and for not
answering Detlef Steuer, Martin Maechler, and others that asked more
direct questions to me. I am away from my office and my computer until the
16th of January.

Just quick and partial answers:
1) I did not know about Hamburg RWiki. But I would be happy to merge both
in one or the other way, as Detlef suggests it.

2) I choose DokuWiki as the best engine after a careful comparison of
various Wiki engines. It is the best one, as far as I know, for the
purpose of writting software documentation and similar pages. There is an
extensive and clearly presented comparison of many Wikki engines at:
http://www.wikimatrix.org/.

3) I started to change DokuWiki (addition of various plugins, addition of
R code syntax coloring with GESHI, etc...). So, it goes well beyond all
current Wiki engines regarding its suitability to present R stuff.

4) The reasons I did this is because I think the Wiki format could be of a
wider use. I plan to change a little bit the DokuWiki syntax, so that it
works with plain .R code files (Wiki part is simply embedded in commented
lines, and the rest is recognized and formatted as R code by the Wiki
engine). That way, the same Wiki document can either rendered by the Wiki
engine for a nice presentation, or sourced in R indifferently.

5) My last idea is to add a Rpad engine to the Wiki, so that one could
play with R code presented in the Wiki pages and see the effects of
changes directly in the Wiki.

6) Regarding the content of the Wiki, it should be nice to propose to the
authors of various existing document to put them in a Wiki form. Something
like Statistics with R (http://zoonek2.free.fr/UNIX/48_R/all.html) is
written in a way that stimulates additions to pages in perpetual
construction, if it was presented in a Wiki form. It is licensed as
Creative Commons Attribution-NonCommercial-ShareAlike 2.5 license, that
is, exactly the same one as DokuWiki that I choose for R Wiki. Of course,
I plan to ask its author to do so before putting its hundreds of very
interesting pages on the Wiki... I think it is vital to have already
something in the Wiki, in order to attract enough readers, and then enough
contributors!

7) Regarding spamming and vandalism, DokuWiki allows to manage rights and
users, even individually for pages. I think it would be fine to lock pages
that reach a certain maturity (read-only / editable by selected users
only) , with link to a discussion page which remaining freely accessible
at the bottom of locked pages.

8) I would be happy to contribute this work to the R foundation in one way
or the other to integrate it in http://www.r-project.org or
http://cran.r-project.org. But if it is fine keeping it in
http://www.sciviews.org as well, it is also fine for me.

I suggest that all interested people drop a little email to my mailbox.
I'll recontact you when I will be back to my office to work on a more
elaborate solution altogether when I am back at my office.
Best,

Philippe Grosjean

__
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


Re: [R] lmer error message

2006-01-08 Thread Douglas Bates
Also, please try setting

options(verbose = TRUE)

immediately before your call to lmer.  This will provide verbose
output on the progress of the iterations and will probably give an
indication of where the problem lies.


On 1/7/06, Spencer Graves [EMAIL PROTECTED] wrote:
   I am not familiar with this particular error message, but I will
 offer a few suggestions that might help you isolate it.

   1.  PLEASE do read the posting guide!
 www.R-project.org/posting-guide.html.  The limited information
 supplied with your question does NOT include data requested of all
 posts.  The command sessionInfo() can proved some of the standard
 basics that many potential respondants want to know before they consider
 replying.

   2.  Have you tried traceback()?  This may or may not help you, but
 it's quick and worth a try.

   3.  Can you provide this list with a very simple, self contained
 example that produces the error message you mention?

   4.  I suggest you list lmer by typing the function name and a
 commmand prompt.  In this case, lmer consists solely of a call to
 standardGeneric.  The documentation for standardGeneric led me to
 the documentation for GenericFunctions, which led me to showMethods.
   'showMethods(lmer)' indicated only one method, namely for 'formula =
 formula'.  Then 'dumpMethod(lmer, file=lmer.R,
 signature=formula)' produced a listing of that function for me in the
 working directory.  If you have trouble finding the working directory,
 try 'getwd()'.  I would then modify the function it lmer.R to create a
 new function lmer.formula.  Then I would try debug(lmer.formula).
 Then I would replace lmer by lmer.formula in the command that
 generated the error and execute that modified formula.  This will open a
 browser and allow you to walk through the function line by line,
 examining (and changing) anything you want in the environment of that
 function.  Doing this will, I believe, lead you to exactly the line in
 the lmer code that generated the error message you don't understand.
 With only a modest amount of luck, you should be able to find in this
 way what you can do to avoid that error.

   Anecdotal evidence suggests that people who use the techniques
 described in suggestions 1-3 tend to get quicker, more useful replies
 from this list.  Moreover, in virtually every case that I've tried
 suggestion 4, I've been able to figure out how to overcome that
 particular difficulty.  In addition, I've often learned useful things
 about R that I didn't know befor.

   hope this helps.
   spencer graves

 Abderrahim Oulhaj wrote:

  Dear All,
 
  I have the following error message when I fitted  lmer to a  binary data 
  with the AGQ option:
 
  Error in family$mu.eta(eta) : NAs are not allowed in subscripted assignments
  In addition: Warning message:
  IRLS iterations for PQL did not converge
 
  Any help?
 
  Thanks in advance,
 
  Abderrahim
 
 
[[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html

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


Re: [R] Suggestion for big files [was: Re: A comment about R:]

2006-01-08 Thread François Pinard
[Brian Ripley]
[François Pinard]
[Brian Ripley]

One problem [...] is that R's I/O is not line-oriented but
stream-oriented.  So selecting lines is not particularly easy in R.

I understand that you mean random access to lines, instead of random
selection of lines.

That was not my point. [...] Skipping lines you do not need will take 
longer than you might guess (based on some limited experience).

Thanks for telling (and also for the expression reservoir sampling).
OK, then.  All summarized, if I ever need this for bigger datasets, 
selection might better be done outside of R.

-- 
François Pinard   http://pinard.progiciels-bpi.ca

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] lmer error message

2006-01-08 Thread Spencer Graves
Hi, Doug:

  Thanks.  My copy of the 'lmer' documentation does not list the 
'verbose' argument.  Is this something you plan to discontinue or 
modify, or was it recently added to the script but not to the 
documentation I have?

  Also, I just tried it modifying one of the examples in the 
documentation:

  fm1 - lmer(Reaction ~ Days + (Days|Subject), sleepstudy,
+  verbose=TRUE)
trace: lmer(Reaction ~ Days + (Days | Subject), sleepstudy, verbose = TRUE)

  Maybe this example converges so quickly it senses no need for greater 
verbosity.

  Thanks,
  Spencer Graves
#

R version 2.2.0, 2005-10-06, i386-pc-mingw32

attached base packages:
[1] methods   stats graphics  grDevices utils datasets
[7] base

other attached packages:
  lme4   latticeMatrix
  0.98-1 0.12-11  0.99-4
 

Douglas Bates wrote:

 Also, please try setting
 
 options(verbose = TRUE)
 
 immediately before your call to lmer.  This will provide verbose
 output on the progress of the iterations and will probably give an
 indication of where the problem lies.
 
 
 On 1/7/06, Spencer Graves [EMAIL PROTECTED] wrote:
 
  I am not familiar with this particular error message, but I will
offer a few suggestions that might help you isolate it.

  1.  PLEASE do read the posting guide!
www.R-project.org/posting-guide.html.  The limited information
supplied with your question does NOT include data requested of all
posts.  The command sessionInfo() can proved some of the standard
basics that many potential respondants want to know before they consider
replying.

  2.  Have you tried traceback()?  This may or may not help you, but
it's quick and worth a try.

  3.  Can you provide this list with a very simple, self contained
example that produces the error message you mention?

  4.  I suggest you list lmer by typing the function name and a
commmand prompt.  In this case, lmer consists solely of a call to
standardGeneric.  The documentation for standardGeneric led me to
the documentation for GenericFunctions, which led me to showMethods.
  'showMethods(lmer)' indicated only one method, namely for 'formula =
formula'.  Then 'dumpMethod(lmer, file=lmer.R,
signature=formula)' produced a listing of that function for me in the
working directory.  If you have trouble finding the working directory,
try 'getwd()'.  I would then modify the function it lmer.R to create a
new function lmer.formula.  Then I would try debug(lmer.formula).
Then I would replace lmer by lmer.formula in the command that
generated the error and execute that modified formula.  This will open a
browser and allow you to walk through the function line by line,
examining (and changing) anything you want in the environment of that
function.  Doing this will, I believe, lead you to exactly the line in
the lmer code that generated the error message you don't understand.
With only a modest amount of luck, you should be able to find in this
way what you can do to avoid that error.

  Anecdotal evidence suggests that people who use the techniques
described in suggestions 1-3 tend to get quicker, more useful replies
from this list.  Moreover, in virtually every case that I've tried
suggestion 4, I've been able to figure out how to overcome that
particular difficulty.  In addition, I've often learned useful things
about R that I didn't know befor.

  hope this helps.
  spencer graves

Abderrahim Oulhaj wrote:


Dear All,

I have the following error message when I fitted  lmer to a  binary data 
with the AGQ option:

Error in family$mu.eta(eta) : NAs are not allowed in subscripted assignments
In addition: Warning message:
IRLS iterations for PQL did not converge

Any help?

Thanks in advance,

Abderrahim


  [[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] lmer error message

2006-01-08 Thread Prof Brian Ripley
Spencer:

It is an option, not an argument, and sets the default for the lmerControl 
arguments msVerbose and EMverbose (see ?lmer)

 options(verbose=TRUE)
 fm1 - lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
   EM iterations
   0 1768.412 ( 3.75000  106.875  0.0:3.210.1740.663)
   1 1749.892 ( 2.67539  62.5305 -5.17591:2.360.1760.479)
...
   0  1743.63: 0.918936 0.0531527 -0.304877
...

On Sun, 8 Jan 2006, Spencer Graves wrote:

 Hi, Doug:

 Thanks.  My copy of the 'lmer' documentation does not list the
 'verbose' argument.  Is this something you plan to discontinue or
 modify, or was it recently added to the script but not to the
 documentation I have?

 Also, I just tried it modifying one of the examples in the
 documentation:

  fm1 - lmer(Reaction ~ Days + (Days|Subject), sleepstudy,
 +  verbose=TRUE)
 trace: lmer(Reaction ~ Days + (Days | Subject), sleepstudy, verbose = TRUE)

 Maybe this example converges so quickly it senses no need for greater
 verbosity.

 Thanks,
 Spencer Graves
 #

 R version 2.2.0, 2005-10-06, i386-pc-mingw32

 attached base packages:
 [1] methods   stats graphics  grDevices utils datasets
 [7] base

 other attached packages:
  lme4   latticeMatrix
  0.98-1 0.12-11  0.99-4
 

 Douglas Bates wrote:

 Also, please try setting

 options(verbose = TRUE)

 immediately before your call to lmer.  This will provide verbose
 output on the progress of the iterations and will probably give an
 indication of where the problem lies.


 On 1/7/06, Spencer Graves [EMAIL PROTECTED] wrote:

  I am not familiar with this particular error message, but I will
 offer a few suggestions that might help you isolate it.

  1.  PLEASE do read the posting guide!
 www.R-project.org/posting-guide.html.  The limited information
 supplied with your question does NOT include data requested of all
 posts.  The command sessionInfo() can proved some of the standard
 basics that many potential respondants want to know before they consider
 replying.

  2.  Have you tried traceback()?  This may or may not help you, 
 but
 it's quick and worth a try.

  3.  Can you provide this list with a very simple, self contained
 example that produces the error message you mention?

  4.  I suggest you list lmer by typing the function name and a
 commmand prompt.  In this case, lmer consists solely of a call to
 standardGeneric.  The documentation for standardGeneric led me to
 the documentation for GenericFunctions, which led me to showMethods.
  'showMethods(lmer)' indicated only one method, namely for 'formula =
 formula'.  Then 'dumpMethod(lmer, file=lmer.R,
 signature=formula)' produced a listing of that function for me in the
 working directory.  If you have trouble finding the working directory,
 try 'getwd()'.  I would then modify the function it lmer.R to create a
 new function lmer.formula.  Then I would try debug(lmer.formula).
 Then I would replace lmer by lmer.formula in the command that
 generated the error and execute that modified formula.  This will open a
 browser and allow you to walk through the function line by line,
 examining (and changing) anything you want in the environment of that
 function.  Doing this will, I believe, lead you to exactly the line in
 the lmer code that generated the error message you don't understand.
 With only a modest amount of luck, you should be able to find in this
 way what you can do to avoid that error.

  Anecdotal evidence suggests that people who use the techniques
 described in suggestions 1-3 tend to get quicker, more useful replies
 from this list.  Moreover, in virtually every case that I've tried
 suggestion 4, I've been able to figure out how to overcome that
 particular difficulty.  In addition, I've often learned useful things
 about R that I didn't know befor.

  hope this helps.
  spencer graves

 Abderrahim Oulhaj wrote:


 Dear All,

 I have the following error message when I fitted  lmer to a  binary data 
 with the AGQ option:

 Error in family$mu.eta(eta) : NAs are not allowed in subscripted 
 assignments
 In addition: Warning message:
 IRLS iterations for PQL did not converge

 Any help?

 Thanks in advance,

 Abderrahim


  [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html

 __
 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@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 

[R] wicked wikis for R

2006-01-08 Thread Arin Basu
Message: 41
Date: Sun, 08 Jan 2006 13:52:33 +1100
 From: paul sorenson [EMAIL PROTECTED]
Subject: Re: [R] Wikis etc.
To: Frank E Harrell Jr [EMAIL PROTECTED],r-help
   r-help@stat.math.ethz.ch
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Frank E Harrell Jr wrote:
  paul sorenson wrote:
 
  I am a fan of wiki's and I reckon it would really help with making R
  more accessible.  On one extreme you have this email list and on the
  other extreme you have RNews and the PDF's on CRAN.  A wiki might hit
  the spot between them and reduce the traffic on the email list.
 
 
  Thanks Paul.  But as long as the email list is active I fear a wiki
  won't be.

That would be sad if that were true.  They are different beasts, as
would be an IRC channel.  I say complementary, not mutually exclusive.

A wiki takes time to reach critical mass (eg my home brew wiki
http://brewiki.org/ or wikipedia) and you couldn't just pull the plug on
this list without a serious impact on the uptake of R I would have thought.

Contributions to the wiki from mugs like me with less R/statistics
experience would hopefully make R more accessible to newbies - pointing
out the traps for new players.

One way to bootstrap it is to simply add a wiki menu entry into the
r-project.org menu. This is what the guys over at
http://wiki.wxpython.org/ have done.  Over time, some of the other items
there might morph in to wiki pages as appropriate.

I have no doubt that if the R-Wiki was supported in the same thoughtful,
thorough and patient way in which questions on R-Help are answered, it
would be one of the lowest entropy wiki's around.

I think that's a great idea there. 

In fact, wikis and this mailing list can potentially complement each other in 
very efficient ways. In contrast to traditional wikis (eg. wikipedia), for R we 
may have to figure out some kind of novel ways of automated/manual transfer of 
information between wikis and mailing lists going back and forth. Specific 
responses or groups of responses to questions from the mailing list find a way 
to the wikis in the form of editable topics, and wikis get updated as people 
start filling in. Also, a link from the mailing list or from the main R page to 
the Wikis could be very useful. As the mailing list grows, so does the wiki, 
except the information flow from the mailing list is more controlled and 
fine-tuned as to what goes in there and what stays in the mailing list.

Among others, here's one long-term benefit for the newbies. Instead of people 
getting admonished/thrashed with harsh expressions/advices like go see the 
mailing list publishing etiquettes, or you should search the archives and 
help files, and read all manuals, and ask others first before posting here... 
(which can turn away many a newcomer from posting or using the mailing list or 
using R for that matter), wiki could make life a little easy for newbies/less 
experienced who could then receive more polite one liners like, please check 
the wikipages..., or solution #xyz in the wikipages for the solution. 

However, for an R-wiki to be a repository of robust R guidance, quality control 
is extremely important. While it is somewhat easier to warn and correct each 
other for wrong information in an email list, that level of vigilance may not 
always be achievable in a wiki, particularly if it is open to be editable by 
everyone, which, btw, is also its touted strength.

That said, with the volume of posts in this mailing list increasing, and with 
numerous repeats of similar problems posted and replied over and over again, 
wikis may just provide an easy compromise.

/Arin Basu





[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] wicked wikis for R

2006-01-08 Thread Arin Basu
Message: 41
Date: Sun, 08 Jan 2006 13:52:33 +1100
 From: paul sorenson [EMAIL PROTECTED]
Subject: Re: [R] Wikis etc.
To: Frank E Harrell Jr [EMAIL PROTECTED],r-help
   r-help@stat.math.ethz.ch
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Frank E Harrell Jr wrote:
  paul sorenson wrote:
 
  I am a fan of wiki's and I reckon it would really help with making R
  more accessible.  On one extreme you have this email list and on the
  other extreme you have RNews and the PDF's on CRAN.  A wiki might hit
  the spot between them and reduce the traffic on the email list.
 
 
  Thanks Paul.  But as long as the email list is active I fear a wiki
  won't be.

That would be sad if that were true.  They are different beasts, as
would be an IRC channel.  I say complementary, not mutually exclusive.

A wiki takes time to reach critical mass (eg my home brew wiki
http://brewiki.org/ or wikipedia) and you couldn't just pull the plug on
this list without a serious impact on the uptake of R I would have thought.

Contributions to the wiki from mugs like me with less R/statistics
experience would hopefully make R more accessible to newbies - pointing
out the traps for new players.

One way to bootstrap it is to simply add a wiki menu entry into the
r-project.org menu. This is what the guys over at
http://wiki.wxpython.org/ have done.  Over time, some of the other items
there might morph in to wiki pages as appropriate.

I have no doubt that if the R-Wiki was supported in the same thoughtful,
thorough and patient way in which questions on R-Help are answered, it
would be one of the lowest entropy wiki's around.

I think that's a great idea there. 

In fact, wikis and this mailing list can potentially complement each other in 
very efficient ways. In contrast to traditional wikis (eg. wikipedia), for R we 
may have to figure out some kind of novel ways of automated/manual transfer of 
information between wikis and mailing lists going back and forth. Specific 
responses or groups of responses to questions from the mailing list find a way 
to the wikis in the form of editable topics, and wikis get updated as people 
start filling in. Also, a link from the mailing list or from the main R page to 
the Wikis could be very useful. As the mailing list grows, so does the wiki, 
except the information flow from the mailing list is more controlled and 
fine-tuned as to what goes in there and what stays in the mailing list.

Among others, here's one long-term benefit for the newbies. Instead of people 
getting admonished/thrashed with harsh expressions/advices like go see the 
mailing list publishing etiquettes, or you should search the archives and 
help files, and read all manuals, and ask others first before posting here... 
(which can turn away many a newcomer from posting or using the mailing list or 
using R for that matter), wiki could make life a little easy for newbies/less 
experienced who could then receive more polite one liners like, please check 
the wikipages..., or solution #xyz in the wikipages for the solution. 

However, for an R-wiki to be a repository of robust R guidance, quality control 
is extremely important. While it is somewhat easier to warn and correct each 
other for wrong information in an email list, that level of vigilance may not 
always be achievable in a wiki, particularly if it is open to be editable by 
everyone, which, btw, is also its touted strength.

That said, with the volume of posts in this mailing list increasing, and with 
numerous repeats of similar problems posted and replied over and over again, 
wikis may just provide an easy compromise.

/Arin Basu





[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Suggestion for big files [was: Re: A comment about R:]

2006-01-08 Thread François Pinard
[Martin Maechler]

FrPi Suppose the file (or tape) holds N records (N is not known
FrPi in advance), from which we want a sample of M records at
FrPi most. [...] If the algorithm is carefully designed, when
FrPi the last (N'th) record of the file will have been processed
FrPi this way, we may then have M records randomly selected from
FrPi N records, in such a a way that each of the N records had an
FrPi equal probability to end up in the selection of M records.  I
FrPi may seek out for details if needed.

[...] I'm also intrigued about the details of the algorithm you
outline above.

I went into my old SPSS books and related references to find it for you, 
to no avail (yet I confess I did not try very hard).  I vaguely remember 
it was related to Spearman's correlation computation: I did find notes 
about the severe memory limitation of this computation, but nothing 
about the implemented workaround.  I did find other sampling devices, 
but not the very one I remember having read about, many years ago.

On the other hand, Googling tells that this topic has been much studied, 
and that Vitter's algorithm Z seems to be popular nowadays (even if not 
the simplest) because it is more efficient than others.  Google found 
a copy of the paper:

   http://www.cs.duke.edu/~jsv/Papers/Vit85.Reservoir.pdf

Here is an implementation for Postgres: 

   http://svr5.postgresql.org/pgsql-patches/2004-05/msg00319.php

yet I do not find it very readable -- but this is only an opinion: I'm 
rather demanding in the area of legibility, while many or most people 
are more courageous than me! :-).

-- 
François Pinard   http://pinard.progiciels-bpi.ca

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R-help Digest, Vol 35, Issue 7

2006-01-08 Thread Evgeniy Kachalin
Uwe Ligges пишет:
 Evgeniy Kachalin wrote:
 
 Hello, dear participants!

 Could you tip me, is there any simple and nice way to build 
 scatter-plot for three different types of data (, and o and * - signs, 
 for example) with legend.

 Now i can guess only that way:

 plot(x~y,data=subset(mydata,factor1=='1'), pch='.',col='blue')
 points(x~y,data=subset(mydata,factor1=='2'), pch='*',col='green')
 points( etc

 What is the simple and nice way?
 Thank you very much for your kindness and help.

 
 
 Example:
 
 
 with(iris,
   plot(Sepal.Length, Sepal.Width, pch = as.integer(Species)))
 with(iris,
   legend(7, 4.4, legend = unique(as.character(Species)),
 pch = unique(as.integer(Species
 

Uwe, sorry for my stupid question. You mean that when pch=factor , plot 
can recycle the factor and use it for subscripts or marks.

Then pch=as.integer(Species) results in c(1,2,3) for 3 factor levels. 
And I need symbols 15,16,17 and colors red, blue, green.

So then I do:
iris$Species-spec.symb
iris$Species-spec.col
levels(spec.symb)-c(15,16,17)
levels(spec.col)-c('red','green','blue')

That's the only way?
More of that!!! 'Plot' does not like factors in 'pch'. So it must be so:
plot(x~y,data, pch=as.integer(as.character(spec.symb))).
That's totally crazy...

-- 
Evgeniy

__
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] Wikis etc.

2006-01-08 Thread Jack Tanner
Philippe's idea to start a wiki that grows out of the content on 
http://zoonek2.free.fr/UNIX/48_R/all.html is really great. Here's why.

My hypothesis is that the basic reason that people ask questions on R-help 
rather than first looking elsewhere is that looking elsewhere doesn't get 
them the info they need.

People think in terms of the tasks they have to do. The documentation for R, 
which can be very good, is organized in terms of the structure of R, its 
functions. This mismatch -- people think of tasks, the documentation thinks 
in functions -- causes people to turn to the mailing list.

What we need is documentation that can be browsed in terms of tasks, like 
http://zoonek2.free.fr/UNIX/48_R/all.html. If that can be edited by the 
community, all the better. This is especially good for newbies (like myself) 
who try a tutorial, find that it lacks in some aspect, and can give 
immediate feedback, e.g., via a Wiki.

As far as keeping current with the latest versions of R, I think we'll have 
to arrive at some sort of convention that says: the code in this example 
works with R version X, package version Y. Then, if that code is found to 
fail in some future version, it's easy enough to make a second exampe. (As a 
bonus, these examples could be an automated test suite for R.)

Philippe, if you find you'd like assistance, I'd like to help.

__
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


Re: [R] Finding R mailing list archives {was Wikis etc.}

2006-01-08 Thread zzz haha
 I really wonder if adding yet another URL to the footer of every
 message will be the solution; as others have correctly remarked,
 the problem is that for many newbies it is more convenient to ask
 rather than to first read something that contains more than three
 words. ;-)

hahaha. the balance between (i) harsh to the newbie and (ii) boring to
the experts.

balance is hard. :)

__
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


Re: [R] maptools, write.polylistShape

2006-01-08 Thread Roger Bivand
On Sat, 7 Jan 2006, Patrick Giraudoux wrote:

 Dear Roger,
 
 I am trying to use the write.polylistShape() function of maptools for 
 the first time and realize that it handles list of polygons of class 
 'polylist'. However, it seems that no as.polylist() function exist in 
 the package. The question behind that is: in your opinion, which would 
 be the best  way to convert a list of matrix of polygon nodes 
 coordinates into an object of  class polylist?

Certainly through sp classes - construct a list of Polygons objects each 
with one (or more) Polygon objects, raise to SpatialPolygons, then back 
out through writePolyShape(). Assuming each list member matrix is the 
perimeter of a single polygon, and each Polygons object only has one 
Polygon:

n - length(list_of_matrices)
list_of_polygons - vector(mode=list, length=n)
for (i in 1:n) {
  Pl - Polygon(list_of_matrices[[i]])
  list_of_polygons[[i]] - Polygons(list(Pl), ID=as.character(i))
}
# could be done with lapply too
SPs - SpatialPolygons(list_of_polygons)
rownames(mydata) - as.character(1:n)
SPDF - SpatialPolygonsDataFrame(SPs, mydata)
writePolyShape(SPDF, outfile)

(untried - but close enough).

Best wishes,

Roger


 
 All the best,
 
 Patrick
 
 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] How to unload a package or undo library(package)

2006-01-08 Thread Aleš Žiberna
Hello!

I would like to unload a package form a current R session. I tried
datach(package:packagename), however it does not work. The reason I want to
unload it is that I want to correct some files in the package and reinstall
it without closing an R session.

Best,
Ales Ziberna

PS: I am using R 2.1.1 on Windows XP

__
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


Re: [R] How to unload a package or undo library(package)

2006-01-08 Thread Gabor Grothendieck
Here are some things to try:

detach() - detach most recent attached package
detach(2) - detach package which is in position 2 on search list. 
Same as detach()
detach(package:mypackage) - mypackage from search list
search() - display search list

On 1/8/06, Aleš Žiberna [EMAIL PROTECTED] wrote:
 Hello!

 I would like to unload a package form a current R session. I tried
 datach(package:packagename), however it does not work. The reason I want to
 unload it is that I want to correct some files in the package and reinstall
 it without closing an R session.

 Best,
 Ales Ziberna

 PS: I am using R 2.1.1 on Windows XP

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


Re: [R] Suggestion for big files [was: Re: A comment about R:]

2006-01-08 Thread hadley wickham
 Thanks as well for these hints.  Googling around as your suggested (yet
 keeping my eyes in the MySQL direction, because this is what we use),
 getting MySQL itself to do the selection is a bit discouraging, as
 according to comments I've read, MySQL does not seem to scale well with
 the database size according to the comments I've read, especially when
 records have to be decorated with random numbers and later sorted.

With SQL there is always a way to do what you want quickly, but you
need to think carefully about what operations are most common in your
database.  For example, the problem is much easier if you can assume
that the rows are numbered sequentially from 1 to n.  This could be
enfored using a trigger whenever a record is added/deleted.  This
would slow insertions/deletions but speed selects.

 Just for fun: here, sample(1, 10) in R is slowish already :-).

This is another example where greater knowledge of problem can yield
speed increases.  Here (where the number of selections is much smaller
than the total number of objects) you are better off generating 10
numbers with runif(10, 0, 100) and then checking that they are
unique

 Another possibility is to generate a large table of randomly
 distributed ids and then use that (with randomly generated limits) to
 select the appropriate number of records.

 I'm not sure I understand your idea (what mixes me in the randomly
 generated limits part).  If the large table is much larger than the
 size of the wanted sample, we might not be gaining much.

Think about using a table of random numbers.  They are pregenerated
for you, you just choose a starting and ending index.  It will be slow
to generate the table the first time, but then it will be fast.  It
will also take up quite a bit of space, but space is cheap (and time
is not!)

Hadley

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] lmer p-vales are sometimes too small

2006-01-08 Thread Douglas Bates
I have just uploaded version 0.99-6 of the Matrix package to the
incoming area at CRAN.  It should appear on the archives in the next
day or two.

In this version all degrees of freedom, test statistics and p-values
have been removed from the summary, show and anova methods.  I agree
with John Maindonald that it is better not to give any p-values than
to give misleading, sometimes seriously misleading, p-values.

All the code for lmer is, of course, open source.  At present it
resides in the Matrix package but it may return to the lme4 package
following the release of R-2.3.0.  The sources for the Matrix package
are available at

  https://svn.r-project.org/R-packages/trunk/Matrix

An experimental version of lmer based on a supernodal sparse Cholesky
factorization is at

  https://svn.r-project.org/R-packages/branches/Matrix-mer2

That is the current development branch.  Once I get issues with the
PQL and Laplace methods for GLMMs resolved this branch will be merged
back into the trunk.  If you are only interested in linear mixed
models it is better to work with this branch.

In both branches there is an R function called getFixDF that currently
is a stub returning incorrect answers (as indicated in the comments). 
At present I don't know to get correct answers for the range of models
that can be fit by lmer.  I welcome submissions of patches.


On 1/6/06, Olof Leimar [EMAIL PROTECTED] wrote:
 This concerns whether p-values from lmer can be trusted. From
 simulations, it seems that lmer can produce very small, and probably
 spurious, p-values. I realize that lmer is not yet a finished product.
 Is it likely that the problem will be fixed in a future release of the
 lme4 package?

 Using simulated data for a quite standard mixed-model anova (a balanced
 two-way design; see code for the function SimMixed pasted below), I
 compared the output of lmer, for three slightly different models, with
 the output of aov. For an example where there is no fixed treatment
 effect (null hypothesis is true), with 4 blocks, 2 treatments, and 40
 observations per treatment-block combination, I find that lmer gives
 more statistical significances than it should, whereas aov does not have
 this problem. An example of output I generated by calling
SimMixed(1000)
 is the following:

 Proportion significances at the 0.05 level
 aov: 0.05
 lmer.1:  0.148
 lmer.2:  0.148
 lmer.3:  0.151

 Proportion significances at the 0.01 level
 aov: 0.006
 lmer.1:  0.076
 lmer.2:  0.076
 lmer.3:  0.077

 Proportion significances at the 0.001 level
 aov: 0.001
 lmer.1:  0.047
 lmer.2:  0.047
 lmer.3:  0.047

 which is based on 1000 simulations (and takes about 5 min on my PowerMac
 G5). The different models fitted are:

 fm.aov - aov(y ~ Treat + Error(Block/Treat), data = dat)
 fm.lmer.1 - lmer(y ~ Treat + (Treat|Block), data = dat)
 fm.lmer.2 - lmer(y ~ Treat + (Treat-1|Block), data = dat)
 fm.lmer.3 - lmer(y ~ Treat + (1|Block) + (Treat-1|Block), data = dat)

 It seems that, depending on the level of the test, lmer gives between a
 factor of 3 to a factor of around 50 times too many significances. The
 first two lmer models seem to give identical results, whereas the third
 (which I think perhaps is the one that best represents the data
 generated by the simulation) differs slightly. In running the
 simulations, warnings like this are occasionally generated:

 Warning message:
 optim or nlminb returned message false convergence (8)
   in: LMEoptimize-(`*tmp*`, value = list(maxIter = 200, tolerance =
 1.49011611938477e-08,

 They seem to derive from the third of the lmer models. Perhaps there is
 some numerical issue in the lmer function? From running SimMixed()
 several times, I have noticed that large p-values (say, larger than 0.5)
 agree very well between lmer and aov, but there seems to be a systematic
 discrepancy for smaller p-values, where lmer gives smaller values than
 aov. The F-values agree between all analyzes (except for fm.lmer.3 when
 there is a warning), so there is a systematic difference between lmer
 and aov in how a p-value is obtained from the F-value, which becomes
 severe for small p-values.



 My output from sessionInfo()

 R version 2.2.1, 2005-12-20, powerpc-apple-darwin7.9.0

 attached base packages:
 [1] methods   stats graphics  grDevices utils
 datasets  base

 other attached packages:
   lme4   latticeMatrix
   0.98-1 0.12-11  0.99-3



 Pasted code for the SimMixed function (some lines might wrap):

 # This function generates n.sims random data sets for a design with 4
 # blocks, 2 treatments applied to each block, and 40 replicate
 # observations for each block-treatment combination. There is no true
 # fixed treatment effect, so a statistical significance of a test for
 # a fixed treatment effect ought to occur with a probability equal to
 # the nominal level of the test. Four tests are applied to each
 # simulated data set: the classical aov and three versions of lmer,
 # 

Re: [R] Question about graphics in R

2006-01-08 Thread Jim Lemon
Martin Erwig wrote:
 Considering the R function/plot shown below, I wonder whether
 it is possible to do the following changes:
 
 (1) Change the color of each point to be picked from
 list of colors according to its z-value. (The range
 should be from blue (z=0) to red (z=1).) The grid
 should then be omitted. [I have seen terrain.colors, but
 don't know how to use it for this purpose.]
 
 (2) Add two lines to the surface for, say z=0.8 and
 z=0.3. [Can contour or contourLines be used?]
 
 
 ---
 
 x - seq(0, 1, length = 50)
 y - x
 f - function(x,y) { sin ((1-x)*y) }
 z - outer(x,y,f)
 
 persp(x, y, z,
   theta = 30, phi = 30,
   shade = 0.3, col = red
   )
 
 ---
 
 
 Finally, I would also produce a flattened 2D map
 of the same function, i.e. a map in which each point
 (x,y) is mapped to a color in a range according to
 f(x,y). Also two lines for f(x,y)=c1 and f(x,y)=c2
 should be added.
 
 
 Is this possible?
 
Hi Martin,

The function color.scale will linearly transform numeric values into
colors between arbitrary color endpoints specified as red, green and blue:

Your example would be
redrange=c(0,1),greenrange=c(0,0),bluerange=c(1,0).

For the 2D plot, have a look at color2D.matplot. Both are in the plotrix
package.

You might also want to look at colorRampPalette in the grDevices package.

Jim

__
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


Re: [R] repeat { readline() }

2006-01-08 Thread Henrik Bengtsson
Prof Brian Ripley wrote:
 On Sun, 8 Jan 2006, Prof Brian Ripley wrote:
 
 Ctrl-Break works: see the rw-FAQ and README.rterm.  (You'll need a return
 to see a new prompt.)

 It is related to your reading directly from the console, so Ctrl-C is
 getting sent to the wrong place, I believe.  (There's a comment from 
 Guido
 somewhere in the sources about this, and this seems corroborated by the
 fact that Ctrl-C will interrupt under Rterm --ess.)
 
 
 Although the comment is there (in psignal.c), on closer examination the 
 cause is a change Guido made to getline.c, so Ctrl-C is treated as a 
 character during keyboard input.  I doubt if that was intentional (0 is 
 not the default state) and I have changed it for R-devel.\

Thank you very much this.

Henrik


 On Sun, 8 Jan 2006, Henrik Bengtsson wrote:

 Hi.

 Using Rterm v2.2.1 on WinXP, is there a way to interrupt a call like

  repeat { readline() }

 without killing the Command window?  Ctrl+C is not interrupting the 
 loop:

 R : Copyright 2006, The R Foundation for Statistical Computing
 Version 2.2.1 Patched (2006-01-01 r36947)
 snip/snip

 repeat { readline() }

 ^C
 ^C
 ^C
 ^C

 On Unix it works.  The problem seems to get the interrupt signal to
 occur outside the readline() call so that repeat is interrupted. 
 Doing

 repeat { readline(); Sys.sleep(3) }

 and it is likely that can generate an interrupt signal outside 
 readline().

 It seem like readline()/readLines(n=1) or an underlying method catches
 the interrupt signal quietly and just waits for a symbol to come
 through.  Try readline() by itself and press Ctrl+C.  Maybe this is a
 property of the Windows Command terminal, I don't know, but is it a
 wanted feature and are R core aware of it?  Note that, in Rgui it is
 possible to interrupting such a loop by pressing ESC.

 Cheers

 Henrik

 __
 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


 -- 
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html



__
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


Re: [R] Suggestion for big files [was: Re: A comment about R:]

2006-01-08 Thread François Pinard
[hadley wickham]

 [...] according to comments I've read, MySQL does not seem to scale
 well with the database size according to the comments I've read,
 especially when records have to be decorated with random numbers and
 later sorted.

With SQL there is always a way to do what you want quickly, but you
need to think carefully about what operations are most common in your
database.  For example, the problem is much easier if you can assume
that the rows are numbered sequentially from 1 to n.  This could be
enfored using a trigger whenever a record is added/deleted.  This would
slow insertions/deletions but speed selects.

Sure (for a caricature example) that if database records are already 
decorated with random numbers, and an index is built over the 
decoration, random sampling may indeed be done quicker :-). The fact is 
that (at least our) databases are not especially designed for random 
sampling, and people in charge would resist redesigning them merely 
because there would be a few needs for random sampling.

What would be ideal is being able to build random samples out of any big 
database or file, with equal ease.  The fact is that it's doable.  
(Brian Ripley points out that R textual I/O has too much overhead for 
being usable, so one should rather say, sadly: It's doable outside R.)

 Just for fun: here, sample(1, 10) in R is slowish already
 :-).

This is another example where greater knowledge of problem can yield
speed increases.  Here (where the number of selections is much smaller
than the total number of objects) you are better off generating 10
numbers with runif(10, 0, 100) and then checking that they are
unique

Of course, my remark about sample() is related to the previous 
discussion.  If sample(N, M) was more on the O(M) side than being on 
the O(N) side (both memory-wise and cpu-wise), it could be used for
preselecting which rows of a big database to include in a random sample, 
so building on your idea of using a set of IDs.  As the sample of 
M records will have to be processed in-memory by R anyway, computing 
a vector of M indices does not (or should not) increase complexity.

However, sample(N, M) is likely less usable for randomly sampling 
a database, if it is O(N) to start with.  About your suggestion of using 
runif and later checking uniqueness, sample() could well be 
implemented this way, when the arguments are proper.  The greater 
knowledge of the problem could be built in right into the routine meant 
to solve it.  sample(N, M) could even know how to take advantage of 
some simplified case of a reservoir sampling technique :-).

 [...] a large table of randomly distributed ids [...] (with randomly
 generated limits) to select the appropriate number of records.

[...] a table of random numbers [...] pregenerated for you, you just
choose a starting and ending index.  It will be slow to generate the
table the first time, but then it will be fast.  It will also take up
quite a bit of space, but space is cheap (and time is not!)

Thanks for the explanation.

In the case under consideration here (random sampling of a big file or 
database), I would be tempted to guess that the time required for 
generating pseudo-random numbers is negligible when compared to the 
overall input/output time, so it might be that pregenerating randomized 
IDs is not worth the trouble.  Also given that whenever the database 
size changes, the list of pregenerated IDs is not valid anymore.

-- 
François Pinard   http://pinard.progiciels-bpi.ca

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Wikis for R

2006-01-08 Thread David Forrest
On Fri, 6 Jan 2006, Detlef Steuer wrote:
...
 Back to operating wikis:The wiki spamming is a serious problem,
 especially because I HATE to login to read or edit anything. So the
 choice is: take the wiki as seriously as work and have a look every
 other day to remove the spam (or better: form a group of volunteers).
 That hurts or at least is no fun. Or put restrictions on it. That hurts
 even more. Perhaps I do not understand Philippe`s loggable. What does
 a logfile with IPs help? The spammers are strangers selling viagra; I
 don`t want to find them :-)

Sometimes you can mark the spammer's IP's as spammers and then ban editing
by them.  For my own UseMod wiki, I avoid spam by rejecting edits that
change more than 3 URLS.  But this is getting off of the R help topic.

 To sum it up:There is a very simple way to proceed:Philippe uses his
 Docuwiki install as official, _general_ Rwiki and I close down mine. The
 beginners will find their niche in there, if there is a real demand. I
 wouldn´t mind to give up my wiki, because I have to admit it failed
 to achieve what I would have liked.

I like wikis too, and contributed a few pages to your wiki.  The low
use-rate and high wiki spamming content makes it not a place I frequent.

 So, Philippe, if you like, you can take over. I would replace my wiki
 with a notice where to find yours and the community gets a second chance
 :-)

http://fawn.unibw-hamburg.de/cgi-bin/Rwiki.pl does have some
useful content.  Maybe it would be good to wade through it and figure out
how to patch the standard R documentation to include those contributions.

An advantage of a wiki is the low barrier to adding correctable
documentation.  The email list also provides low-barrier-to-entry
documentation, and its success demonstrates the clear need for additional
documentation.

Considering that, maybe there would be a benefit in rolling references to
good email threads into the documentation in some sort of an automatic
method.  Perhaps if an email question leads to a clarification or good
example of a feature, someone could post a message to the thread that
tags it for inclusion by reference to relevant documentation in the next
release cycle.

If this wishful thinking would come to pass, then the standard
documentation could point people towards using the mail archive in a more
directly useful manner, and we'd retain the peer-reviewed answer quality
of the email list.

Dave
-- 
 Dr. David Forrest
 [EMAIL PROTECTED](804)684-7900w
 [EMAIL PROTECTED] (804)642-0662h
   http://maplepark.com/~drf5n/

__
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] Clustering and Rand Index - VS-KM

2006-01-08 Thread Mark Hempelmann
Dear WizaRds,

I have been trying to compute the adjusted Rand index as by Hubert/ 
Arabie, and could not correctly approach how to define a partition 
object as in my last request yesterday.

With package fpc I try to work around the problem, using my original data:

mat - matrix( c(6,7,8,2,3,4,12,14,14, 14,15,13,3,1,2,3,4,2, 
15,3,10,5,11,7,13,6,1, 15,4,10,6,12,8,12,7,1), ncol=9, byrow=T )
rownames(mat) - paste(v, 1:4, sep= )

## and the given partitions:

p1=c(1,1,1,2,2,2,3,3,3)
p2=c(1,1,1,3,2,2,3,3,2)
p3=c(1,2,1,3,1,3,1,3,2)
p4=c(1,2,1,3,1,3,1,3,2)

## Now

cluster.stats(d=dist(mat), clustering=p1, alt.clustering=p2)

## just gives
Error in as.dist(dmat[clustering == i, clustering == i]) :
(subscript) logical subscript too long

I think I don't understand the use of 'd' here. How can I calculate the 
corrected Rand matrix:
( .000  .407 -.071 -.071)
( .407  .000 -.071 -.071)
(-.071 -.071  .000 1.000)
(-.071 -.071 1.000  .000)

Does the clue package help me here? Does anyone know if there is a VS-KM 
algorithm (Variable Selection Heuristic for K-Means Clustering) 
implemented in R? Unfortunately, I did not find any serach entries.

Thank you for your help and support
Mark

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] A comment about R:

2006-01-08 Thread François Pinard
[Uwe Ligges]
François Pinard wrote:
[David Forrest]

[...] A few end-to-end tutorials on some interesting analyses would
be helpful.

I'm in the process of learning R.  While tutorials are undoubtedly
very useful, and understanding that working and studying methods vary
between individuals, what I (for one) would like to have is a fairly
complete reference manual to the library [...] organised by topics.

Have a look at  help.start() -- Search Engine  Keywords -- Section 
Keywords by Topic.

Yes, thanks.  This is quite in the spirit, or direction, of what I was 
proposing.  Is that resource exhaustive?  (I'm asking out of laziness, 
as it might take me several months to really check.)

One serious drawback (for me) is that it requires an heavy weight
browser to be used, with Javascript enabled.  I do not find this very
practical.  Another point is that the presentation, while useful, is a
rather dry.  In another message, I suggested the Emacs Lisp Reference 
Manual as a good example of a fluid presentation of a voluminous 
library.  There might be some workable compromise between the current 
situation with R, even through the Keywords by Topic, and that 
fluidity.  (Wikis also have the drawback of requiring heavy machinery,
and the editor they force us into if usually unbearable.)

I may be back with this subject, but only in a good while.  I'm slowly 
building a kind of documentation plan I want (yet in French), as I learn 
R, and guess I may complete my base learning in one or two years from 
now (hoping I'll stay courageous enough).  If I then get something 
usable or shareable enough, I'll offer it -- because I like returning 
a little something for the nice tools given to me!  :-)

In any case, thanks for listening!

-- 
François Pinard   http://pinard.progiciels-bpi.ca

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Ordering boxplot factors; thank you!

2006-01-08 Thread Joseph LeBouton
Profs. Ripley and Schwartz,

Thank you both very much for the suggestions!  These are exactly what I 
was looking for.  I'll re-read the boxplot help yet again; every time I 
read it something essential worms its way into my consciousness, but it 
enters more freely when I have a hint where to look.  The sad truth is 
that I was heading for a ~10-line hacker solution.  You've saved me from 
my usual code-writing ignomy.

Happy new year,

-Joseph

Prof Brian Ripley wrote:
 On Thu, 5 Jan 2006, Marc Schwartz wrote:
 
 On Thu, 2006-01-05 at 20:27 -0600, Joseph LeBouton wrote:

 Hi all,

 what a great help list!  I hope someone can help me with this puzzle...

 I'm trying to find a simple way to do:

 boxplot(obs~factor)

 so that the factors are ordered left-to-right along the x-axis by
 median, not alphabetically by factor name.
 
 
 The thing to realize is that they are not alphabetic, but ordered by 
 factor levels.  So the key is to set the levels.  (The help page for 
 boxplot does say that, as I was relieved to find.)
 
 Complicated ways abound, but I'm hoping for a magical one-liner that'll
 do the trick.

 Any suggestions would be treasured.

 Thanks,

 -jlb



 Using the first example in ?boxplot, which is:

 boxplot(count ~ spray, data = InsectSprays, col = lightgray)



 Get the medians for 'count by spray' using tapply() and then sort the
 results in increasing order, by median:

  med - sort(with(InsectSprays, tapply(count, spray, median)))

 med

   CEDAFB
 1.5  3.0  5.0 14.0 15.0 16.5


 Now do the boxplot, setting the factor levels in order by median:

  boxplot(count ~ factor(spray, levels = names(med)),
  data = InsectSprays, col = lightgray)


 So...technically two lines of code.
 
 
 This was answered yesterday in terms of bwplot.  See ?reorder.factor
 for the same example done using reorder.factor.  That will give you the 
 single line asked for, and be self-explanatory.
 

-- 

Joseph P. LeBouton
Forest Ecology PhD Candidate
Department of Forestry
Michigan State University
East Lansing, Michigan 48824

Office phone: 517-355-7744
email: [EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Clustering and Rand Index - VS-KM

2006-01-08 Thread Ales Ziberna
You can comput the adjusted Rand with function classAgreement form package
e1071:
classAgreement(table(p1,p2))$crand

You can also use
 cluster.stats(d=dist(t(mat)), clustering=p1, alt.clustering=p2)

However in your code below, the orientation of mat is wrong (that's why
there is a t() around the mat in my code above). The variables should be
represented by rows and the cases by columns.

Best,
Ales Ziberna



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Hempelmann
Sent: Monday, January 09, 2006 12:43 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Clustering and Rand Index - VS-KM

Dear WizaRds,

I have been trying to compute the adjusted Rand index as by Hubert/ Arabie,
and could not correctly approach how to define a partition object as in my
last request yesterday.

With package fpc I try to work around the problem, using my original data:

mat - matrix( c(6,7,8,2,3,4,12,14,14, 14,15,13,3,1,2,3,4,2,
15,3,10,5,11,7,13,6,1, 15,4,10,6,12,8,12,7,1), ncol=9, byrow=T )
rownames(mat) - paste(v, 1:4, sep= )

## and the given partitions:

p1=c(1,1,1,2,2,2,3,3,3)
p2=c(1,1,1,3,2,2,3,3,2)
p3=c(1,2,1,3,1,3,1,3,2)
p4=c(1,2,1,3,1,3,1,3,2)

## Now

cluster.stats(d=dist(mat), clustering=p1, alt.clustering=p2)

## just gives
Error in as.dist(dmat[clustering == i, clustering == i]) :
(subscript) logical subscript too long

I think I don't understand the use of 'd' here. How can I calculate the
corrected Rand matrix:
( .000  .407 -.071 -.071)
( .407  .000 -.071 -.071)
(-.071 -.071  .000 1.000)
(-.071 -.071 1.000  .000)

Does the clue package help me here? Does anyone know if there is a VS-KM
algorithm (Variable Selection Heuristic for K-Means Clustering) implemented
in R? Unfortunately, I did not find any serach entries.

Thank you for your help and support
Mark

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
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] (sans objet)

2006-01-08 Thread PONSERO Alain
 Dear R People:

in the function loess, how can one add the weight of the points which is
contained in the variable nbtotal

Data :
Nbtotal P_alim  H_eau


xyplot(P_alim ~ H_eau, 
auto.key = list(points = T, lines = F),data = data,
type = c(p, smooth), span=.2,
scales = free, layout = c(1, 1),
main=,
xlab=Hauteur d'eau (en m),
ylab=taux d'alimentation)


the graph xyplot is not modified if the weights term is added
xyplot(P_alim ~ H_eau, 
auto.key = list(points = T, lines = F),data = data,
type = c(p, smooth), span=.2,weights=Nb_total,
scales = free, layout = c(1, 1),
main=,
xlab=Hauteur d'eau (en m),
ylab=taux d'alimentation)


Thanks in advance,

Alain ponsero

__
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


Re: [R] How to unload a package or undo library(package)

2006-01-08 Thread Ales Ziberna
If I do  detach(package:blockmodeling)

My package blockmodeling does not appear in (.packages())
[1] methods   stats graphics  grDevices utils datasets 
[7] base   

However, if I want to install a newer version from a local zip file, I get:
utils:::menuInstallLocal()
package 'blockmodeling' successfully unpacked and MD5 sums checked
Error: cannot remove prior installation of package 'blockmodeling'


Is there any way around that?

Best,
Ales Ziberna

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gabor Grothendieck
Sent: Sunday, January 08, 2006 10:42 PM
To: Aleš Žiberna
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] How to unload a package or undo library(package)

Here are some things to try:

detach() - detach most recent attached package
detach(2) - detach package which is in position 2 on search list. 
Same as detach()
detach(package:mypackage) - mypackage from search list
search() - display search list

On 1/8/06, Aleš Žiberna [EMAIL PROTECTED] wrote:
 Hello!

 I would like to unload a package form a current R session. I tried 
 datach(package:packagename), however it does not work. The reason I 
 want to unload it is that I want to correct some files in the package 
 and reinstall it without closing an R session.

 Best,
 Ales Ziberna

 PS: I am using R 2.1.1 on Windows XP

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


Re: [R] R-help Digest, Vol 35, Issue 7

2006-01-08 Thread Kyosti H Kurikka
Hi!

Just use your factors for indexing c(15,16,17) and
c(red,green,blue). So, with the iris data:

with(iris, plot(Sepal.Length, Sepal.Width,
   pch=c(15,16,17)[as.integer(Species)],
   col=c(red,green,blue)[as.integer(Species)] ))

Best regards,
Kyosti Kurikka


  Evgeniy Kachalin wrote:
 
  Hello, dear participants!
 
  Could you tip me, is there any simple and nice way to build
  scatter-plot for three different types of data (, and o and * - signs,
  for example) with legend.
 
  Now i can guess only that way:
 
  plot(x~y,data=subset(mydata,factor1=='1'), pch='.',col='blue')
  points(x~y,data=subset(mydata,factor1=='2'), pch='*',col='green')
  points( etc
 
  What is the simple and nice way?
  Thank you very much for your kindness and help.
 
 
 
  Example:
 
 
  with(iris,
plot(Sepal.Length, Sepal.Width, pch = as.integer(Species)))
  with(iris,
legend(7, 4.4, legend = unique(as.character(Species)),
  pch = unique(as.integer(Species
 

 Uwe, sorry for my stupid question. You mean that when pch=factor , plot
 can recycle the factor and use it for subscripts or marks.

 Then pch=as.integer(Species) results in c(1,2,3) for 3 factor levels.
 And I need symbols 15,16,17 and colors red, blue, green.

 So then I do:
 iris$Species-spec.symb
 iris$Species-spec.col
 levels(spec.symb)-c(15,16,17)
 levels(spec.col)-c('red','green','blue')

 That's the only way?
 More of that!!! 'Plot' does not like factors in 'pch'. So it must be so:
 plot(x~y,data, pch=as.integer(as.character(spec.symb))).
 That's totally crazy...

 --
 Evgeniy

 __
 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@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] paste tab and print

2006-01-08 Thread vincent
Dear all,

info = paste('a', 'b', sep='\t')
print(info , quote=F)

doesn't produce the same result with R201 and R220
(under Windows2000)
R 2.0.1 : [1] a   b
R 2.2.0 : [1] a\tb

I did read the CHANGESR220 file and tried also the search
engine but couldn't find an answer.
I certainly missed the point, and apologize about that.

So if somebody could tell me how to insert a tab inside
strings under R.2.2.0., it would be very kind.

Thanks
Vincent

__
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


Re: [R] R-help Digest, Vol 35, Issue 7

2006-01-08 Thread Uwe Ligges
Evgeniy Kachalin wrote:

 Uwe Ligges пишет:
 
 Evgeniy Kachalin wrote:

 Hello, dear participants!

 Could you tip me, is there any simple and nice way to build 
 scatter-plot for three different types of data (, and o and * - 
 signs, for example) with legend.

 Now i can guess only that way:

 plot(x~y,data=subset(mydata,factor1=='1'), pch='.',col='blue')
 points(x~y,data=subset(mydata,factor1=='2'), pch='*',col='green')
 points( etc

 What is the simple and nice way?
 Thank you very much for your kindness and help.



 Example:


 with(iris,
   plot(Sepal.Length, Sepal.Width, pch = as.integer(Species)))
 with(iris,
   legend(7, 4.4, legend = unique(as.character(Species)),
 pch = unique(as.integer(Species

 
 Uwe, sorry for my stupid question. You mean that when pch=factor , plot 
 can recycle the factor and use it for subscripts or marks.

Yes, it can recycle, but in the example above it does not recycle but 
takes the whole Species vector.


 Then pch=as.integer(Species) results in c(1,2,3) for 3 factor levels. 
 And I need symbols 15,16,17 and colors red, blue, green.

What about adding 14 as in as.integer(Species)+14, or 1 for the colors, 
respectively?



 So then I do:
 iris$Species-spec.symb
 iris$Species-spec.col
 levels(spec.symb)-c(15,16,17)
 levels(spec.col)-c('red','green','blue')
 
 That's the only way?

This is one qay of many.


 More of that!!! 'Plot' does not like factors in 'pch'. So it must be so:
 plot(x~y,data, pch=as.integer(as.character(spec.symb))).
 That's totally crazy...

You can set up your own pch variable of course, if you don't like it 
this fast and easy way.

Uwe Ligges

__
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

Re: [R] Missing value representation in Excel before extraction to R with RODBC

2006-01-08 Thread Petr Pikal
Hi

I believe it has something to do with the column identification 
decision. When R decides what is in a column it uses only some values 
from the beginning of a file.

I do not use RODBC as read.delim(clipboard, ...) is usually more 
convenient but probably there is a way how to tell RODBC what is in 
the column instead of let R decide from the top of the file.

But I may be completely mistaken.

HTH
Petr


On 6 Jan 2006 at 20:47, Fredrik Lundgren wrote:

From:   Fredrik Lundgren [EMAIL PROTECTED]
To: R-help r-help@stat.math.ethz.ch
Date sent:  Fri, 6 Jan 2006 20:47:29 +0100
Subject:[R] Missing value representation in Excel before 
extraction to R
with RODBC

 Dear list,
 
 How should missing values be expressed in Excel before extraction to R
 via RODBC. I'm bewildered. Sometimes the representation with NA in
 Excel appears to work and shows up in R as NA but sometimes the use
 of NA in Excel changes the whole vector to NA's. Blank or nothing or
 NA as representation for missing values in Excel with dateformat gives
 NA's of the whole vector in R but with  general format in Excel gives
 blanks for missing values in R. How should I represent missing values
 in Excel?
 
 
 Best wishes and thanks for any help
 Fredrik Lundgren
 
 __
 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

Petr Pikal
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html