Re: [R] alternative to built-in data editor

2009-05-27 Thread Dieter Menne



urlwolf wrote:
> 
> I often have to peek at large data.
> While head and tail are convenient, at times I'd like some more
> comprehensive.
> I guess I debug better in a more visual way?
> I was wondering if there's a way to override the default data editor.
> 

I have never seen the data editor.  The radical alternative I use is to do
all data-peeking in an external database, e.g. Access or SQLServer Express.
Writing using RODBC is so easy that write all intermediate results back to
the database for inspection and re-use in a later step. 

Dieter

-- 
View this message in context: 
http://www.nabble.com/alternative-to-built-in-data-editor-tp23747080p23756182.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] question about using a remote system

2009-05-27 Thread Ted Harding
On 28-May-09 00:58:17, Erin Hodgess wrote:
> Dear R People:
> I would like to set up a plug-in for Rcmdr to do the following:
> 
> I would start on a Linux laptop.  Then I would log into another
> outside system and run a some commands.
> 
> Now, when I tried to do
> system("ssh e...@xxx.edu")
> password xx
> 
> It goes to the remote system.  how do I continue to issue commands
> from the Linux laptop please?
> 
> (hope this makes sense)
> thanks,
> Erin

Hi Erin,
If I understand what you want, I think you may be asking a bit
too much from R itself.

When you, Erin, are interacting with your Linux laptop you can
switch between two (or more) different X windows or consoles,
on one of which you are logged in to the remote machine and on
which you issue commands to the remote machine, and can read
its output and, maybe, copy this to a terminal running commands
on your Linux laptop.

When you ask R to log in as you describe, you are tying that
instance of R to the login. I don't know of any resources within
R itself which can emulate your personal behaviour. Though maybe
others do know ...

However, there is in principle a work-round. You will need to
get your toolbox out and get to grips with "Unix plmubing";
and, to make it accessible to R, you will need to create a
"Unix plumber".

The basic component is the FIFO, or "named pipe". To create
one of these, use a Linux command like

  mkfifo myFIFO1

Then 'ls -l' in the directory you are working in will show this
pipe as present with the name "myFIFO1". For example, if in one
terminal window [A] you start the command

  cat myFIFO1

then in another [B] you

  echo "Some text to test my FIFO" > myFIFO1

you will find that this text will be output in the [A] window
by the 'cat' command.

Similarly, you could 'mkfifo myFIFO2' and write tc this while
in the [A] window, and read from it while in the [B] window.

So, if you can get R to write to myFIFO1 (which is being read
from by another program which will send the output to a remote
machine which that program is logged into), and read from myFIFO2
which is being written to by that other program (and that is
easy to do in R, using connections), then you have the plumbing
set up.

But, to set it up, R needs to call in the plumber. In other words,
R needs to execute a command like

  system("MakeMyFIFOs")

where MakeMyFIFOs is a script that creates myFIFO1 and myFIFO2,
logs in to the remote machine, watches myFIFO1 and sends anything
it reads to the remote machine, watches for any feedback from
the remote machine and then writes this into myFIFO2.

Meanwhile, back in R, any time you want R to send something to
the remote machine you write() it (or similar) to myFIFO1, and
whenever you want to receive something from the remote machine
you readLines() it (or similar) from myFIFO2.

That's an outline of a possible work-round. Maybe other have solved
your same problem in a better way (and maybe there's an R package
which does just that ... ). If so, I hope they'll chip in!

Ted.


E-Mail: (Ted Harding) 
Fax-to-email: +44 (0)870 094 0861
Date: 28-May-09   Time: 07:33:09
-- XFMail --

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Interaction plots as lines or bars?

2009-05-27 Thread Dieter Menne



Michael Kubovy wrote:
> 
> An editor has suggested that I use bar plots to capture an interaction  
> of two 2-level factors and an interaction of a 2 by 3 factorial  
> experiment. (It would seem that there's a fear that someone might try  
> to interpolate between, e.g., 'male' and 'female'.) In general it  
> seems to me that an interaction plot with lines is easier to read, and  
> not likely to mislead. Does anyone know if and where this has been  
> discussed?
> 

Editors are paid by the ink. 

I have never seen anything else than lines for such a plot. However, I once
was successful in using somewhat wider lines that looked barish. Which made
me believe that the "paid by the ink" is not too bad an analogy: editors
fear graphics that look too empty, so give them their black.  I am sure
Hadley will argue that this is the reason why ggplot2 by default has a gray
background.

Dieter


-- 
View this message in context: 
http://www.nabble.com/Interaction-plots-as-lines-or-bars--tp23754973p23755909.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Unable to load R

2009-05-27 Thread Zeljko Vrba
On Thu, May 28, 2009 at 11:42:41AM +0530, anupam sinha wrote:
>
> I have checked for the presence of the above mention library and found that
> the library is present.  I have run out of ideas. Can anyone help me out???
> I will be greatly indebted.
> 
First: how did you check that the library is present?

It might be that you have installed 32-bit R on 64-bit RHEL or vice-versa, so
you need to install the requisite libraries in appropriate "bitness".

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Unable to load R

2009-05-27 Thread anupam sinha
Dear all,
I have recently installed R on a Red Hat Enterprise Linux
(RHEL5)  system. But I am unable to load R and it is giving the following
error :

*/usr/local/lib/R/bin/exec/R: error while loading shared libraries:
libreadline.so.5: cannot open shared object file: No such file or directory*

I have checked for the presence of the above mention library and found that
the library is present.  I have run out of ideas. Can anyone help me out???
I will be greatly indebted.


Cheers,

Anupam Sinha,
Graduate Student,
Lab of Computational Biology,
Centre for DNA Fingerprinting and Diagnostics,
Hyderabad, India

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R Books listing on R-Project

2009-05-27 Thread G. Jay Kerns
>
> Jay: why not post your R-books how to on the wiki itself???

Because I thought that it would be better to write the instructions in
R-wiki language that anybody could modify rather than post a PDF by
me.

Here is what I had in mind:

http://wiki.r-project.org/rwiki/doku.php?id=links:books:howto

Also, I put the books from the main page in the above format:

http://wiki.r-project.org/rwiki/doku.php?id=links:books



>  I wrote some R code to wikify the R-books list from the
> R web site -- it won't deal with LaTeX code in the abstract,
> but otherwise should convert automatically.
>

Excellent a person could use what you have written to simply
copy/paste into the wiki in the appropriate place(s).

One of the advantages of the R wiki is the ease with which books may
be categorized - which goes back to Stavros' OP.   At the time, I went
to Springer or CRC somewhere and found the below categories.  Judging
from the flyers that fill my office mailbox, I believe that all of
them are currently covered by *some* book related to R.

If it were the author's responsibility to put their book in the proper
category or categories, and given that authors are typically of a mind
to sell books... then perhaps the R wiki would populate and maintain
itself?

Jay

Bayesian Statistics
Biostatistics
Computational Statistics
Environmental Statistics
Introductory Statistics
Probability Theory & Applications
Programming in R and S
Reference Statistics & Collected Works
SPC/Reliability/Quality Control
Statistical Genetics & Bioinformatics
Statistical Learning & Data Mining
Statistical Theory & Methods
Statistics for Biological Sciences
Statistics for Business, Finance & Economics
Statistics for Engineering and Physical Science
Statistics for Psychology, Social Science & Law
Unclassified

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] PBSmapping problems with importGSHHS

2009-05-27 Thread Tim Clark

Dear List,

I am trying to use the PBSmapping package to import and plot the shoreline of 
Hawaii.  I am having problems importing and plotting the specific regions that 
I would like to plot.  Specifically, I can't get it to import the range of x 
variables that I would like.  I think my problem is with a variable called 
xoff, but I have no idea what it is, what it does, or how I am supposed to use 
it.  It's default value is -360, but I have found examples in the PBSmapping 
web publication of it being set to zero as well.  The help files provides the 
following definitions:

xlim range of X-coordinates to clip. Range should match the transform xoff. 

xoff transform the X-coordinates by specified amount. 


I can import certain regions of GSHH, but I don't seem to be able to limit them 
like I want using xlim.  If I change xoff to something besides -360 I get 
different sizes of plots that are all the color I am using for land.  I have 
the following:

Hawaii.GSHH<- importGSHHS(GSHHfile,
xlim=c(-156.3,-155.92), ylim=c(19.45,19.5), xoff=-360)

The GSHHS shoreline data is found at:
http://www.soest.hawaii.edu/wessel/gshhs/gshhs.html

Any suggestions on what is going on?

Thanks,

Tim




Tim Clark
Department of Zoology 
University of Hawaii

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Interaction plots as lines or bars?

2009-05-27 Thread Michael Kubovy

Dear r-helpers,

An editor has suggested that I use bar plots to capture an interaction  
of two 2-level factors and an interaction of a 2 by 3 factorial  
experiment. (It would seem that there's a fear that someone might try  
to interpolate between, e.g., 'male' and 'female'.) In general it  
seems to me that an interaction plot with lines is easier to read, and  
not likely to mislead. Does anyone know if and where this has been  
discussed?



_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
  McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R: R: Harmonic Analysis

2009-05-27 Thread mauede
Actually I do use DWT for features extraction which is aimed at clustering 
signals bearing statistically comparable patterns. 
Trend can easily fool any clustering function. This is why detrending is the 
number 1 step in the whole procedure.
Sparing the quasi-harmonic components that bear most of the information is a 
must.
I am interested at sparing the quasi-periodic oscillations that, otherwise, 
would be wiped out by the detrending procedure.
Thanks,
Maura

-Messaggio originale-
Da: stephen sefick [mailto:ssef...@gmail.com]
Inviato: gio 28/05/2009 0.56
A: mau...@alice.it
Cc: r-h...@stat.math.ethz.ch
Oggetto: Re: R: [R] Harmonic Analysis
 
Do you need time localization, or are you only interested in the
period of the high frequency?  If you do need time localization why
not use a CWT to look at the signal?

Stephen

On Wed, May 27, 2009 at 4:59 PM,   wrote:
> Well, the time series I am  dealing with are non-linear and not-stationary.
> Maura
>
> -Messaggio originale-
> Da: r-help-boun...@r-project.org per conto di stephen sefick
> Inviato: mer 27/05/2009 14.58
> A: r-h...@stat.math.ethz.ch
> Oggetto: Re: [R] Harmonic Analysis
>
> why will a fourier transform not work?
> 2009/5/27 Uwe Ligges :
>>
>>
>> Dieter Menne wrote:
>>>
>>>   alice.it> writes:
>>>
 I am looking for a package to perform harmonic analysis with the goal of
 estimating the period of the
 dominant high frequency component in some mono-channel signals.
>>>
>>> You should widen your scope by looking a "time series" instead of
>>> harmonic
>>> analysis. There is a task view on the subject at
>>>
>>> http://cran.at.r-project.org/web/views/TimeSeries.html
>>
>>
>> ... or take a look at package tuneR.
>>
>> Uwe Ligges
>>
>>
>>
>>
>>> Dieter
>>>
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Stephen Sefick
>
> Let's not spend our time and resources thinking about things that are
> so little or so large that all they really do for us is puff us up and
> make us feel like gods.  We are mammals, and have not exhausted the
> annoying little problems of being mammals.
>
>                                 -K. Mullis
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e
> tutti i telefonini TIM!

er



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis




tutti i telefonini TIM!


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R help

2009-05-27 Thread mohsin ali

Dear Sir
 
I am new user of R.
I am interested in modeling hydrological extreme events. I found  MSClaio2008 
very interesting function. In this function four criterions for choosing 
distributions. Can we call these criterions as model selection techniques or 
goodness of fit techniques or both?  Because goodness of fit techniques are 
usually performed after modle selection. 
 Can I found chi-square, kolmogrov-sminov and cramer-von mises tests for 
testing goodness of fit for proposed distributions?
 
 
Please help 
_
Show them the way! Add maps and directions to your party invites. 

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R Books listing on R-Project

2009-05-27 Thread Ben Bolker



G. Jay Kerns wrote:
> 
> Hello Stavros,
> 
> On Wed, May 27, 2009 at 2:53 PM, Stavros Macrakis 
> wrote:
>> I was wondering what the criteria were for including books on the Books
>> Related to R page . (There
>> is
>> no maintainer listed on this page.)
>>
>> In particular, I was wondering why the following two books are not
>> listed:
>>
>> * Andrew Gelman, Jennifer Hill, *Data Analysis Using Regression and
>> Multilevel/Hierarchical Models*. (CRAN package 'arm')
>>
>> * Michael J. Crawley, *The R Book*. (reviewed, rather negatively, in *R
>> News
>> * *7*:2)
>>
>> Is the list more or less arbitrary?  Does it reflect some editorial
>> judgment
>> about the value of these books? If so, it might be more useful to include
>> the books, but with critical reviews.  It doesn't seem to be a matter of
>> up-to-dateness, because 38/87 of the listed books were published in a
>> more
>> recent year than Gelman or Crawley.
>>
>> The list is currently in reverse chronological order.  I wonder if it
>> would
>> be useful to group the entries thematically -- I'd be happy to help on
>> that
>> project.
>>
> 
> I had a similar idea in 2008 for the R-wiki:
> 
> http://tolstoy.newcastle.edu.au/R/e5/devel/08/10/0481.html
> 
> There were no responses and I ran out of time to continue working on
> it myself.  If you are interested in proceeding along these lines then
> I have some more ideas and would be willing to help...  or, perhaps
> you (or somebody else) knows of an even better approach.
> 
> Cheers
> Jay
> 
> 

I don't know what the editorial policy is, but Kurt Hornik put my book
up when I asked him to.  (The BibTeX entries for both books are at
the bottom of this message, in case that's useful.)

Jay: why not post your R-books how to on the wiki itself???


  I wrote some R code to wikify the R-books list from the
R web site -- it won't deal with LaTeX code in the abstract,
but otherwise should convert automatically.

w <- readLines(url("http://www.r-project.org/doc/bib/R-books.bib";))
g <- c(grep("^@",w),length(w)+1)
gd <- diff(g)
gd2 <- rep(1:length(gd),gd)
w2 <- split(w,gd2)
w2 <- w2[-na.omit(match(g,grep("^...@comment",w)))]
w3 <- lapply(w2,
 function(x) { c("",x,"") })
w4 <- lapply(w3,
 function(x) {
   abs.start.token <- "^ *abstract *= *{"
   abs.end.token <- "} *, *$"
   abs.start <- grep(abs.start.token,x)
   abs.end <- grep(abs.end.token,x[-(1:abs.start)])+abs.start
   abstr <- x[abs.start:abs.end]
   n <- length(abstr)
   abstr[1] <- gsub(abs.start.token,"",abstr[1])
   abstr[n] <- gsub(abs.end.token,"",abstr[n])
   c(x[-(abs.start:abs.end)],"",abstr)
 })
   



@book{crawley_r_2007,
edition = {1},
title = {The R Book},
isbn = {0470510242},
publisher = {Wiley},
author = {Michael J. Crawley},
month = jun,
year = {2007}
}
@book{gelman_data_2006,
address = {Cambridge, England},
title = {Data Analysis Using Regression and {Multilevel/Hierarchical}
Models},
url = {http://www.stat.columbia.edu/~gelman/arm/},
publisher = {Cambridge University Press},
author = {Andrew Gelman and Jennifer Hill},
year = {2006},
keywords = {uploaded}
}
-- 
View this message in context: 
http://www.nabble.com/R-Books-listing-on-R-Project-tp23748687p23754282.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] problem with cbind

2009-05-27 Thread Gabor Grothendieck
Try this where Age.Group is a factor whose
levels represent the columns of out and Seq is
a sequence number labeling the first Name
in each Age.Group 1, the second 2 and
so on.

> DF <- data.frame(Name = LETTERS, Age = 1:26)
> DF$Age.Group <- cut(DF$Age, seq(0, 30, 10))
> DF$Seq <- with(DF, ave(seq_along(Name), Age.Group, FUN = seq_along))
> out <- tapply(DF$Name, DF[c("Seq", "Age.Group")], paste)
> out[is.na(out)] <- ""
> out
Age.Group
Seq  (0,10] (10,20] (20,30]
  1  "A""K" "U"
  2  "B""L" "V"
  3  "C""M" "W"
  4  "D""N" "X"
  5  "E""O" "Y"
  6  "F""P" "Z"
  7  "G""Q" ""
  8  "H""R" ""
  9  "I""S" ""
  10 "J""T" ""

On Wed, May 27, 2009 at 1:27 PM, kayj  wrote:
>
> Hi All,
>
> I have a file with two columns, the first column has the names of the
> patients and the second column has the age. I am looking into creating an
> output file that looks like
>
> 1-10    10-20    etc
> Eric    Chris
> Bob     mat
>            Andrew
>            Suzan
>
>
> Where each column has the name of the patients in a given age category that
> is displayed in the header. For example in the output, the first column has
> the name of the patients with age between 1 to 10.
>
> The problem that I am having is that I can not use cbind since the length of
> the vectors is different. Is there a way to create such a file?
>
> Thanks for your help
>
>
>
> --
> View this message in context: 
> http://www.nabble.com/problem-with-cbind-tp23747075p23747075.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] problem with cbind

2009-05-27 Thread jim holtman
Here is one way of doing it by splitting the data and then padding
everything to the same length:

> x <- data.frame(pat=LETTERS, age=sample(60, 26))
> x.cut <- split(x, cut(x$age, breaks=c(1,seq(10,60,10
> # determine maximum number in a group and then pad the rest out to that
size
> x.max <- max(sapply(x.cut, nrow))
> x.pad <- lapply(x.cut, function(.grp){
+ c(as.character(.grp$pat), rep("", x.max - nrow(.grp)))
+ })
> # now you can do the cbind
> print(do.call(cbind, x.pad), quote=FALSE)
 (1,10] (10,20] (20,30] (30,40] (40,50] (50,60]
[1,] H  E   C   B   A   K
[2,] L  J   D   F   G   P
[3,] T  V   I   O   N   R
[4,] U  W   M   X   S
[5,]Y   Q
[6,]Z
>
>
>


On Wed, May 27, 2009 at 1:27 PM, kayj  wrote:

>
> Hi All,
>
> I have a file with two columns, the first column has the names of the
> patients and the second column has the age. I am looking into creating an
> output file that looks like
>
> 1-1010-20etc
> EricChris
> Bob mat
>Andrew
>Suzan
>
>
> Where each column has the name of the patients in a given age category that
> is displayed in the header. For example in the output, the first column has
> the name of the patients with age between 1 to 10.
>
> The problem that I am having is that I can not use cbind since the length
> of
> the vectors is different. Is there a way to create such a file?
>
> Thanks for your help
>
>
>
> --
> View this message in context:
> http://www.nabble.com/problem-with-cbind-tp23747075p23747075.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Replace is leaking?

2009-05-27 Thread Rolf Turner


On 28/05/2009, at 12:36 PM, Zhou Fang wrote:


Okay, someone explain this behaviour to me:

Browse[1]> replace(rep(0, 4000), temp1[12] , temp2[12])[3925]
[1] 0.4462404
Browse[1]> temp1[12]
[1] 3926
Browse[1]> temp2[12]
[1] 0.4462404
Browse[1]> replace(rep(0, 4000), 3926 , temp2[12])[3925]
[1] 0

For some reason, R seems to shift indices along when doing this  
replacement.


Has anyone encountered this bug before? It seems to crop up from time
to time, seemingly at random. Any idea for a fix? Reassigning the
variables seems to preserve the magicness of the numbers. It all seems
very bizarre and worrying.

If anyone is interested in a R workspace to reproduce this, email me.
This is running in R 2.9.


Doesn't happen to me:

 > temp1 <- sample(1:1,20)
 > temp2 <- runif(20)
 > temp1[12] <- 3926
 > temp2[12] <- 0.4462404
 > temp1[12]
[1] 3926
 > temp2[12]
[1] 0.4462404
 > xxx <- replace(rep(0, 4000), temp1[12] , temp2[12])
 > xxx[3925]
[1] 0
 > xxx[3926]
[1] 0.4462404


OMM!

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Replace is leaking?

2009-05-27 Thread Zhou Fang

Oh hang on, I've figured it out.

Rounding error, doh. Somewhere along the line I got lazy and took the 
weighted average of two values that are equal. as.integer truncates, so, 
yeah. Never mind.


Zhou Fang

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] question about using a remote system

2009-05-27 Thread Erin Hodgess
Dear R People:

I would like to set up a plug-in for Rcmdr to do the following:

I would start on a Linux laptop.  Then I would log into another
outside system and run a some commands.

Now, when I tried to do
system("ssh e...@xxx.edu")
password xx

It goes to the remote system.  how do I continue to issue commands
from the Linux laptop please?

(hope this makes sense)

thanks,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Replace is leaking?

2009-05-27 Thread Zhou Fang
Okay, someone explain this behaviour to me:

Browse[1]> replace(rep(0, 4000), temp1[12] , temp2[12])[3925]
[1] 0.4462404
Browse[1]> temp1[12]
[1] 3926
Browse[1]> temp2[12]
[1] 0.4462404
Browse[1]> replace(rep(0, 4000), 3926 , temp2[12])[3925]
[1] 0

For some reason, R seems to shift indices along when doing this replacement.

Has anyone encountered this bug before? It seems to crop up from time
to time, seemingly at random. Any idea for a fix? Reassigning the
variables seems to preserve the magicness of the numbers. It all seems
very bizarre and worrying.

If anyone is interested in a R workspace to reproduce this, email me.
This is running in R 2.9.

Zhou Fang

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How do I get removed from this mailing list?

2009-05-27 Thread Duncan Murdoch

On 27/05/2009 8:25 PM, Andrey Lyalko wrote:

How do I get removed from this mailing list?



Like most lists nowadays, it gives the instructions in each message header:

List-Unsubscribe: ,


Duncan Murdoch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] RGoogleDocs: can now see documents but cannot get content.

2009-05-27 Thread Farrel Buchinsky
I already downloaded 0.2-2 -If my memory serves me correctly. If we just go
by date, have you updated the files on the server since May 18?

Farrel Buchinsky
Google Voice Tel: (412) 567-7870

Sent from Pittsburgh, Pennsylvania, United States

On Wed, May 20, 2009 at 12:28, Duncan Temple Lang
wrote:

>
> Hi Farrel
>
>  This particular problem is a trivial issue of an argument out
> of place due to a change in the function definition during the
> development.  There is a new version of the package (0.2-2)
> and it also uses a slightly different approach (and function)
> to pull the values into the form of an R data frame.
>
> Please try that and hopefully it will work.
>
> The code in the run.pdf (or run.html) file on the Web page
> and in the package works and is the best and shortest
> example of sheetAsMatrix().
>
> Let me know if there are still problems.
>
>
>  D.
>
> Farrel Buchinsky wrote:
>
>> The author of the package, Duncan Temple Lang posted an update. I have
>> installed it and now can list my spreadsheets but alas I cannot read the
>> data within any of them.
>> Has anybody been able to get it to work.
>> I would love to see a real live example of sheetAsMatrix
>> I am not sure how to specify sheet and  con = sh...@connection. I have
>> tried
>> many ways but just get:
>> Error in !includeEmpty : invalid argument type
>>
>> Windows Vista (with UAC disabled)
>> R 2.9.0
>>
>> Farrel Buchinsky
>>
>>[[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How do I get removed from this mailing list?

2009-05-27 Thread Andrey Lyalko
How do I get removed from this mailing list?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] lattice::xyplot axis padding with fontfamily="mono"

2009-05-27 Thread Benjamin Tyner

Hello,

Say I have a predictor taking a very wide value:

  Data <- 
data.frame(pred="a",resp=1)


  print(xyplot(pred~resp, data=Data)) # enough y-axis padding to 
accommodate the wide label


  print(xyplot(pred~resp, data=Data,scales=list(fontfamily="mono"))) # 
not enough padding


What's the recommended way to have enough padding allocated?

Thank you
Ben
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] boxplot

2009-05-27 Thread stephen sefick
I don't understand what you want.

On Wed, May 27, 2009 at 6:52 PM,   wrote:
> Hi gues,
>
> Is there any function in R for boxplot with different time points?
> t1 <- c(rep(1,20),rep(2,20))
> t2 <- c(rep(1,10),rep(2,10),rep(1,10),rep(2,10))
> x <- rnorm(40,5,1)
> dat <- data.frame(t1,t2,x)
>
> boxplot(x~t1,t2)
>
>
> Many thanks,
> Amor
>
>
>
>        [[alternative HTML version deleted]]
>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R: Harmonic Analysis

2009-05-27 Thread stephen sefick
Do you need time localization, or are you only interested in the
period of the high frequency?  If you do need time localization why
not use a CWT to look at the signal?

Stephen

On Wed, May 27, 2009 at 4:59 PM,   wrote:
> Well, the time series I am  dealing with are non-linear and not-stationary.
> Maura
>
> -Messaggio originale-
> Da: r-help-boun...@r-project.org per conto di stephen sefick
> Inviato: mer 27/05/2009 14.58
> A: r-h...@stat.math.ethz.ch
> Oggetto: Re: [R] Harmonic Analysis
>
> why will a fourier transform not work?
> 2009/5/27 Uwe Ligges :
>>
>>
>> Dieter Menne wrote:
>>>
>>>   alice.it> writes:
>>>
 I am looking for a package to perform harmonic analysis with the goal of
 estimating the period of the
 dominant high frequency component in some mono-channel signals.
>>>
>>> You should widen your scope by looking a "time series" instead of
>>> harmonic
>>> analysis. There is a task view on the subject at
>>>
>>> http://cran.at.r-project.org/web/views/TimeSeries.html
>>
>>
>> ... or take a look at package tuneR.
>>
>> Uwe Ligges
>>
>>
>>
>>
>>> Dieter
>>>
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Stephen Sefick
>
> Let's not spend our time and resources thinking about things that are
> so little or so large that all they really do for us is puff us up and
> make us feel like gods.  We are mammals, and have not exhausted the
> annoying little problems of being mammals.
>
>                                 -K. Mullis
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e
> tutti i telefonini TIM!
> Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] boxplot

2009-05-27 Thread amorigandhi
Hi gues,
 
Is there any function in R for boxplot with different time points?
t1 <- c(rep(1,20),rep(2,20))
t2 <- c(rep(1,10),rep(2,10),rep(1,10),rep(2,10))
x <- rnorm(40,5,1)
dat <- data.frame(t1,t2,x)

boxplot(x~t1,t2)


Many thanks,
Amor


  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Linear Regression with Constraints

2009-05-27 Thread Emmanuel Charpentier
Le mercredi 27 mai 2009 à 17:28 +1000, bill.venab...@csiro.au a écrit :
> You can accommodate the constraints by, e.g., putting
> 
> c2 = pnorm(theta2)
> c3 = pnorm(theta3)

Nice. I'd have tried invlogit(), but I'm seriously biased...

> x1 has a known coefficient (unity) so it becomes an offset.
> Essentially your problem can be written
> 
> y1 = y-x1 = c1 + pnorm(theta2)*x2 - pnorm(theta3)*x3 + error
> 
> This is then a (pretty simple) non-linear regression which could be
> fitted using, e.g. nls
> 
> If you could not rule out the possibility that the solution is on the
> boundary, you could put c2 = (cos(theta2))^2, and the fitting
> procedure could take you there.  The solution is not unique, but the
> original coefficients, c2,c3, would be unique, of course.

Better than invlogit...

> With just 6 observations and 4 parameters to estimate, you will need
> the model to be an exceptionally close fitting one for the fit to have
> any credibility at all.

Seconded ! Except that "an exceptionally good fit" might also be an
accident, therefore with not much more credentials that an average
one...

Now to get back to the original formulation of the question, it turns
out that, for those particular bounds, you don't even need
constrOptim() : optim() will do, as exemplified in the following
script :

>
###
> # Constrained optimization demo
> 
> # It turns out that, for "vertical" bounds (i. e. bounds for a
coefficient
> # not depend on other coefficients), optim does the job.
> # constrOptim does the job for any polyhedral domain, but uses a more
> # intricate form of bounds expression (hyperplanes in p dimensions).
> # compare ?optim and ?constrOptim...
> 
> # Pseudodata for the question asked by "Stu @ AGS"

> #  in r-help (Linear Regression with Constraints)
> # Begin quote
> # y = c1 + x1 + (c2 * x2) - (c3 * x3)
> # 
> # Where c1, c2, and c3 are the desired regression coefficients that
are
> # subject to the following constraints:
> # 
> # 0.0 < c2 < 1.0, and
> # 0.0 < c3 < 1.0
> # End quote
> 
> # y1 : "Okay" choice of parameters : c2=0.3, c3=0.7
> # y2 : (Vicious) choice of "true" parameters : c2=0.5, c3=-0.5
> # optimum out of bounds
> # c1=1 in both cases
> 
> set.seed(1453)
> 
> PseudoData<-data.frame(x1=runif(6, -5, 5),
+x2=runif(6, -5, 5),
+x3=runif(6, -5, 5))
> 
> PseudoData<-within(PseudoData, {
+   y1=1+x1+0.3*x2+0.7*x3+rnorm(6, 0, 3)
+   y2=1+x1+0.5*x2-0.5*x3+rnorm(6, 0, 3)
+ })
> 
> Data1<-with(PseudoData,data.frame(y=y1, x1=x1, x2=x2, x3=x3))
> Data2<-with(PseudoData,data.frame(y=y2, x1=x1, x2=x2, x3=x3))
> 
> # The objective function : least squares.
> # I"m lazy
> 
> # Squared residuals : vector function, to be summed in objective,
> # and needs data in its eval environment.
> # R really needs some forme of lispish (let) or (let*)...
> 
> e<-expression((y-(c1+x1+c2*x2+c3*x3))^2) # Least squares (needs data
in env.)
> 
> # Use expression form of deriv(), to allow easy evaluation in a
constructed
> # environment
> 
> foo<-deriv(e, nam=c("c1","c2","c3"))
> 
> # Objective
> 
> objfun<-function(coefs, data) {
+   return(sum(eval(foo,env=c(as.list(coefs), as.list(data)
+ }
> 
> # Objective's gradient
> 
> objgrad<-function(coefs, data) {
+   return(apply(attr(eval(foo,env=c(as.list(coefs), as.list(data))),
+"gradient"),2,sum))
+ }
> 
> # raincheck : unbounded optimization, but using a form palatable to
> # bounded optimization
> 
> system.time(D1.unbound<-optim(par=c(c1=0.5, c2=0.5, c3=0.5),
+   fn=objfun,
+   gr=objgrad,
+   data=Data1,
+   method="L-BFGS-B",
+   lower=rep(-Inf, 3),
+   upper=rep(Inf, 3)))
utilisateur système  écoulé 
  0.004   0.000   0.004 
> 
> D1.unbound
$par
c1 c2 c3 
-0.5052088  0.2478704  0.7626611 

# c2 and c3 are sort of okay (larger range of variation for x2 and x3)
# but c1 is a bit out of whack (residual=3, we were unlucky...)

$value
[1] 12.87678

# keep in mind for future comparison

$counts
function gradient 
   99 

$convergence
[1] 0

$message
[1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"

> 
> # Another rainchech : does bound optimization reach the same objective
> # when the "true" value lies in the bound region ?
> 
> system.time(D2.unbound<-optim(par=c(c1=0.5, c2=0.5, c3=0.5),
+   fn=objfun,
+   gr=objgrad,
+   data=Data2,
+   method="L-BFGS-B",
+   lower=rep(-Inf, 3),
+   upper=rep(Inf, 3)))
utilisateur système  écoulé 
  0.008   0.000   0.006 
> 
> D2.unbound
$par
c1 c2 c3 
 

Re: [R] Changing point color/character in qqmath

2009-05-27 Thread Kevin W
Thanks to Deepayan, I have a corrected version of how to color points in a
qqmath plot according to another variable.  Using the barley data for a more
concise example::

qqmath(~ yield | variety, data = barley, groups=year,
   auto.key=TRUE,
  prepanel = function(x, ...) {
  list(xlim = range(qnorm(ppoints(length(x)
  },
  panel = function(x, ...) {
  xx <- qnorm(ppoints(length(x)))[order(x)]
  panel.xyplot(x = xx, y = x, ...)
  })


The example I posted previously (and shown below) is not correct.  My
apologies.

Kevin

On Wed, May 27, 2009 at 11:05 AM, Kevin W  wrote:

> Having solved this problem, I am posting this so that the next time I
> search for how to do this I will find an answer...
>
> Using qqmath(..., groups=num) creates a separate qq distribution for each
> group (within a panel).  Using the 'col' or 'pch' argument does not
> (usually) work because panel.qqmath sorts the data (but not 'col' or 'pch')
> before plotting.  Sorting the data before calling qqmath will ensure that
> the sorting does not change the order of the data.
>
> For example, to obtain one distribution per voice part and color the point
> by part 1 or part 2:
>
> library(lattice)
> singer <- singer
> singer <- singer[order(singer$height),]
> singer$part <- factor(sapply(strsplit(as.character(singer$voice.part),
> split = " "), "[", 1),
>  levels = c("Bass", "Tenor", "Alto", "Soprano"))
> singer$num <- factor(sapply(strsplit(as.character(singer$voice.part), split
> = " "), "[", 2))
> qqmath(~ height | part, data = singer,
>col=singer$num,
>layout=c(4,1))
>
>
>
> Kevin
>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R: Harmonic Analysis

2009-05-27 Thread mauede
Well, the time series I am  dealing with are non-linear and not-stationary. 
Maura

-Messaggio originale-
Da: r-help-boun...@r-project.org per conto di stephen sefick
Inviato: mer 27/05/2009 14.58
A: r-h...@stat.math.ethz.ch
Oggetto: Re: [R] Harmonic Analysis
 
why will a fourier transform not work?
2009/5/27 Uwe Ligges :
>
>
> Dieter Menne wrote:
>>
>>   alice.it> writes:
>>
>>> I am looking for a package to perform harmonic analysis with the goal of
>>> estimating the period of the
>>> dominant high frequency component in some mono-channel signals.
>>
>> You should widen your scope by looking a "time series" instead of harmonic
>> analysis. There is a task view on the subject at
>>
>> http://cran.at.r-project.org/web/views/TimeSeries.html
>
>
> ... or take a look at package tuneR.
>
> Uwe Ligges
>
>
>
>
>> Dieter
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




tutti i telefonini TIM!


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Factor level with no cases shows up in a plot

2009-05-27 Thread Stefan Grosse
Arthur Burke wrote:
>  
> ...  I get the four lines that I expected but the legend includes the
> Group level "cohort 4" .
>  
> How can I get rid of "cohort 4" in Group?
>   

This link might be of interest for you:
http://wiki.r-project.org/rwiki/doku.php?id=tips:data-manip:drop_unused_levels

hth
Stefan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how do I get to be a member?

2009-05-27 Thread Gavin Simpson
On Wed, 2009-05-27 at 11:09 -0700, Michael Menke wrote:
> Information, please.

On what? Member of what?

If you mean a member of the R Foundation, see:

http://www.r-project.org/foundation/membership.html

If you mean this list, you already are, otherwise you wouldn't be able
to post (IIRC).

If this is not what you want, perhaps you could be slightly more
explicit about what it is you *do* want to become a member of?

HTH

G

> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Axis label spanning multiple plots

2009-05-27 Thread Greg Snow
Create an outer margin (see ?par), then use mtext to put the title in the outer 
margin.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Andre Nathan
> Sent: Wednesday, May 27, 2009 1:40 PM
> To: r-help@r-project.org
> Subject: [R] Axis label spanning multiple plots
> 
> Hello
> 
> I need to plot 3 graphs in a single column; the top two plots have the
> same title, and I would like it to be written only once, centered
> horizontally and spanning the two plots. Something like
> 
> 
>   t ++
> ||
>   i ||
> ||
>   t ++
> 
>   l ++
> ||
>   e ||
> ||
>   1 ++
> 
>   t ++
>   i ||
>   t ||
>   l ||
>   e ||
>   2 ++
> 
>x-title
> 
> Is there a parameter which allows me to do that automatically, or
> should
> I use text() and position the title manually?
> 
> Thanks in advance,
> Andre
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] r-plot 2nd attempt

2009-05-27 Thread Gavin Simpson
On Wed, 2009-05-27 at 06:06 -0700, durden10 wrote:
> First of all, thanks a lot for your quick & helpful comments!
> 
> I have come down to this:
> 
> Win<- c(-0.005276404,  0.081894394, -0.073461539,  0.184371967, 
> 0.133189670, -0.006239016,  -0.063616699,  0.196754234,  0.402148743, 
> 0.104408425,
> 0.036910154,  0.195227863,  0.212743723,  0.280889666,  0.300277802)
> Calgary<- c(5,  8, 11,  3,  7,  4,  7,  1,  3,  6,  3,  2,  8,  0,  1)
> 
> data_corr <- data.frame(Win,Calgary)
> plot(data_corr, type = "p", axes=FALSE,  col = "blue", lwd = 2)
> 
> #y-axis
> axis(2, tcl=0.35,seq(1,11,by=2))
> 
> #x-axis
> axis(1, tcl=0.35,seq(-0.1,0.5,by=0.1))
> box()
> 
> abline(lm(data_corr[,2]~data_corr[,1]))
> 
> It works for the y-axis, but unfortunately, the x-axis is still not working:
> It starts at 0 and end at 0.4, but it should start at -0.1

Why? Your data extend to ~-0.07.

> , as mentioned in
> the code (cf picture) :confused: 
> http://www.nabble.com/file/p23742121/Rplots_2.png 

You didn't adjust the x-axis limits to tell R that you wanted -0.1 to be
include on the lower end of the axis. R isn't clairvoyant you know!

I've tidied your script and altered it to extend the x-axis a bit so
that -0.1 is included:

Win <- c(-0.005276404,  0.081894394, -0.073461539, 0.184371967, 
 0.133189670, -0.006239016, -0.063616699, 0.196754234,  
 0.402148743, 0.104408425, 0.036910154, 0.195227863, 
 0.212743723, 0.280889666, 0.300277802)
Calgary<- c(5,  8, 11,  3,  7,  4,  7,  1,  3,  6,  3,  2,  8,  0,  1)

data_corr <- data.frame(Win, Calgary)
plot(Calgary ~ Win, data = data_corr, type = "p", axes = FALSE,  
 col = "blue", lwd = 2, xlim = c(-0.1,0.5))
##  ^^
axis(2, tcl = 0.35, seq(1, 11, by=2))
axis(1, tcl = 0.35, seq(-0.1, 0.5, by=0.1))
box()
abline(lm(Calgary ~ Win, data = data_corr))

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how do I get to be a member?

2009-05-27 Thread Ted Harding
On 27-May-09 18:09:30, Michael Menke wrote:
> Information, please.

By subscribing your email address to the list.
Visit the R-help info page at:

  https://stat.ethz.ch/mailman/listinfo/r-help

and read what it has to say in general about R-help. Near the bottom
is a section "Subscribing to R-help" which tells you what to do.

Please note that it is *email addresses*, not persons, which are
subscribed, so (if you have more than one email address ) you should
use the one which you have subscribed when you want to post to the list.

Hoping this helps,
Ted.


E-Mail: (Ted Harding) 
Fax-to-email: +44 (0)870 094 0861
Date: 27-May-09   Time: 20:35:02
-- XFMail --

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Axis label spanning multiple plots

2009-05-27 Thread Andre Nathan
Hello

I need to plot 3 graphs in a single column; the top two plots have the
same title, and I would like it to be written only once, centered
horizontally and spanning the two plots. Something like


  t ++
||
  i ||
||
  t ++
  
  l ++
||
  e ||
||
  1 ++

  t ++
  i ||
  t ||
  l ||
  e ||
  2 ++

   x-title

Is there a parameter which allows me to do that automatically, or should
I use text() and position the title manually?

Thanks in advance,
Andre

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R Books listing on R-Project

2009-05-27 Thread G. Jay Kerns
Hello Stavros,

On Wed, May 27, 2009 at 2:53 PM, Stavros Macrakis  wrote:
> I was wondering what the criteria were for including books on the Books
> Related to R page . (There is
> no maintainer listed on this page.)
>
> In particular, I was wondering why the following two books are not listed:
>
> * Andrew Gelman, Jennifer Hill, *Data Analysis Using Regression and
> Multilevel/Hierarchical Models*. (CRAN package 'arm')
>
> * Michael J. Crawley, *The R Book*. (reviewed, rather negatively, in *R News
> * *7*:2)
>
> Is the list more or less arbitrary?  Does it reflect some editorial judgment
> about the value of these books? If so, it might be more useful to include
> the books, but with critical reviews.  It doesn't seem to be a matter of
> up-to-dateness, because 38/87 of the listed books were published in a more
> recent year than Gelman or Crawley.
>
> The list is currently in reverse chronological order.  I wonder if it would
> be useful to group the entries thematically -- I'd be happy to help on that
> project.
>

I had a similar idea in 2008 for the R-wiki:

http://tolstoy.newcastle.edu.au/R/e5/devel/08/10/0481.html

There were no responses and I ran out of time to continue working on
it myself.  If you are interested in proceeding along these lines then
I have some more ideas and would be willing to help...  or, perhaps
you (or somebody else) knows of an even better approach.

Cheers
Jay








***
G. Jay Kerns, Ph.D.
Associate Professor
Department of Mathematics & Statistics
Youngstown State University
Youngstown, OH 44555-0002 USA
Office: 1035 Cushwa Hall
Phone: (330) 941-3310 Office (voice mail)
-3302 Department
-3170 FAX
E-mail: gke...@ysu.edu
http://www.cc.ysu.edu/~gjkerns/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] alternative to built-in data editor

2009-05-27 Thread Greg Snow
Have you tried the View function (note the uppercase V).

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Jose Quesada
> Sent: Wednesday, May 27, 2009 11:25 AM
> To: r-help@r-project.org
> Subject: [R] alternative to built-in data editor
> 
> Hi all,
> 
> I often have to peek at large data.
> While head and tail are convenient, at times I'd like some more
> comprehensive.
> I guess I debug better in a more visual way?
> I was wondering if there's a way to override the default data editor.
> I could of course dump to a txt file, and look at it with an
> editor/spreadsheet, but after doing it a few times, it gets boring.
> Maybe it's time for me to write a function to automatize the process?
> I'd ask first in case there's an easier way.
> 
> Thanks!
> -Jose
> 
> --
> Jose Quesada, PhD.
> Max Planck Institute,
> Center for Adaptive Behavior and Cognition -ABC-,
> Lentzeallee 94, office 224, 14195 Berlin
> http://www.josequesada.name/
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] "Error: package/namespace load failed"

2009-05-27 Thread Martin Morgan
Rebecca Sela wrote:
> I am writing my first R package, and I have been getting the following series 
> of errors when I run R CMD check:
> 
> * checking S3 generic/method consistency ... WARNING
> Error: package/namespace load failed for 'REEMtree'
> Call sequence:
> 2: stop(gettextf("package/namespace load failed for '%s'", 
> libraryPkgName(package)), 
>call. = FALSE, domain = NA)
> 1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE)
> Execution halted
> See section 'Generic functions and methods' of the 'Writing R Extensions'
> manual.
> * checking replacement functions ... WARNING
> Error: package/namespace load failed for 'REEMtree'
> Call sequence:
> 2: stop(gettextf("package/namespace load failed for '%s'", 
> libraryPkgName(package)), 
>call. = FALSE, domain = NA)
> 1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE)
> Execution halted
> In R, the argument of a replacement function which corresponds to the right
> hand side must be named 'value'.
> * checking foreign function calls ... WARNING
> Error: package/namespace load failed for 'REEMtree'
> Call sequence:
> 2: stop(gettextf("package/namespace load failed for '%s'", 
> libraryPkgName(package)), 
>call. = FALSE, domain = NA)
> 1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE)
> Execution halted
> See section 'System and foreign language interfaces' of the 'Writing R
> Extensions' manual.
> * checking Rd files ... OK
> * checking for missing documentation entries ... ERROR
> Error: package/namespace load failed for 'REEMtree'
> 
> (Everything is OK up to this point.)
> 
> Looking around online, I have found references to this error when there is 
> compiled C or Fortran code, but I have none of that in my code.  I imagine 
> this is a simple problem (perhaps with my NAMESPACE file), but I don't know 
> what it is.  (The text of the NAMESPACE file is at the bottom of this e-mail.)

Hi Rebecca -- useDynLib() is to load the dynamic library associated with
C or Fortran code. You say you have none of this, so you don't need
useDynLib(REEMtree).

Martin

> Thank you in advance for your help!
> 
> Rebecca
> 
> NAMESPACE file:
> 
> useDynLib(REEMtree)
> 
> export(AutoCorrelationLRtest, FixedEffectsTree, RandomEffectsTree, 
>   LMEpredict, PredictionTest, RandomEffectsTree, RMSE, simpleREEMdata, 
>   REEMtree, FEEMtree)
> 
> import(nlme)
> import(rpart)
> 
> S3method(is,REEMtree)
> S3method(logLik,REEMtree)
> S3method(plot,REEMtree)
> S3method(predict,REEMtree)
> S3method(print, REEMtree)
> S3method(ranef,REEMtree)
> S3method(tree,REEMtree)
> S3method(is,FEEMtree)
> S3method(logLik,FEEMtree)
> S3method(plot,FEEMtree)
> S3method(predict,FEEMtree)
> S3method(print, FEEMtree)
> S3method(tree,FEEMtree)
> 
> 
> 
> 
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Still can't find missing data

2009-05-27 Thread Farley, Robert
I can't get the syntax that will allow me to show NA values (rows) in the xtabs.

> # unfortunatly I don't see how to get that to run
> XTTable <- xtabs(wt_annual ~  Mode_orig_only + connector, exclude=NULL, 
> na.action(na.pass), LAWAData)
Error in eval(expr, envir, enclos) : object "wt_annual" not found
> XTTable <- xtabs(wt_annual ~  Mode_orig_only + connector, exclude=NULL, 
> na.action(na.pass), drop.unused.levels = FALSE, LAWAData)
Error in eval(expr, envir, enclos) : object "wt_annual" not found
> XTTable <- xtabs(wt_annual ~  Mode_orig_only + connector, na.action(na.pass), 
> LAWAData)
Error in eval(expr, envir, enclos) : object "wt_annual" not found
> XTTable <- xtabs(wt_annual ~  Mode_orig_only + connector, 
> na.action(na.pass),drop.unused.levels = FALSE, LAWAData)
Error in eval(expr, envir, enclos) : object "wt_annual" not found
> #
> ###  Those combinations that run w/o error give misleading results
> XTTable <- xtabs(wt_annual ~  Mode_orig_only + connector, exclude=NULL,  
> LAWAData)
> XTTable
  connector
Mode_orig_only OD Passenger
Connector
  Walked/Biked17.814338 
0.00
   I flew in from another a place/connected0.00 
0.00
  Amtrak  49.128982 
0.00
  Bus - Chartered bus or van 525.978899 
0.00
  Bus - Hotel Courtesy van   913.295370 
0.00
  Bus - MTA (Metro) or other public transit bus  114.302764 
0.00
  Bus - Scheduled airport bus or van (e.g. Airport bus or Disn   298.151438 
0.00
  Bus - Union Station Flyaway 93.088049 
0.00
  Bus - Van Nuys Flyaway 233.794168 
0.00
  Green line/light rail   20.764539 
0.00
  Limousine/town car 424.120506 
0.00
  Metrolink8.054528 
0.00
  Motorcycle   6.010790 
0.00
  On-call shuttle/van (e.g. Super Shuttle, Prime Time)  1832.748525 
0.00
  Car/truck/van - Private  10191.284139 
0.00
  Car/truck/van - Rental2099.771923 
0.00
  Taxi  1630.148576 
0.00
  ..Refused0.00 
0.00
> XTTable <- xtabs(wt_annual ~  Mode_orig_only + connector, drop.unused.levels 
> = FALSE, LAWAData)
> XTTable
  connector
Mode_orig_only OD Passenger
Connector
  Walked/Biked17.814338 
0.00
   I flew in from another a place/connected0.00 
0.00
  Amtrak  49.128982 
0.00
  Bus - Chartered bus or van 525.978899 
0.00
  Bus - Hotel Courtesy van   913.295370 
0.00
  Bus - MTA (Metro) or other public transit bus  114.302764 
0.00
  Bus - Scheduled airport bus or van (e.g. Airport bus or Disn   298.151438 
0.00
  Bus - Union Station Flyaway 93.088049 
0.00
  Bus - Van Nuys Flyaway 233.794168 
0.00
  Green line/light rail   20.764539 
0.00
  Limousine/town car 424.120506 
0.00
  Metrolink8.054528 
0.00
  Motorcycle   6.010790 
0.00
  On-call shuttle/van (e.g. Super Shuttle, Prime Time)  1832.748525 
0.00
  Car/truck/van - Private  10191.284139 
0.00
  Car/truck/van - Rental2099.771923 
0.00
  Taxi  1630.148576 
0.00
  ..Refused0.00 
0.00
> XTTable <- xtabs(wt_annual ~  Mode_orig_only + connector, exclude=NULL, 
> drop.unused.levels = FALSE, LAWAData)
> XTTable
  connector
Mode_orig_only OD Passenger
Connector
  Walked/

Re: [R] Factor level with no cases shows up in a plot

2009-05-27 Thread krzysztof . sakrejda
If you have a vector of factors with empty levels you can get rid of them by 
rerunning the vector through the factor function:

vec <- factor(vec)

Don't know if this can be done at plotting time...
Sent via BlackBerry by AT&T

-Original Message-
From: "Arthur Burke" 

Date: Wed, 27 May 2009 11:46:12 
To: 
Subject: [R] Factor level with no cases shows up in a plot


Consider this data structure  (df1) ...
 
  Group Year PctProf FullYr
1  Never RF 2004  87 88
2  Cohort 1 2004  83 84
3  Cohort 2 2004  84 86
4  Cohort 3 2004  87 87
5  Cohort 4 2004  73 74
6  Never RF 2005  85 86
7  Cohort 1 2005  81 82
8  Cohort 2 2005  81 81
9  Cohort 3 2005  78 79
10 Cohort 4 2005  72 74
11 Never RF 2006  83 84
12 Cohort 1 2006  78 78
13 Cohort 2 2006  78 79
14 Cohort 3 2006  70 71
15 Cohort 4 2006  80 82
16 Never RF 2007  82 83
17 Cohort 1 2007  75 76
18 Cohort 2 2007  73 74
19 Cohort 3 2007  79 80
20 Cohort 4 2007  75 77
21 Never RF 2008  83 84
22 Cohort 1 2008  81 81
23 Cohort 2 2008  81 81
24 Cohort 3 2008  76 77
25 Cohort 4 2008  62 63

 which I subsetted to omit all cases for Cohort 4 and some cases for
Cohorts 2 & 3 ...
 
df2 <- subset(df1,
((Group == "Cohort 1" | Group == "Never RF") | (Group == "Cohort 2"
& Year != 2004) |
  (Group == "Cohort 3" & Year > 2006)))
 
> df2
  Group Year PctProf FullYr
1  Never RF 2004  87 88
2  Cohort 1 2004  83 84
6  Never RF 2005  85 86
7  Cohort 1 2005  81 82
8  Cohort 2 2005  81 81
11 Never RF 2006  83 84
12 Cohort 1 2006  78 78
13 Cohort 2 2006  78 79
16 Never RF 2007  82 83
17 Cohort 1 2007  75 76
18 Cohort 2 2007  73 74
19 Cohort 3 2007  79 80
21 Never RF 2008  83 84
22 Cohort 1 2008  81 81
23 Cohort 2 2008  81 81
24 Cohort 3 2008  76 77

Now, 
 
> table(df2$Group)
 
... properly shows 0 cases for the Group level "cohort 4" ...
 
Cohort 1 Cohort 2 Cohort 3 Cohort 4 Never RF 
   54205 

But when I plot ...
 
coll = c("violet","blue","green","red")

with(df2, interaction.plot(Year, Group, FullYr,
 lwd=3,col=coll, bty="l", lty=1, las=1,
 ylab="Percent Proficient", xlab="",
 main = "Proficiency Trends for RF and Non-RF Schools"))
 
...  I get the four lines that I expected but the legend includes the
Group level "cohort 4" .
 
How can I get rid of "cohort 4" in Group?
 
Thanks!
Art

--

Art Burke
Northwest Regional Educational Laboratory
101 SW Main St, Suite 500
Portland, OR 97204-3213

Phone:  503-275-9592 / 800-547-6339

Fax: 503-275-0450

bur...@nwrel.org 




  


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R Books listing on R-Project

2009-05-27 Thread Stavros Macrakis
I was wondering what the criteria were for including books on the Books
Related to R page . (There is
no maintainer listed on this page.)

In particular, I was wondering why the following two books are not listed:

* Andrew Gelman, Jennifer Hill, *Data Analysis Using Regression and
Multilevel/Hierarchical Models*. (CRAN package 'arm')

* Michael J. Crawley, *The R Book*. (reviewed, rather negatively, in *R News
* *7*:2)

Is the list more or less arbitrary?  Does it reflect some editorial judgment
about the value of these books? If so, it might be more useful to include
the books, but with critical reviews.  It doesn't seem to be a matter of
up-to-dateness, because 38/87 of the listed books were published in a more
recent year than Gelman or Crawley.

The list is currently in reverse chronological order.  I wonder if it would
be useful to group the entries thematically -- I'd be happy to help on that
project.

  -s

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Factor level with no cases shows up in a plot

2009-05-27 Thread Arthur Burke
Consider this data structure  (df1) ...
 
  Group Year PctProf FullYr
1  Never RF 2004  87 88
2  Cohort 1 2004  83 84
3  Cohort 2 2004  84 86
4  Cohort 3 2004  87 87
5  Cohort 4 2004  73 74
6  Never RF 2005  85 86
7  Cohort 1 2005  81 82
8  Cohort 2 2005  81 81
9  Cohort 3 2005  78 79
10 Cohort 4 2005  72 74
11 Never RF 2006  83 84
12 Cohort 1 2006  78 78
13 Cohort 2 2006  78 79
14 Cohort 3 2006  70 71
15 Cohort 4 2006  80 82
16 Never RF 2007  82 83
17 Cohort 1 2007  75 76
18 Cohort 2 2007  73 74
19 Cohort 3 2007  79 80
20 Cohort 4 2007  75 77
21 Never RF 2008  83 84
22 Cohort 1 2008  81 81
23 Cohort 2 2008  81 81
24 Cohort 3 2008  76 77
25 Cohort 4 2008  62 63

... which I subsetted to omit all cases for Cohort 4 and some cases for
Cohorts 2 & 3 ...
 
df2 <- subset(df1,
((Group == "Cohort 1" | Group == "Never RF") | (Group == "Cohort 2"
& Year != 2004) |
  (Group == "Cohort 3" & Year > 2006)))
 
> df2
  Group Year PctProf FullYr
1  Never RF 2004  87 88
2  Cohort 1 2004  83 84
6  Never RF 2005  85 86
7  Cohort 1 2005  81 82
8  Cohort 2 2005  81 81
11 Never RF 2006  83 84
12 Cohort 1 2006  78 78
13 Cohort 2 2006  78 79
16 Never RF 2007  82 83
17 Cohort 1 2007  75 76
18 Cohort 2 2007  73 74
19 Cohort 3 2007  79 80
21 Never RF 2008  83 84
22 Cohort 1 2008  81 81
23 Cohort 2 2008  81 81
24 Cohort 3 2008  76 77

Now, 
 
> table(df2$Group)
 
... properly shows 0 cases for the Group level "cohort 4" ...
 
Cohort 1 Cohort 2 Cohort 3 Cohort 4 Never RF 
   54205 

But when I plot ...
 
coll = c("violet","blue","green","red")

with(df2, interaction.plot(Year, Group, FullYr,
 lwd=3,col=coll, bty="l", lty=1, las=1,
 ylab="Percent Proficient", xlab="",
 main = "Proficiency Trends for RF and Non-RF Schools"))
 
...  I get the four lines that I expected but the legend includes the
Group level "cohort 4" .
 
How can I get rid of "cohort 4" in Group?
 
Thanks!
Art

--

Art Burke
Northwest Regional Educational Laboratory
101 SW Main St, Suite 500
Portland, OR 97204-3213

Phone:  503-275-9592 / 800-547-6339

Fax: 503-275-0450

bur...@nwrel.org 




  


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reduce size of plot inside window and place legend beside plot

2009-05-27 Thread baptiste auguie

Try this and see if it helps (if not, please help improving it),

http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:legendoutside


HTH,

baptiste

On 27 May 2009, at 20:31, Wade Wall wrote:


Hi all,

I have been trying to figure out how to place a legend beside a plot,
rather than within the space to no avail.  I am assuming that I need
to resize the plot relative to the window.

If anyone has any guidance on how to do this, I would greatly  
appreciate it.


Wade

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] ggplot2 adding vertical line at a certain date

2009-05-27 Thread stephen sefick
library(ggplot2)

melt.updn <- (structure(list(date = structure(c(11808, 11869, 11961, 11992,
12084, 12173, 12265, 12418, 12600, 12631, 12753, 12996, 13057,
13149, 11808, 11869, 11961, 11992, 12084, 12173, 12265, 12418,
12600, 12631, 12753, 12996, 13057, 13149), class = "Date"), variable =
structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("unrestored",
"restored"), class = "factor"), value = c(1.1080259671261, 0.732188576856918,
0.410334408061265, 0.458980396410056, 0.429867902470711, 0.83126337241925,
0.602008712602784, 0.818751283264408, 1.12606382402475, 0.246174719479079,
0.941043753226865, 0.986511619794787, 0.291074883642735, 0.346361775752625,
1.36209038621623, 0.878561166753624, 0.525156715576168, 0.80305564765846,
1.08084449441812, 1.24906568558731, 0.970954515841768, 0.936838439269239,
1.26970090246036, 0.337831520417547, 0.909204325710795, 0.951009811036613,
0.290735620653709, 0.426683515714219)), .Names = c("date", "variable",
"value"), row.names = c(NA, -28L), class = "data.frame"))

qplot(date, value, data=melt.updn, shape=variable)+geom_smooth()

#I would like to add a line at November 1, 2002
#thanks for the help

-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] reduce size of plot inside window and place legend beside plot

2009-05-27 Thread Wade Wall
Hi all,

I have been trying to figure out how to place a legend beside a plot,
rather than within the space to no avail.  I am assuming that I need
to resize the plot relative to the window.

If anyone has any guidance on how to do this, I would greatly appreciate it.

Wade

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] how do I get to be a member?

2009-05-27 Thread Michael Menke

Information, please.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] no internal function "int.unzip" in R 2.9.0 for Windows

2009-05-27 Thread Romain Francois

Hi,

I'll try to fix this soon. Could you log a bug request here:
http://r-forge.r-project.org/tracker/?atid=1643&group_id=405&func=browse

Regards,

Romain

Carson, John wrote:

library(R2HTML)



Loading required package: R2HTML

Error in .Internal(int.unzip(zipname, NULL, dest)) : 


  no internal function "int.unzip"

Error : .onLoad failed in 'loadNamespace' for 'R2HTML'

Error: package 'R2HTML' could not be loaded

Version: R 2.9.0 for Windows
  



--
Romain Francois
Independent R Consultant
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] interpretation of the likelihood ratio test under *R* GLM

2009-05-27 Thread Michael Menke
Can anyone tell me how the LRT is to be interpreted under the glm 
package when using glm for logistic regression with mutiple predictors?


family=binomial("logit"))
 drop1(Confidence.glm, test="Chisq")

The summary z-table suggests a direction of the effect, and notably the 
large LRT statistics are the significant ones. I am used to thinking of 
extremely small LRTs as significant (negative natural logarithms of 
LRTs). I must assume that the LRT in *R* is alternative hypothesis over 
null hypothesis, rather than the convention I learned of 
null/alternative, where a small number (negative logLR) represents 
strong evidence and zero/zed evidence is represented by an LR of 1 
(logLR = 0). Comments? Am I interpreting this correctly?


J. Michael Menke
University of Arizona

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] a simple trick to get autoclose parenthesis on windows

2009-05-27 Thread Jose Quesada
Hi,

This is a simple trick to get autoclose parenthesis on windows.
If you like how StatET autocloses parens, but like to use the lighter
Vanilla R, you can use autohotkey (http://autohotkey.net) to provide
this functionality.

Simply put the below code in a text file, rename extension as .ahk and
doubleclick on it to execute.


-- code starts here 8< --


; Vanilla R
; =
#IfWinActive, ahk_class Rgui
; autoclose parens
(::Send (){left}
"::Send ""{left}
return

-- code ends here 8< --

Silly, but I find it very convenient.

Best,
-Jose

-- 
Jose Quesada, PhD.
Max Planck Institute,
Center for Adaptive Behavior and Cognition -ABC-, 
Lentzeallee 94, office 224, 14195 Berlin
http://www.josequesada.name/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] problem with cbind

2009-05-27 Thread kayj

Hi All,

I have a file with two columns, the first column has the names of the
patients and the second column has the age. I am looking into creating an
output file that looks like 

1-1010-20etc
EricChris
Bob mat
Andrew
Suzan


Where each column has the name of the patients in a given age category that
is displayed in the header. For example in the output, the first column has
the name of the patients with age between 1 to 10.

The problem that I am having is that I can not use cbind since the length of
the vectors is different. Is there a way to create such a file?

Thanks for your help



-- 
View this message in context: 
http://www.nabble.com/problem-with-cbind-tp23747075p23747075.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] invert axis persp plot

2009-05-27 Thread Jack Siegrist
Hello folks,

Is there a way to invert the z axis in a 'persp' plot?

I tried using 'zlim=rev(range(z))', which would work with 'plot' but does
not work in this case.

Thank you for your help.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loop avoidance and logical subscripts

2009-05-27 Thread retama

Thank you! The script is now adapted to Biostrings and it is really fast! For
example, it does:

   alph_sequence <- alphabetFrequency(data$sequence, baseOnly=TRUE)
   data$GCsequence <- rowSums(alph_sequence[,c("G", "C")]) /
rowSums(alph_sequence)

in the G+C computation. It also works amazingly fast in substring extraction
(substring), reverse complement (reverseComplement sequences), palindromes
search (findComplementedPalindromes) and so on.

Now, my bottleneck is conventional string handling, because I have not found
yet how to convert DNAStringSets to vector of chars. Now, I'm doing it by:

   dna <- vector()
for (i in 1:length(dnaset)) {
c(dna, toString(data$dnaset[[i]])) -> dna
}

Regards,

Retama








-- 
View this message in context: 
http://www.nabble.com/Loop-avoidance-and-logical-subscripts-tp23652935p23745814.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] RWeka weka.core.SerializationHelper.write

2009-05-27 Thread Christian

Hi,

is it possible to use the writer method from the  
weka.core.SerializationHelper class in R?

When yes, what could be wrong in my trial.

many thanks
Christian

.jmethods("weka/core/SerializationHelper")
[2] "public static void 
weka.core.SerializationHelper.write(java.lang.String,java.lang.Object) 
throws java.lang.Exception"  
> NB <- make_Weka_classifier("weka/classifiers/bayes/NaiveBayes")

> data("HouseVotes84", package = "mlbench")
> model <- NB(Class ~ ., data = HouseVotes84)
>
> 
.jcall("weka/core/SerializationHelper",returnSig="V","write","nb.model",model) 

Fehler in .jcall("weka/core/SerializationHelper", returnSig = "V", 
"write",  :

method write with signature (Ljava/lang/String;)V not found

> 
.jcall("weka/core/SerializationHelper",returnSig="V","write","nb.model",model$classifier) 

Fehler in .jcall("weka/core/SerializationHelper", returnSig = "V", 
"write",  :
method write with signature 
(Ljava/lang/String;Lweka/classifiers/bayes/NaiveBayes;)V not found


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] RWeka weka.core.SerializationHelper.write

2009-05-27 Thread Christian

Hi,

is it possible to use the writer method from the  
weka.core.SerializationHelper class in R?

What could be wrong in my trial.

many thanks
Christian

.jmethods("weka/core/SerializationHelper")
[2] "public static void 
weka.core.SerializationHelper.write(java.lang.String,java.lang.Object) 
throws java.lang.Exception"   


> NB <- make_Weka_classifier("weka/classifiers/bayes/NaiveBayes")
> data("HouseVotes84", package = "mlbench")
> model <- NB(Class ~ ., data = HouseVotes84)
>
> 
.jcall("weka/core/SerializationHelper",returnSig="V","write","nb.model",model)
Fehler in .jcall("weka/core/SerializationHelper", returnSig = "V", 
"write",  :

 method write with signature (Ljava/lang/String;)V not found

> 
.jcall("weka/core/SerializationHelper",returnSig="V","write","nb.model",model$classifier)
Fehler in .jcall("weka/core/SerializationHelper", returnSig = "V", 
"write",  :
 method write with signature 
(Ljava/lang/String;Lweka/classifiers/bayes/NaiveBayes;)V not found


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Neural Network resource

2009-05-27 Thread Tony Breyal
I haven't used the AMORE package before, but it sounds like you
haven't set linear output units or something. Here's an example using
the nnet package of what you're doing i think:

### R START###
> # set random seed to a cool number
> set.seed(42)
>
> # set up data
> x1<-rnorm(100); x2<-rnorm(100); x3<-rnorm(100)
> x4<-rnorm(100); x5<-rnorm(100); x6<-rnorm(100)
> b1<-1; b2<-2; b3<-3
> b4<-4; b5<-5; b6<-6
> y<-b1*x1 + b2*x2 + b3*x3 + b4*x4 + b5*x5 + b6*x6
> my.df <- data.frame(cbind(y, x1, x2, x3, x4, x5, x6))
>
> # 1. linear regression
> my.lm <- lm(y~., data=my.df)
>
> # look at correlation
> my.lm.predictions<-predict(my.lm)
> cor(my.df["y"], my.lm.predictions)
  [,1]
y1
>
> # 2. nnet
> library(nnet)
> my.nnet<-nnet(y~., data=my.df, size=3,
 linout=TRUE, skip=TRUE,
 trace=FALSE, maxit=1000)
>
> my.nnet.predictions<-predict(my.nnet, my.df)
> # look at correlation
> cor(my.df["y"], my.nnet.predictions)
  [,1]
y1
>
> # to look at the values side by side
> cbind(my.df["y"], my.nnet.predictions)
   y my.nnet.predictions
110.60102566 10.59958907
2 6.70939465  6.70956529
3 2.28934732  2.28928930
414.51012458 14.51043732
5   -12.85845371-12.85849345
[..etc]
### R END ###

Hope that helps a wee bit mate,

Tony Breyal


On 27 May, 15:36, Indrajit Sengupta  wrote:
> You are right there is a pdf file which describes the function. But let tell 
> you where I am coming from.
>
> Just to test if a neural network will work better than a ordinary least 
> square regression, I created a dataset with one dependent variable and 6 
> other independent variables. Now I had deliberately created the dataset in 
> such manner that we have an excellent regression model. Eg: Y = b0 + b1*x1 + 
> b2*x2 + b3*x3.. + b6*x6 + e
> where e is normal random variable. Naturally any statistical analysis system 
> running regression would easily predict the values of b1, b2, b3, ..., b6 
> with around 30-40 observations.
>
> I fed this data into a Neural network (3 hidden layers with 6 neurons in each 
> layer) and trained the network. When I passed the input dataset and tried to 
> get the predictions, all the predicted values were identical! This confused 
> me a bit and was wondering whether my understanding of the Neural Network was 
> wrong.
>
> Have you ever faced anything like it?
>
> Regards,
> Indrajit
>
> 
> From: "markle...@verizon.net" 
>
> Sent: Wednesday, May 27, 2009 7:54:59 PM
> Subject: Re: [R] Neural Network resource
>
> Hi: I've never used that package but most likely there is a  AMORE vignette 
> that shows examples and describes the functions.
> it should be on the same cran  web page where the package resides, in pdf 
> form.
>
> Hi All,
>
> I am trying to learn Neural Networks. I found that R has packages which can 
> help build Neural Nets - the popular one being AMORE package. Is there any 
> book / resource available which guides us in this subject using the AMORE 
> package?
>
> Any help will be much appreciated.
>
> Thanks,
> Indrajit
>
> __
> r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>         [[alternative HTML version deleted]]
>
> __
> r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] r-plot 2nd attempt

2009-05-27 Thread durden10

First of all, thanks a lot for your quick & helpful comments!

I have come down to this:

Win<- c(-0.005276404,  0.081894394, -0.073461539,  0.184371967, 
0.133189670, -0.006239016,  -0.063616699,  0.196754234,  0.402148743, 
0.104408425,
  0.036910154,  0.195227863,  0.212743723,  0.280889666,  0.300277802)
Calgary<- c(5,  8, 11,  3,  7,  4,  7,  1,  3,  6,  3,  2,  8,  0,  1)

data_corr <- data.frame(Win,Calgary)
plot(data_corr, type = "p", axes=FALSE,  col = "blue", lwd = 2)

#y-axis
axis(2, tcl=0.35,seq(1,11,by=2))

#x-axis
axis(1, tcl=0.35,seq(-0.1,0.5,by=0.1))
box()

abline(lm(data_corr[,2]~data_corr[,1]))

It works for the y-axis, but unfortunately, the x-axis is still not working:
It starts at 0 and end at 0.4, but it should start at -0.1, as mentioned in
the code (cf picture) :confused: 
http://www.nabble.com/file/p23742121/Rplots_2.png 

-- 
View this message in context: 
http://www.nabble.com/r-plot-tp23739356p23742121.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R-beta: Re:Stats Seminar 18/02/98

2009-05-27 Thread Roland Chariatte
Bonjour,
Je recherche une ancienne amie qui porte le nom de Marylin Gabriel originaire 
des Seychelles et que j'ai perdu de vue il y à environ 20 ans.
Si cette adresse e-mail est la tienne, tu te souviendra très bien de moi, 
j'aimerais beaucoup te revoir car j'ai de superbes souvenirs de toi.
Peut être à bientôt.
Je suis toujours le même Roland Chariatte de Delémont que tu as connu en 1986 
ou 87.

RCline
Roland CHARIATTE

rue de la Croix 27 

2822 COURROUX

Switzerland
Mobile   +41 (0)78 648 19 68

i...@rcline.ch

www.rcline.ch 
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] alternative to built-in data editor

2009-05-27 Thread Peter Dalgaard

Jose Quesada wrote:

Hi all,

I often have to peek at large data.
While head and tail are convenient, at times I'd like some more
comprehensive.
I guess I debug better in a more visual way?
I was wondering if there's a way to override the default data editor.
I could of course dump to a txt file, and look at it with an
editor/spreadsheet, but after doing it a few times, it gets boring.
Maybe it's time for me to write a function to automatize the process?
I'd ask first in case there's an easier way.

Thanks!
-Jose



There's a tcltk-based data viewer in John Fox' Rcmdr package. Not sure 
it does what you want, but check it out.



--
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Neural Network resource

2009-05-27 Thread Indrajit Sengupta

Here is the code that i had used:

#


## Read in the raw data
fitness <- c(44,89.47,44.609,11.37,62,178,182,
40,75.07,45.313,10.07,62,185,185,
44,85.84,54.297,8.65,45,156,168,
42,68.15,59.571,8.17,40,166,172,
38,89.02,49.874,9.22,55,178,180,
47,77.45,44.811,11.63,58,176,176,
40,75.98,45.681,11.95,70,176,180,
43,81.19,49.091,10.85,64,162,170,
44,81.42,39.442,13.08,63,174,176,
38,81.87,60.055,8.63,48,170,186,
44,73.03,50.541,10.13,45,168,168,
45,87.66,37.388,14.03,56,186,192,
45,66.45,44.754,11.12,51,176,176,
47,79.15,47.273,10.6,47,162,164,
54,83.12,51.855,10.33,50,166,170,
49,81.42,49.156,8.95,44,180,185,
51,69.63,40.836,10.95,57,168,172,
51,77.91,46.672,10,48,162,168,
48,91.63,46.774,10.25,48,162,164,
49,73.37,50.388,10.08,67,168,168,
57,73.37,39.407,12.63,58,174,176,
54,79.38,46.08,11.17,62,156,165,
52,76.32,45.441,9.63,48,164,166,
50,70.87,54.625,8.92,48,146,155,
51,67.25,45.118,11.08,48,172,172,
54,91.63,39.203,12.88,44,168,172,
51,73.71,45.79,10.47,59,186,188,
57,59.08,50.545,9.93,49,148,155,
49,76.32,48.673,9.4,56,186,188,
48,61.24,47.92,11.5,52,170,176,
52,82.78,47.467,10.5,53,170,172
)
fitness2 <- data.frame(matrix(fitness,nrow = 31, byrow = TRUE))
colnames(fitness2) <- 
c("Age","Weight","Oxygen","RunTime","RestPulse","RunPulse","MaxPulse")
attach(fitness2)
## Create the input dataset
indep <- fitness2[,-3]
## Create the neural network structure 
net.start <- newff(n.neurons=c(6,6,6,1),  
 learning.rate.global=1e-2,    
 momentum.global=0.5,  
 error.criterium="LMS",   
 Stao=NA, hidden.layer="tansig",   
 output.layer="purelin",   
 method="ADAPTgdwm")
## Train the net
result <- train(net.start, indep, Oxygen, error.criterium="LMS", report=TRUE, 
show.step=100, n.shows=5 ) 
## Predict
pred <- sim(result$net, indep)
pred 
### 

Here I am trying to predict Oxygen levels using the 6 independent 
variables. But whenever I am trying to run a prediction - I am getting constant 
values throughout (In the above example - the values of pred).

Thanks & Regards,
Indrajit

 


- Original Message 
From: Max Kuhn 
To: Indrajit Sengupta 
Cc: markle...@verizon.net; R Help 
Sent: Wednesday, May 27, 2009 9:19:47 PM
Subject: Re: [R] Neural Network resource

> I fed this data into a Neural network (3 hidden layers with 6 neurons in each 
> layer) and trained the network. When I passed the input dataset and tried to 
> get the predictions, all the predicted values were identical! This confused 
> me a bit and was wondering whether my understanding of the Neural Network was 
> wrong.
>
> Have you ever faced anything like it?

You should really provide code for us to help. I would initially
suspect that you didn't use a linear function between your hidden
units and the outcomes.

Also, using 3 hidden layers and 6 units per layer is a bit much for
your data set (30-40 samples). You will probably end up overfitting.

-- 

Max





__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] contour lines on persp plot

2009-05-27 Thread Jack Siegrist
Hello folks,

I am a beginner R user. I have been able to make a 3D surface plot using
'persp'. The surface is made by a grid of lines emanating perpendicularly
from each of the x and y axes at regular intervals.

I can get rid of that grid by setting 'border=NA'.

Can anyone suggest some ways to replace the grid with contour lines, to
create a 3-dimensional contour map?

Thanks for any help.

Here is an example of what I have so far:

#to create a perspective plot; plots funct. across all combos of x and y

fn<-function(x,y){sin(x)+2*y} #this looks like a corrugated tin roof

x<-seq(from=1,to=100,by=1) #generates a list of x values to sample
y<-seq(from=1,to=100,by=1) #generates a list of y values to sample

z<-outer(x,y,FUN=fn) #applies the funct. across the combos of x and y

persp(z,col='lightgray',shade=.5,border=NA,) #plots without gridlines

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] "Error: package/namespace load failed"

2009-05-27 Thread Rebecca Sela
I am writing my first R package, and I have been getting the following series 
of errors when I run R CMD check:

* checking S3 generic/method consistency ... WARNING
Error: package/namespace load failed for 'REEMtree'
Call sequence:
2: stop(gettextf("package/namespace load failed for '%s'", 
libraryPkgName(package)), 
   call. = FALSE, domain = NA)
1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE)
Execution halted
See section 'Generic functions and methods' of the 'Writing R Extensions'
manual.
* checking replacement functions ... WARNING
Error: package/namespace load failed for 'REEMtree'
Call sequence:
2: stop(gettextf("package/namespace load failed for '%s'", 
libraryPkgName(package)), 
   call. = FALSE, domain = NA)
1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE)
Execution halted
In R, the argument of a replacement function which corresponds to the right
hand side must be named 'value'.
* checking foreign function calls ... WARNING
Error: package/namespace load failed for 'REEMtree'
Call sequence:
2: stop(gettextf("package/namespace load failed for '%s'", 
libraryPkgName(package)), 
   call. = FALSE, domain = NA)
1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE)
Execution halted
See section 'System and foreign language interfaces' of the 'Writing R
Extensions' manual.
* checking Rd files ... OK
* checking for missing documentation entries ... ERROR
Error: package/namespace load failed for 'REEMtree'

(Everything is OK up to this point.)

Looking around online, I have found references to this error when there is 
compiled C or Fortran code, but I have none of that in my code.  I imagine this 
is a simple problem (perhaps with my NAMESPACE file), but I don't know what it 
is.  (The text of the NAMESPACE file is at the bottom of this e-mail.)

Thank you in advance for your help!

Rebecca

NAMESPACE file:

useDynLib(REEMtree)

export(AutoCorrelationLRtest, FixedEffectsTree, RandomEffectsTree, 
LMEpredict, PredictionTest, RandomEffectsTree, RMSE, simpleREEMdata, 
REEMtree, FEEMtree)

import(nlme)
import(rpart)

S3method(is,REEMtree)
S3method(logLik,REEMtree)
S3method(plot,REEMtree)
S3method(predict,REEMtree)
S3method(print, REEMtree)
S3method(ranef,REEMtree)
S3method(tree,REEMtree)
S3method(is,FEEMtree)
S3method(logLik,FEEMtree)
S3method(plot,FEEMtree)
S3method(predict,FEEMtree)
S3method(print, FEEMtree)
S3method(tree,FEEMtree)

useDynLib(REEMtree)

export(AutoCorrelationLRtest, FixedEffectsTree, RandomEffectsTree, 
LMEpredict, PredictionTest, RandomEffectsTree, RMSE, simpleREEMdata, 
REEMtree, FEEMtree)

import(nlme)
import(rpart)

S3method(is,REEMtree)
S3method(logLik,REEMtree)
S3method(plot,REEMtree)
S3method(predict,REEMtree)
S3method(print, REEMtree)
S3method(ranef,REEMtree)
S3method(tree,REEMtree)
S3method(is,FEEMtree)
S3method(logLik,FEEMtree)
S3method(plot,FEEMtree)
S3method(predict,FEEMtree)
S3method(print, FEEMtree)
S3method(tree,FEEMtree)
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] no internal function "int.unzip" in R 2.9.0 for Windows

2009-05-27 Thread Carson, John
> library(R2HTML)

Loading required package: R2HTML

Error in .Internal(int.unzip(zipname, NULL, dest)) : 

  no internal function "int.unzip"

Error : .onLoad failed in 'loadNamespace' for 'R2HTML'

Error: package 'R2HTML' could not be loaded

 

 

Version: R 2.9.0 for Windows



Internet Email Confidentiality Footer
Privileged/Confidential Information may be contained in this
message. If you are not the addressee indicated in this message (or
responsible for delivery of the message to such person), you may
not copy or deliver this message to anyone. In such case, you
should destroy this message and notify the sender by reply email.
Please advise immediately if you or your employer do not consent to
Internet email for messages of this kind. Opinions, conclusions and
other information in this message that do not relate to the
official business of The Shaw Group Inc. or its subsidiaries shall
be understood as neither given nor endorsed by it.
__ The Shaw Group Inc.
http://www.shawgrp.com  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] alternative to built-in data editor

2009-05-27 Thread Jose Quesada
Hi all,

I often have to peek at large data.
While head and tail are convenient, at times I'd like some more
comprehensive.
I guess I debug better in a more visual way?
I was wondering if there's a way to override the default data editor.
I could of course dump to a txt file, and look at it with an
editor/spreadsheet, but after doing it a few times, it gets boring.
Maybe it's time for me to write a function to automatize the process?
I'd ask first in case there's an easier way.

Thanks!
-Jose

-- 
Jose Quesada, PhD.
Max Planck Institute,
Center for Adaptive Behavior and Cognition -ABC-, 
Lentzeallee 94, office 224, 14195 Berlin
http://www.josequesada.name/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Labeling barplot bars by multiple factors

2009-05-27 Thread Mike Lawrence
You can get something close with ggplot2:

library(ggplot2)
my_data = expand.grid(
A = factor(c('A1','A2'))
, B = factor(c('B1','B2'))
, C = factor(c('C1','C2'))
)
my_data$DV = rnorm(8,mean=10,sd=1)
p = ggplot()
p = p + layer(
geom = 'bar'
, stat = 'identity'
, data = my_data
, mapping = aes(
x = C
, y = DV
, fill = B
)
, position = 'dodge'
)
p = p + facet_grid(
A ~ .
)
p = p + coord_flip()
print(p)


On Wed, May 27, 2009 at 1:01 PM, Thomas Levine  wrote:
> I want to plot quantitative data as a function of three two-level factors.
> How do I group the bars on a barplot by level through labeling and spacing?
> Here 's what
> I'm thinking of. Also, I'm pretty sure that I want a barplot, but there may
> be something better.
>
> Tom
>
>        [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University

Looking to arrange a meeting? Check my public calendar:
http://tr.im/mikes_public_calendar

~ Certainty is folly... I think. ~

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Sort matrix by column 1 ascending then by column 2 decending

2009-05-27 Thread Duncan Murdoch

On 5/27/2009 8:39 AM, Paul Geeleher wrote:

I've got a matrix with 2 columns and n rows. I need to sort it first
by the values in column 1 ascending. Then for values which are the
same in column 1, sort by column 2 decending. For example:


You've seen a few ways.  Here are some more:

1.  Use the fact that order() uses a stable sort algorithm, so just sort 
by the second column then the first:


x <- matrix(c(2,1,1,3,.5,.3,.5,.2), ncol=2)
x1 <- x[order(x[,2], decreasing=TRUE),]
x2 <- x1[order(x1[,1]),]
x2

2.  Use the fact that your values are numeric, so negatives sort in the 
reverse order of positives:


x[order(x[,1], -x[,2]),]

3.  If the values aren't known to be numeric, convert them to numeric 
before using them as sort keys:


x[order(xtfrm(x[,1]), -xtfrm(x[,2])),]

In any of these, watch out for NA handling.  My methods all put NA 
values last, but that might not be what you want.


Duncan Murdoch



2 .5
1 .3
1 .5
3 .2

Goes to:

1 .5
1 .3
2 .5
3 .2

This is easy to do in spreadsheet programs but I can't seem to work
out how to do it in R and haven't been able to find a solution
anywhere.


Thanks!

-Paul.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R in Ubunto

2009-05-27 Thread Jarek Jasiewicz



R Heberto Ghezzo, Dr pisze:

Hello , I do not know anything abount Ubunto, but I found a Portable Ubunto for 
Windows and since so many people
prefer Linux to Windows I decided to give it a try.
It runs very nicely, so I tried to load R, following Instructions in CRAN I 
added the line
deb http://probability.ca/cran/bin/linux/ubuntu hardy/ to /etc/apt/sources.list 
and then from a console
I did
sudo apt-get update
sudo apt-get install r-base
a lot of printout and when it inishes I typed R in the console and surprise!
I got R 2.6.2!! in Windows I have R 2.9.0??
Did I do something wrong or there is another way to get the latest version of R?
Thanks for any help
Heberto Ghezzo Ph.D.
Biostatistique medical
Montreal - Canada
  

use cran mirror:
for canada it could be:

http://cran.stat.sfu.ca/

  deb http://cran.stat.sfu.ca/bin/linux/ubuntu 
 hardy/

you will have 2.9.0

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Sort matrix by column 1 ascending then by column 2 decending

2009-05-27 Thread Kevin W
See also this tip on the R wiki:
http://wiki.r-project.org/rwiki/doku.php?id=tips:data-frames:sort

Also available as the orderBy function in the doBy package.

Kevin Wright


On Wed, May 27, 2009 at 11:19 AM, Linlin Yan  wrote:

> It's a very interesting problem. I just wrote a function for it:
>
> order.matrix <- function(m, columnsDecreasing = c('1'=FALSE), rows =
> 1:nrow(m))
> {
>  if (length(columnsDecreasing) > 0)
>  {
>col <- as.integer(names(columnsDecreasing[1]));
>values <- sort(unique(m[rows, col]), decreasing=columnsDecreasing[1]);
>unlist(sapply(values, function(x) order.matrix(m,
> columnsDecreasing[-1], which((1:nrow(m) %in% rows) & (m[,
> col]==x);
>  }
>  else
>  {
>rows;
>  }
> }
>
> For instance:
> > m <- matrix( c(2, 1, 1, 3, .5, .3, .5, .2), 4)
> > m
> [,1] [,2]
> [1,]2  0.5
> [2,]1  0.3
> [3,]1  0.5
> [4,]3  0.2
> > m[order.matrix(m),]
> [,1] [,2]
> [1,]1  0.3
> [2,]1  0.5
> [3,]2  0.5
> [4,]3  0.2
> > m[order.matrix(m, c("1"=FALSE, "2"=TRUE)),]
> [,1] [,2]
> [1,]1  0.5
> [2,]1  0.3
> [3,]2  0.5
> [4,]3  0.2
>
> Any comment is welcome! ;)
>
> On Wed, May 27, 2009 at 11:04 PM, Linlin Yan 
> wrote:
> >> m <- matrix( c(2, 1, 1, 3, .5, .3, .5, .2), 4)
> >> m
> > [,1] [,2]
> > [1,]2  0.5
> > [2,]1  0.3
> > [3,]1  0.5
> > [4,]3  0.2
> >> m[unlist(sapply(sort(unique(m[,1])), function(x)
> which(m[,1]==x)[order(m[(m[,1]==x),2], decreasing=TRUE)])),]
> > [,1] [,2]
> > [1,]1  0.5
> > [2,]1  0.3
> > [3,]2  0.5
> > [4,]3  0.2
> >
> > On Wed, May 27, 2009 at 8:39 PM, Paul Geeleher 
> wrote:
> >> I've got a matrix with 2 columns and n rows. I need to sort it first
> >> by the values in column 1 ascending. Then for values which are the
> >> same in column 1, sort by column 2 decending. For example:
> >>
> >> 2 .5
> >> 1 .3
> >> 1 .5
> >> 3 .2
> >>
> >> Goes to:
> >>
> >> 1 .5
> >> 1 .3
> >> 2 .5
> >> 3 .2
> >>
> >> This is easy to do in spreadsheet programs but I can't seem to work
> >> out how to do it in R and haven't been able to find a solution
> >> anywhere.
> >>
> >>
> >> Thanks!
> >>
> >> -Paul.
> >>
> >> --
> >> Paul Geeleher
> >> School of Mathematics, Statistics and Applied Mathematics
> >> National University of Ireland
> >> Galway
> >> Ireland
> >>
> >> __
> >> R-help@r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] vegan metaMDS question

2009-05-27 Thread Gavin Simpson
On Wed, 2009-05-27 at 11:31 -0400, stephen sefick wrote:
> The design decision in metaMDS says that it uses:
> 
> Minchin, P.R. (1987) An evaluation of relative robustness of
> techniques for ecological ordinations. Vegetatio 71, 145-156.
> 
> This is the paper that I found by the same name.  Is this the correct 
> reference?
> 
> Minchin, Peter R.1987. An Evaluation of the Relative Robustness  of
> Techniques for Ecological Ordination. Vegetatio. Vol. 69, No. 1/3:
> 89-107.

Yes, I suspect so - the other volume/pages refers to another paper of
Peter Minchin's. Jari has now fixed this in the sources and the change
will be made in the next version of Vegan released to CRAN. Thanks for
pointing this out.

> 
> In this paper the double standardization (wisconsin()) is used then a
> centering by species is preformed.  The centering by species isn't
> incorporated in the metaMDS methodology, is it?

No it isn't.

>   Is there a reason for
> this, or am I missing something?

Yes - the only mention of centring by species is in reference to PCA. If
you centre species data, you'd have negative numbers, which can't be
handled in most dissimilarity coefficients and hence doesn't make sense
for nMDS. If I've overlooked something in that paper let me know and
I'll take a closer look.

I forwarded your email to Jari Oksanen, who wrote the metaMDS code in
vegan. If he has anything more to add, I'm sure he'll reply to you
directly.

Why did you send this to R-Help and me? This is a specific
package-related question which should go to the maintainer (Jari). We
also have a forum for asking such questions on the vegan R-Forge pages.
There is no need to bother this list with such questions.

HTH

G

> best regards,
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



signature.asc
Description: This is a digitally signed message part
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to exclude a column by name?

2009-05-27 Thread Wacek Kusnierczyk
Dieter Menne wrote:
> Peter Dalgaard  biostat.ku.dk> writes:
>
>   
>> Or, BTW, you can use within()
>>
>> aq <- within(airquality, rm(Day))
>> 
>
> Please add this as an example to the docs of within. 
>   

possibly with the slightly more generic

unwanted <- 'Day'
aq <- within(airquality, rm(list=unwanted))

vQ

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Labeling barplot bars by multiple factors

2009-05-27 Thread Thomas Levine
I want to plot quantitative data as a function of three two-level factors.
How do I group the bars on a barplot by level through labeling and spacing?
Here 's what
I'm thinking of. Also, I'm pretty sure that I want a barplot, but there may
be something better.

Tom

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to set a filter during reading tables

2009-05-27 Thread guox
We are reading big tables, such as,

Chemicals <-
read.table('ftp://ftp.bls.gov/pub/time.series/wp/wp.data.7.Chemicals',header
= TRUE, sep = '\t', as.is =T)

I was wondering if it is possible to set a filter during loading so that
we just load what we want not the whole table each time. Thanks,

-james

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Deviance explined in GAMM, library mgcv

2009-05-27 Thread Berta Ibáñez


 

Dear R-users, 

 

To obtain the percentage of deviance explained when fitting a gam model using 
the mgcv library is straightforward:

 

summary(object.gam) $dev.expl

 

or alternatively, using the deviance (deviance(object.gam)) of the null and the 
fitted models, and then using 1 minus the quotient of deviances. 

 

However, when a gamm (generalizad aditive mixed model) is fitted,  the deviance 
is not displayed, and only the logLik of the underlying lme model can be 
derived (logLik(objetct.gamm$lme)), which is not enough to derive the 
percentage deviance explained because the logLik for the saturated model is not 
available. 

Any suggestions on how to obtain the deviance explained when a gamm is fitted 
when the typical default gauusian model is fitted? Or alternavely, are the R^2 
derived from a gam model and a gamm model comparable?

 

Thanks a lot in advance,

Berta 

_
Descárgate ahora el nuevo Internet Explorer 8 y ten a tu alcance todos lo

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Sort matrix by column 1 ascending then by column 2 decending

2009-05-27 Thread Linlin Yan
It's a very interesting problem. I just wrote a function for it:

order.matrix <- function(m, columnsDecreasing = c('1'=FALSE), rows = 1:nrow(m))
{
  if (length(columnsDecreasing) > 0)
  {
col <- as.integer(names(columnsDecreasing[1]));
values <- sort(unique(m[rows, col]), decreasing=columnsDecreasing[1]);
unlist(sapply(values, function(x) order.matrix(m,
columnsDecreasing[-1], which((1:nrow(m) %in% rows) & (m[,
col]==x);
  }
  else
  {
rows;
  }
}

For instance:
> m <- matrix( c(2, 1, 1, 3, .5, .3, .5, .2), 4)
> m
 [,1] [,2]
[1,]2  0.5
[2,]1  0.3
[3,]1  0.5
[4,]3  0.2
> m[order.matrix(m),]
 [,1] [,2]
[1,]1  0.3
[2,]1  0.5
[3,]2  0.5
[4,]3  0.2
> m[order.matrix(m, c("1"=FALSE, "2"=TRUE)),]
 [,1] [,2]
[1,]1  0.5
[2,]1  0.3
[3,]2  0.5
[4,]3  0.2

Any comment is welcome! ;)

On Wed, May 27, 2009 at 11:04 PM, Linlin Yan  wrote:
>> m <- matrix( c(2, 1, 1, 3, .5, .3, .5, .2), 4)
>> m
>     [,1] [,2]
> [1,]    2  0.5
> [2,]    1  0.3
> [3,]    1  0.5
> [4,]    3  0.2
>> m[unlist(sapply(sort(unique(m[,1])), function(x) 
>> which(m[,1]==x)[order(m[(m[,1]==x),2], decreasing=TRUE)])),]
>     [,1] [,2]
> [1,]    1  0.5
> [2,]    1  0.3
> [3,]    2  0.5
> [4,]    3  0.2
>
> On Wed, May 27, 2009 at 8:39 PM, Paul Geeleher  wrote:
>> I've got a matrix with 2 columns and n rows. I need to sort it first
>> by the values in column 1 ascending. Then for values which are the
>> same in column 1, sort by column 2 decending. For example:
>>
>> 2 .5
>> 1 .3
>> 1 .5
>> 3 .2
>>
>> Goes to:
>>
>> 1 .5
>> 1 .3
>> 2 .5
>> 3 .2
>>
>> This is easy to do in spreadsheet programs but I can't seem to work
>> out how to do it in R and haven't been able to find a solution
>> anywhere.
>>
>>
>> Thanks!
>>
>> -Paul.
>>
>> --
>> Paul Geeleher
>> School of Mathematics, Statistics and Applied Mathematics
>> National University of Ireland
>> Galway
>> Ireland
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Hierarchical glm with binomial family

2009-05-27 Thread Douglas Bates
On Wed, May 27, 2009 at 9:17 AM, Ben Bolker  wrote:
>
>
>
> Johan Stenberg-2 wrote:
>>
>> Dear members of the R help list,
>>
>> I want to do a hierarchical glm with binomial family but am unsure
>> about how to write the syntax which involves nesting.
>>
>> I want to test whether the risk of being attacked by Herbivores for
>> Meadowsweet plants is significantly dependent on the Distance to
>> heterospecific source plants.
>>
>> Dependent variable = Herbivory (yes/no)
>> Explanatory continuous variable = Distance to heterospecific source plant
>>
>> Distance should be nested within Subpopulation which in turn should be
>> nested within Population.
>> The number of replicates per subpopulation varies between 8 and 36.
>> The number of subpopulations per population varies between 4 and 9.
>>
>> I haven't figured out how to do nesting, but guessing that nesting is
>> denoted with brackets I guess the syntax should look something like
>> this (below). Could you please help me to correct this syntax so that
>> it becomes useful in R?
>>
>> model<-glm(Herbivory~Distance(Subpopulation(Population)), family=binomial)
>>
>>
>
> You probably need a GLMM (generalized linear mixed model), which is
> a little bit of a can of worms.  If so, you will need the "glmer" function
> inside the "lmer" package.

I think you mean the lme4 package.

>  I'm not entirely clear about your experimental design: I understand
> that subpopulations are nested within populations, but it's not clear
> whether covariates (distances to heterospecific plants) differ within
> subpopulations or populations.
>
>  If they don't differ with subpopulations, I would (strongly) recommend
> aggregating the
> values within subpopulations and analyzing proportions as a regression
> analysis:
> see Murtaugh, Paul A. “SIMPLICITY AND COMPLEXITY IN ECOLOGICAL
>  DATA ANALYSIS.” Ecology 88, no. 1 (2007): 56-62.
>
>  If they do, then your design is
>
> model<-glmer(Herbivory~Distance+(1|Population/Subpopulation),
> family=binomial)
>
>  See also:
>
> https://stat.ethz.ch/pipermail/r-sig-mixed-models/2009q2/002320.html
> https://stat.ethz.ch/pipermail/r-sig-mixed-models/2009q2/002335.html
> --
> View this message in context: 
> http://www.nabble.com/Hierarchical-glm-with-binomial-family-tp23742335p23743418.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Changing point color/character in qqmath

2009-05-27 Thread Kevin W
Having solved this problem, I am posting this so that the next time I search
for how to do this I will find an answer...

Using qqmath(..., groups=num) creates a separate qq distribution for each
group (within a panel).  Using the 'col' or 'pch' argument does not
(usually) work because panel.qqmath sorts the data (but not 'col' or 'pch')
before plotting.  Sorting the data before calling qqmath will ensure that
the sorting does not change the order of the data.

For example, to obtain one distribution per voice part and color the point
by part 1 or part 2:

library(lattice)
singer <- singer
singer <- singer[order(singer$height),]
singer$part <- factor(sapply(strsplit(as.character(singer$voice.part), split
= " "), "[", 1),
 levels = c("Bass", "Tenor", "Alto", "Soprano"))
singer$num <- factor(sapply(strsplit(as.character(singer$voice.part), split
= " "), "[", 2))
qqmath(~ height | part, data = singer,
   col=singer$num,
   layout=c(4,1))



Kevin

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Object-oriented programming in R

2009-05-27 Thread Luc Villandre

Dear R-users,

I have very recently started learning about object-oriented programming 
in R. I am far from being an expert in programming, although I do have 
an elementary C++ background.


Please take a look at these lines of code.

some.data = data.frame(V1 = 1:5, V2 = 6:10) ;
p.plot = ggplot(data=some.data,aes(x=V1, y=V2)) ;
class(p.plot) ;
[1] "ggplot"
My understanding is that the object p.plot belongs to the "ggplot" 
class. However, a new class definition like
setClass("AClass", representation(mFirst = "numeric", mSecond = 
"ggplot")) ;

yields the warning

Warning message:
In .completeClassSlots(ClassDef, where) :
  undefined slot classes in definition of "AClass": mSecond(class 
"ggplot")

The ggplot object is also a list :

is.list(p.plot)
[1] TRUE

So, I guess I could identify mSecond as being a list.

However, I don't understand why "ggplot" is not considered a valid slot 
type. I thought setClass() was analogous to the class declaration in 
C++, but I guess I might be wrong. Would anyone care to provide 
additional explanations about this?


I decided to explore object-oriented programming in R so that I could 
organize the output from my analysis in a more rigorous fashion and then 
define custom methods that would yield relevant output. However, I'm 
starting to wonder if this aspect is not better suited for package 
builders. R lists are already very powerful and convenient templates. 
Although it wouldn't be as elegant, I could define functions that would 
take lists outputted by the different steps of my analysis and do what I 
want with them. I'm wondering what the merits of both approaches in the 
context of R would be. If anyone has any thoughts about this, I'd be 
most glad to read them.


Cheers,
--
*Luc Villandré*
/Biostatistician
McGill University Health Center -
Montreal Children's Hospital Research Institute/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R in Ubunto

2009-05-27 Thread Jeff Newmiller

R Heberto Ghezzo, Dr wrote:

Hello , I do not know anything abount Ubunto, but I found a Portable Ubunto for 
Windows and since so many people
prefer Linux to Windows I decided to give it a try.
It runs very nicely, so I tried to load R, following Instructions in CRAN I 
added the line
deb http://probability.ca/cran/bin/linux/ubuntu hardy/ to /etc/apt/sources.list 
and then from a console
I did
sudo apt-get update
sudo apt-get install r-base
a lot of printout and when it inishes I typed R in the console and surprise!
I got R 2.6.2!! in Windows I have R 2.9.0??
Did I do something wrong or there is another way to get the latest version of R?


On the web page

  http://probability.ca/cran/bin/linux/ubuntu/

it presents instructions for activating this repository.  Special
instructions are included for hardy regarding activating backports
also.

--
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Defining functions - an interesting problem

2009-05-27 Thread Stavros Macrakis
The 'ties.method' argument to 'rank' is the *third* positional argument to
'rank', so either you need to put it in the third position or you need to
use a named argument.

The fact that the variable you're using to represent ties.method is called
ties.method is irrelevant.  That is, this:

  rank(x,ties.method)

is equivalent to

 rank(x, na.last = ties.method)

which is not what you want.

You need to write

 rank(x, ties.method = ties.method)

or (more concise but not as clear):

 rank(x, , ties.method)

Hope this helps,

  -s

On Wed, May 27, 2009 at 10:11 AM, utkarshsinghal <
utkarsh.sing...@global-analytics.com> wrote:

> I define the following function:
> (Please don't wonder about the use of this function, this is just a
> simplified version of my actual function. And please don't spend your time
> in finding an alternate way of doing the same as the following does not
> exactly represent my function. I am only interested in a good explanation)
>
> > f1 = function(x,ties.method="average")rank(x,ties.method)
> > f1(c(1,1,2,4), ties.method="min")
> [1] 1.5 1.5 3.0 4.0
>
> I don't know why it followed ties.method="average".
> Anyways I randomly tried the following:
>
> > f2 = function(x,ties.method="average")rank(x,ties.method=ties.method)
> > f2(c(1,1,2,4), ties.method="min")
> [1] 1 1 3 4
> Now, it follows the ties.method="min"
>
> I don't see any explanation for this, however, I somehow mugged up that if
> I define it as in "f1", the ties.method in rank function takes its default
> value which is "average" and if I define as in "f2", it takes the value
> which is passed in "f2".
>
> But even all my mugging is wasted when I tested the following:
>
> > h = function(x, a=1)x^a
> > g1 = function(x, a=1)h(x,a)
> > g1(x=5, a=2)
> [1] 25
>
> > g2 = function(x, a=1)h(x,a=a)
> > g2(x=5, a=2)
> [1] 25
>
> Here in both the cases, "h" is taking the value passed through "g1", and
> "g2".
>
> Any comments/hints can  be helpful.
>
> Regards
> Utkarsh
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to exclude a column by name?

2009-05-27 Thread Dieter Menne
Peter Dalgaard  biostat.ku.dk> writes:

> Or, BTW, you can use within()
> 
> aq <- within(airquality, rm(Day))

Please add this as an example to the docs of within. 

Dieter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R in Ubunto

2009-05-27 Thread stephen sefick
I don't remember what the version of R in deb repositories is, but
2.6.2 is probably about right.  One of the things the Debian project
is focused on is the stability of the operating system, so they do not
update packages as readily as some other distributions.  I had this
with Debian 5.0 and just decided to compile R from source after
getting the R development package and some x11 development libraries.

sudo apt-get install r-base-dev


I can help you through this process if you like, or there are good
instructions for this process at the R website.

FAQ 2.5.1 How can R be installed (Unix)

On Wed, May 27, 2009 at 11:35 AM, R Heberto Ghezzo, Dr
 wrote:
> Hello , I do not know anything abount Ubunto, but I found a Portable Ubunto 
> for Windows and since so many people
> prefer Linux to Windows I decided to give it a try.
> It runs very nicely, so I tried to load R, following Instructions in CRAN I 
> added the line
> deb http://probability.ca/cran/bin/linux/ubuntu hardy/ to 
> /etc/apt/sources.list and then from a console
> I did
> sudo apt-get update
> sudo apt-get install r-base
> a lot of printout and when it inishes I typed R in the console and surprise!
> I got R 2.6.2!! in Windows I have R 2.9.0??
> Did I do something wrong or there is another way to get the latest version of 
> R?
> Thanks for any help
> Heberto Ghezzo Ph.D.
> Biostatistique medical
> Montreal - Canada
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Neural Network resource

2009-05-27 Thread Max Kuhn
> I fed this data into a Neural network (3 hidden layers with 6 neurons in each 
> layer) and trained the network. When I passed the input dataset and tried to 
> get the predictions, all the predicted values were identical! This confused 
> me a bit and was wondering whether my understanding of the Neural Network was 
> wrong.
>
> Have you ever faced anything like it?

You should really provide code for us to help. I would initially
suspect that you didn't use a linear function between your hidden
units and the outcomes.

Also, using 3 hidden layers and 6 units per layer is a bit much for
your data set (30-40 samples). You will probably end up overfitting.

-- 

Max

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] vegan metaMDS question

2009-05-27 Thread stephen sefick
The design decision in metaMDS says that it uses:

Minchin, P.R. (1987) An evaluation of relative robustness of
techniques for ecological ordinations. Vegetatio 71, 145-156.

This is the paper that I found by the same name.  Is this the correct reference?

Minchin, Peter R.1987. An Evaluation of the Relative Robustness  of
Techniques for Ecological Ordination. Vegetatio. Vol. 69, No. 1/3:
89-107.

In this paper the double standardization (wisconsin()) is used then a
centering by species is preformed.  The centering by species isn't
incorporated in the metaMDS methodology, is it?  Is there a reason for
this, or am I missing something?
best regards,

-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R in Ubunto

2009-05-27 Thread R Heberto Ghezzo, Dr
Hello , I do not know anything abount Ubunto, but I found a Portable Ubunto for 
Windows and since so many people
prefer Linux to Windows I decided to give it a try.
It runs very nicely, so I tried to load R, following Instructions in CRAN I 
added the line
deb http://probability.ca/cran/bin/linux/ubuntu hardy/ to /etc/apt/sources.list 
and then from a console
I did
sudo apt-get update
sudo apt-get install r-base
a lot of printout and when it inishes I typed R in the console and surprise!
I got R 2.6.2!! in Windows I have R 2.9.0??
Did I do something wrong or there is another way to get the latest version of R?
Thanks for any help
Heberto Ghezzo Ph.D.
Biostatistique medical
Montreal - Canada

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Defining functions - an interesting problem

2009-05-27 Thread utkarshsinghal

Yeah, seems so obvious now. What a blunder, poor me.
Perfect explanation. Thanks


Thomas Lumley wrote:

On Wed, 27 May 2009, utkarshsinghal wrote:


I define the following function:
(Please don't wonder about the use of this function, this is just a 
simplified version of my actual function. And please don't spend your 
time in finding an alternate way of doing the same as the following 
does not exactly represent my function. I am only interested in a 
good explanation)



f1 = function(x,ties.method="average")rank(x,ties.method)
f1(c(1,1,2,4), ties.method="min")

[1] 1.5 1.5 3.0 4.0

I don't know why it followed ties.method="average".


Look at the arguments to rank()

args(rank)

function (x, na.last = TRUE, ties.method = c("average", "first",
"random", "max", "min"))

When you do rank(x, ties.method) you are passing "min" as the second 
argument to rank(), which is the na.last argument, not the ties.method 
argument.  This didn't give an error message because there weren't any 
NAs in your data.


You want
f1 = function(x,ties.method="average")rank(x,ties.method=ties.method)
which gives

f1(c(1,1,2,4), ties.method="min")

[1] 1 1 3 4

-thomas

Thomas LumleyAssoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Defining functions - an interesting problem

2009-05-27 Thread Gavin Simpson
On Wed, 2009-05-27 at 19:41 +0530, utkarshsinghal wrote:
> I define the following function:
> (Please don't wonder about the use of this function, this is just a 
> simplified version of my actual function. And please don't spend your 
> time in finding an alternate way of doing the same as the following does 
> not exactly represent my function. I am only interested in a good 
> explanation)
> 
>  > f1 = function(x,ties.method="average")rank(x,ties.method)
>  > f1(c(1,1,2,4), ties.method="min")
> [1] 1.5 1.5 3.0 4.0
> 
> I don't know why it followed ties.method="average".

What is the second argument of rank? It is not ties.method. You passed
"min" to na.last, not ties.method. You need to name the argument if you
are not passing in all arguments and in the correct order.

> Anyways I randomly tried the following:
> 
>  > f2 = function(x,ties.method="average")rank(x,ties.method=ties.method)
>  > f2(c(1,1,2,4), ties.method="min")
> [1] 1 1 3 4
> Now, it follows the ties.method="min"

Why randomly - ?rank tells you the argument is ties.method so you should
set it to ties.method: times.method = ties.method in your call to rank.

> 
> I don't see any explanation for this, however, I somehow mugged up that 
> if I define it as in "f1", the ties.method in rank function takes its 
> default value which is "average" and if I define as in "f2", it takes 
> the value which is passed in "f2".

Because you aren't passing ties.method as the same argument in f1 and
f2. In f1 you are passing ties.method to na.last, in f2 you do it
correctly.

> 
> But even all my mugging is wasted when I tested the following:
> 
>  > h = function(x, a=1)x^a
>  > g1 = function(x, a=1)h(x,a)
>  > g1(x=5, a=2)
> [1] 25
> 
>  > g2 = function(x, a=1)h(x,a=a)
>  > g2(x=5, a=2)
> [1] 25
> 
> Here in both the cases, "h" is taking the value passed through "g1", and 
> "g2".

Here there are only two arguments and you supplied them in the correct
place when you supplied them un-named.

HTH

G

> 
> Any comments/hints can  be helpful.
> 
> Regards
> Utkarsh
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



signature.asc
Description: This is a digitally signed message part
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Defining functions - an interesting problem

2009-05-27 Thread Thomas Lumley

On Wed, 27 May 2009, utkarshsinghal wrote:


I define the following function:
(Please don't wonder about the use of this function, this is just a 
simplified version of my actual function. And please don't spend your time in 
finding an alternate way of doing the same as the following does not exactly 
represent my function. I am only interested in a good explanation)



f1 = function(x,ties.method="average")rank(x,ties.method)
f1(c(1,1,2,4), ties.method="min")

[1] 1.5 1.5 3.0 4.0

I don't know why it followed ties.method="average".


Look at the arguments to rank()

args(rank)

function (x, na.last = TRUE, ties.method = c("average", "first",
"random", "max", "min"))

When you do rank(x, ties.method) you are passing "min" as the second 
argument to rank(), which is the na.last argument, not the ties.method 
argument.  This didn't give an error message because there weren't any NAs 
in your data.


You want
f1 = function(x,ties.method="average")rank(x,ties.method=ties.method)
which gives

f1(c(1,1,2,4), ties.method="min")

[1] 1 1 3 4

-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Neural Network resource

2009-05-27 Thread Indrajit Sengupta
You are right there is a pdf file which describes the function. But let tell 
you where I am coming from.

Just to test if a neural network will work better than a ordinary least square 
regression, I created a dataset with one dependent variable and 6 other 
independent variables. Now I had deliberately created the dataset in such 
manner that we have an excellent regression model. Eg: Y = b0 + b1*x1 + b2*x2 + 
b3*x3.. + b6*x6 + e
where e is normal random variable. Naturally any statistical analysis system 
running regression would easily predict the values of b1, b2, b3, ..., b6 with 
around 30-40 observations.

I fed this data into a Neural network (3 hidden layers with 6 neurons in each 
layer) and trained the network. When I passed the input dataset and tried to 
get the predictions, all the predicted values were identical! This confused me 
a bit and was wondering whether my understanding of the Neural Network was 
wrong.

Have you ever faced anything like it?

Regards,
Indrajit




From: "markle...@verizon.net" 

Sent: Wednesday, May 27, 2009 7:54:59 PM
Subject: Re: [R] Neural Network resource

Hi: I've never used that package but most likely there is a  AMORE vignette 
that shows examples and describes the functions.
it should be on the same cran  web page where the package resides, in pdf form.






Hi All,

I am trying to learn Neural Networks. I found that R has packages which can 
help build Neural Nets - the popular one being AMORE package. Is there any book 
/ resource available which guides us in this subject using the AMORE package?

Any help will be much appreciated.

Thanks,
Indrajit

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to exclude a column by name?

2009-05-27 Thread Stavros Macrakis
On Wed, May 27, 2009 at 6:37 AM, Zeljko Vrba  wrote:

> Given an arbitrary data frame, it is easy to exclude a column given its
> index:
> df[,-2].  How to do the same thing given the column name?  A naive attempt
> df[,-"name"] did not work :)
>

Various ways:

Boolean index vector:

df[ , names(df) != "name" ]

List of wanted column names:

df[ , setdiff(names(df), "name") ]

Negated list of unwanted column indexes:

   df[ , -match("name",names(df)) ]
   df[ , -which(names(df) == "name") ]

The special 'subset' hack for column names; beware, I think this is the only
place in R where you can negate a column name.

   subset(df , select = -a )

Hope this helps,

 -s

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Multivariate Transformations

2009-05-27 Thread Gavin Simpson
On Wed, 2009-05-27 at 08:39 -0400, stephen sefick wrote:
> It depends on what you are after.  I am by no means a wunderkind when
> it comes to transformation, but in the package vegan type
> ?wisconsin
> and that should give you a start,  but if you know what
> transformations you would like to preform then apply should do what
> you need with whatever transformation you are trying to use.

decostand provides (mostly) standardisations not transformations, it
even says so. What Holger is looking for is something like a Box Cox
transform for bivariate normality but to instead achieve multivariate
normality. That is a different kettle of fish to what decostand tries to
do.

HTH

G

> 
> Stephen Sefick
> 
> On Wed, May 27, 2009 at 5:26 AM, Hollix  wrote:
> >
> > Hello folks,
> >
> > many multivariate anayses (e.g., structural equation modeling) require
> > multivariate normal distributions.
> > Real data, however, most often significantly depart from the multinormal
> > distribution. Some researchers (e.g., Yuan et al., 2000) have proposed a
> > multivariate transformation of the variables.
> >
> > Can you tell me, if and how such a transformation can be handeled in R?
> >
> > Thanks in advance.
> > With best regards
> > Holger
> >
> >
> > ---
> > Yuan, K.-H., Chan, W., & Bentler, P. M. (2000). Robust transformation with
> > applications to structural equation modeling. British Journal of
> > Mathematical and Statistical Psychology, 53, 31–50.
> > --
> > View this message in context: 
> > http://www.nabble.com/Multivariate-Transformations-tp23739013p23739013.html
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> 
> 
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



signature.asc
Description: This is a digitally signed message part
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Warning message as a result of logistic regression performed

2009-05-27 Thread Gavin Simpson
Try reading this thread:

http://thread.gmane.org/gmane.comp.lang.r.general/134368/focus=134475

especially the posts by I Kosmidis which show you how to diagnose
problems in logit model fits like this.

There is a statement about this warning in ?glm as well and a pointer to
a reference which discusses a source of the warning.

G

On Wed, 2009-05-27 at 11:22 +0100, Winter, Katherine wrote:
> I am sorry if this question sounds basic but I am having trouble 
> understanding a warning message I have been receiving in R after attempting 
> logistic regression.
> 
> I have been using the logistic regression function in R to analyse a 
> simulated data set. The dependent variable "failure" has an outcome of either 
> 0 (success) or 1 (failure). Both the independent variables have been 
> previously generated in a mathematical model and stored in a data.frame for 
> analysis. I am currently using a sample size of 1000 and I use the following 
> commands in R:
> 
>log.reg.1 <- glm(failure ~ age +weight +init.para.log.value 
> +k.d1,family=binomial(logit), data=test)
>   log.reg.1.summary <- summary(log.reg.1); print(log.reg.1.summary)
>   log.reg.1.exp <- exp(log.reg.1$coef); print(log.reg.1.exp)
> 
> When I execute these commands I get the following warning message: 
> 
> "In glm.fit(x = X, y = Y, weights = weights, start = start, etastart = 
> etastart,  :fitted probabilities numerically 0 or 1 occurred"
> 
> I am unsure what this warning is referring to. I have tried using google to 
> answer this question but have had no luck. 
> 
> I have been on the following website 
> https://stat.ethz.ch/pipermail/r-sig-ecology/2008-July/000278.html but found 
> it was not helpful as I when I ran the example given I received no warning 
> message (I am using R version 2.8.1). 
> 
> I am working with simulated data so there are no missing values in the data 
> set.
> 
> I have also looked at the following website 
> http://tolstoy.newcastle.edu.au/R/help/05/07/7759.html they suggest that the 
> warning is as a result of "perfect separation" of the results (a possibility 
> with simulated data). However, when I added an extra row to my data.frame of 
> results that I knew to be false and hence to prevent "perfect separation" 
> subsequent logistic regression still resulted in the same warning message. 
> 
> I am still at a loss as to the meaning of this message and any help in 
> understanding this warning would be much appreciated.
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



signature.asc
Description: This is a digitally signed message part
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Hierarchical glm with binomial family

2009-05-27 Thread Ben Bolker



Johan Stenberg-2 wrote:
> 
> Dear members of the R help list,
> 
> I want to do a hierarchical glm with binomial family but am unsure
> about how to write the syntax which involves nesting.
> 
> I want to test whether the risk of being attacked by Herbivores for
> Meadowsweet plants is significantly dependent on the Distance to
> heterospecific source plants.
> 
> Dependent variable = Herbivory (yes/no)
> Explanatory continuous variable = Distance to heterospecific source plant
> 
> Distance should be nested within Subpopulation which in turn should be
> nested within Population.
> The number of replicates per subpopulation varies between 8 and 36.
> The number of subpopulations per population varies between 4 and 9.
> 
> I haven't figured out how to do nesting, but guessing that nesting is
> denoted with brackets I guess the syntax should look something like
> this (below). Could you please help me to correct this syntax so that
> it becomes useful in R?
> 
> model<-glm(Herbivory~Distance(Subpopulation(Population)), family=binomial)
> 
> 

You probably need a GLMM (generalized linear mixed model), which is
a little bit of a can of worms.  If so, you will need the "glmer" function
inside the "lmer" package.

  I'm not entirely clear about your experimental design: I understand
that subpopulations are nested within populations, but it's not clear
whether covariates (distances to heterospecific plants) differ within
subpopulations or populations.

  If they don't differ with subpopulations, I would (strongly) recommend
aggregating the
values within subpopulations and analyzing proportions as a regression
analysis:
see Murtaugh, Paul A. “SIMPLICITY AND COMPLEXITY IN ECOLOGICAL
 DATA ANALYSIS.” Ecology 88, no. 1 (2007): 56-62.

  If they do, then your design is

model<-glmer(Herbivory~Distance+(1|Population/Subpopulation),
family=binomial)

  See also:

https://stat.ethz.ch/pipermail/r-sig-mixed-models/2009q2/002320.html
https://stat.ethz.ch/pipermail/r-sig-mixed-models/2009q2/002335.html
-- 
View this message in context: 
http://www.nabble.com/Hierarchical-glm-with-binomial-family-tp23742335p23743418.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Defining functions - an interesting problem

2009-05-27 Thread utkarshsinghal

I define the following function:
(Please don't wonder about the use of this function, this is just a 
simplified version of my actual function. And please don't spend your 
time in finding an alternate way of doing the same as the following does 
not exactly represent my function. I am only interested in a good 
explanation)


> f1 = function(x,ties.method="average")rank(x,ties.method)
> f1(c(1,1,2,4), ties.method="min")
[1] 1.5 1.5 3.0 4.0

I don't know why it followed ties.method="average".
Anyways I randomly tried the following:

> f2 = function(x,ties.method="average")rank(x,ties.method=ties.method)
> f2(c(1,1,2,4), ties.method="min")
[1] 1 1 3 4
Now, it follows the ties.method="min"

I don't see any explanation for this, however, I somehow mugged up that 
if I define it as in "f1", the ties.method in rank function takes its 
default value which is "average" and if I define as in "f2", it takes 
the value which is passed in "f2".


But even all my mugging is wasted when I tested the following:

> h = function(x, a=1)x^a
> g1 = function(x, a=1)h(x,a)
> g1(x=5, a=2)
[1] 25

> g2 = function(x, a=1)h(x,a=a)
> g2(x=5, a=2)
[1] 25

Here in both the cases, "h" is taking the value passed through "g1", and 
"g2".


Any comments/hints can  be helpful.

Regards
Utkarsh

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Sort matrix by column 1 ascending then by column 2 decending

2009-05-27 Thread Paul Geeleher
Nice. Works perfectly.

On Wed, May 27, 2009 at 2:03 PM, Henrique Dallazuanna  wrote:
> Try this:
>
> cbind(sort(x[,1]), unlist(tapply(x[,2], x[,1], sort, decreasing = T)))
>
> On Wed, May 27, 2009 at 9:39 AM, Paul Geeleher 
> wrote:
>>
>> I've got a matrix with 2 columns and n rows. I need to sort it first
>> by the values in column 1 ascending. Then for values which are the
>> same in column 1, sort by column 2 decending. For example:
>>
>> 2 .5
>> 1 .3
>> 1 .5
>> 3 .2
>>
>> Goes to:
>>
>> 1 .5
>> 1 .3
>> 2 .5
>> 3 .2
>>
>> This is easy to do in spreadsheet programs but I can't seem to work
>> out how to do it in R and haven't been able to find a solution
>> anywhere.
>>
>>
>> Thanks!
>>
>> -Paul.
>>
>> --
>> Paul Geeleher
>> School of Mathematics, Statistics and Applied Mathematics
>> National University of Ireland
>> Galway
>> Ireland
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>



-- 
Paul Geeleher
School of Mathematics, Statistics and Applied Mathematics
National University of Ireland
Galway
Ireland

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] file.move?

2009-05-27 Thread Prof Brian Ripley

Are you looking for file.rename?

Moving files is not really a portable concept, and nor is 'time 
stamps' (files usually have three or more times associated with them, 
and moving does not keep them all in OSes that implement it).


On Wed, 27 May 2009, Stefan Uhmann wrote:


Dear list,

I want to move some files that should keep their time stamps, which is not 
the case if I use file.copy in combination with file.remove. file.move would 
be nice, is there a package providing such a function?


Regards,
Stefan


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to write a loop?

2009-05-27 Thread Andrew Dolman
Try

lapply(ONS, fft)

and take a look here http://cran.r-project.org/doc/manuals/R-intro.html for
the basics of data structures in R and how to apply functions to them.


Andy.



andydol...@gmail.com


2009/5/27 Linlin Yan 

> Why did you use different variable names rather than index of
> list/data.frame?
>
> On Wed, May 27, 2009 at 6:34 PM, Maithili Shiva
>  wrote:
> > Dear R helpers,
> >
> > Following is a R script I am using to run the Fast Fourier Transform. The
> csv files has 10 columns with titles m1, m2, m3 .m10.
> >
> > When I use the following commands, I am getting the required results. The
> probelm is if there are 100 columns, it is not wise to define 100 commands
> as fk <- ONS$mk and so on. Thus, I need some guidance to write the loop for
> the STEP A and STEP B.
> >
> > Thanking in advance
> >
> > Regards
> >
> > Maithili
> >
> >
> >
> > My R Script
> >
> >
> ---
> >
> > ONS <- read.csv("fast fourier transform.csv", header = TRUE)
> >
> >   # STEP A
> >
> >   f1 <- ONS$m1
> >
> >   f2 <- ONS$m2
> >
> >   f3 <- ONS$m3
> >
> >   f4 <- ONS$m4
> >
> >   f5 <- ONS$m5
> >
> >   f6 <- ONS$m6
> >
> >   f7 <- ONS$m7
> >
> >   f8 <- ONS$m8
> >
> >   f9 <- ONS$m9
> >
> >   f10 <- ONS$m10
> >
> >
> #
> >
> >
> >   # STEP B
> >
> >   g1 <- fft(f1)
> >
> >   g2 <- fft(f2)
> >
> >   g3 <- fft(f3)
> >
> >   g4 <- fft(f4)
> >
> >   g5 <- fft(f5)
> >
> >   g6 <- fft(f6)
> >
> >   g7 <- fft(f7)
> >
> >   g8 <- fft(f8)
> >
> >   g9 <- fft(f9)
> >
> >   g10 <- fft(f10)
> >
> >
> >
> #
> >
> >   h <- g1*g2*g3*g4*g5*g6*g7*g8*g9*g10
> >
> >   j <- fft((h), inverse = TRUE)/length(h)
> >
> >
> >
> #
> >
> >
> >
> >
> >  Cricket on your mind? Visit the ultimate cricket website. Enter
> http://beta.cricket.yahoo.com
> >[[alternative HTML version deleted]]
> >
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> >
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Harmonic Analysis

2009-05-27 Thread Gerard M. Keogh
My thoughts exactly.

?FFT should do the job.

And define the dominant term - a_n**2 + b_n**2 - the Parseval Relation.



   
 stephen sefick
  To 
 Sent by:  r-h...@stat.math.ethz.ch
 r-help-boun...@r-  cc 
 project.org   
   Subject 
   Re: [R] Harmonic Analysis   
 27/05/2009 13:58  
   
   
   
   
   




why will a fourier transform not work?
2009/5/27 Uwe Ligges :
>
>
> Dieter Menne wrote:
>>
>>   alice.it> writes:
>>
>>> I am looking for a package to perform harmonic analysis with the goal
of
>>> estimating the period of the
>>> dominant high frequency component in some mono-channel signals.
>>
>> You should widen your scope by looking a "time series" instead of
harmonic
>> analysis. There is a task view on the subject at
>>
>> http://cran.at.r-project.org/web/views/TimeSeries.html
>
>
> ... or take a look at package tuneR.
>
> Uwe Ligges
>
>
>
>
>> Dieter
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.


   -K. Mullis

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



**
The information transmitted is intended only for the person or entity to which 
it is addressed and may contain confidential and/or privileged material. Any 
review, retransmission, dissemination or other use of, or taking of any action 
in reliance upon, this information by persons or entities other than the 
intended recipient is prohibited. If you received this in error, please contact 
the sender and delete the material from any computer.  It is the policy of the 
Department of Justice, Equality and Law Reform and the Agencies and Offices 
using its IT services to disallow the sending of offensive material.
Should you consider that the material contained in this message is offensive 
you should contact the sender immediately and also mailminder[at]justice.ie.

Is le haghaidh an duine nó an eintitis ar a bhfuil sí dírithe, agus le haghaidh 
an duine nó an eintitis sin amháin, a bheartaítear an fhaisnéis a tarchuireadh 
agus féadfaidh sé go bhfuil ábhar faoi rún agus/nó faoi phribhléid inti. 
Toirmisctear aon athbhreithniú, atarchur nó leathadh a dhéanamh ar an 
bhfaisnéis seo, aon úsáid eile a bhaint aisti nó aon ghníomh a dhéanamh ar a 
hiontaoibh, ag daoine nó ag eintitis seachas an faighteoir beartaithe. Má fuair 
tú é seo trí dhearmad, téigh i dteagmháil leis an seoltóir, le do thoil, agus 
scrios an t-ábhar as aon ríomhaire. Is é beartas na Roinne Dlí agus Cirt, 
Comhionannais agus Athchóirithe Dlí, agus na nOifígí agus na nGníomhaireachtaí 
a úsáideann seirbhísí TF na Roinne, seoladh ábhair cholúil a dhícheadú.
Más rud é go measann tú gur ábhar colúil atá san ábhar atá sa teachtaireacht 
seo is ceart duit dul i dteagmháil leis an seoltóir láithreach agus le 
mailminder[ag]justice.ie chomh maith. 
***



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

Re: [R] optim() question

2009-05-27 Thread John C Nash

Some thought about this overnight led to conclusion that a capability
to follow from one method to another could be quite useful. Moreover,
it should be pretty easy to fit it into our current trial version of 
optimx()

as we call the function. More at UseR.

JN


Ravi Varadhan wrote:
 
Stephen,


No.  Currently, AFAIK, there is no such switching algorithm for optimization
in R.  John Nash and I are working on a package for integrating various
optimization tools (for smooth, box-constrained optimization) in R.  This
will have a function that can run through multiple algorithms.  While this
is not exactly what you are asking for, it can be quite useful for your
purposes, which I assume is to find a local optimum in a reliable fashion.

Ravi.

...
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Stephen Collins
Sent: Tuesday, May 26, 2009 2:48 PM
To: r-h...@stat.math.ethz.ch
Subject: [R] optim() question

I've seen with other software the capability for the optimizer to switch
algorithms if it is not making progress between iterations.  Is this
capability available in optim()?

Thanks,
 
Stephen Collins, MPP | Analyst

Health & Benefits | Aon Consulting



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Hierarchical glm with binomial family

2009-05-27 Thread Johan Stenberg
Dear members of the R help list,

I want to do a hierarchical glm with binomial family but am unsure
about how to write the syntax which involves nesting.

I want to test whether the risk of being attacked by Herbivores for
Meadowsweet plants is significantly dependent on the Distance to
heterospecific source plants.

Dependent variable = Herbivory (yes/no)
Explanatory continuous variable = Distance to heterospecific source plant

Distance should be nested within Subpopulation which in turn should be
nested within Population.
The number of replicates per subpopulation varies between 8 and 36.
The number of subpopulations per population varies between 4 and 9.

I haven't figured out how to do nesting, but guessing that nesting is
denoted with brackets I guess the syntax should look something like
this (below). Could you please help me to correct this syntax so that
it becomes useful in R?

model<-glm(Herbivory~Distance(Subpopulation(Population)), family=binomial)

Thanks a lot! I deeply appreciate your non-profit engagement!

Johan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Sort matrix by column 1 ascending then by column 2 decending

2009-05-27 Thread Henrique Dallazuanna
Try this:

cbind(sort(x[,1]), unlist(tapply(x[,2], x[,1], sort, decreasing = T)))

On Wed, May 27, 2009 at 9:39 AM, Paul Geeleher wrote:

> I've got a matrix with 2 columns and n rows. I need to sort it first
> by the values in column 1 ascending. Then for values which are the
> same in column 1, sort by column 2 decending. For example:
>
> 2 .5
> 1 .3
> 1 .5
> 3 .2
>
> Goes to:
>
> 1 .5
> 1 .3
> 2 .5
> 3 .2
>
> This is easy to do in spreadsheet programs but I can't seem to work
> out how to do it in R and haven't been able to find a solution
> anywhere.
>
>
> Thanks!
>
> -Paul.
>
> --
> Paul Geeleher
> School of Mathematics, Statistics and Applied Mathematics
> National University of Ireland
> Galway
> Ireland
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Harmonic Analysis

2009-05-27 Thread stephen sefick
why will a fourier transform not work?
2009/5/27 Uwe Ligges :
>
>
> Dieter Menne wrote:
>>
>>   alice.it> writes:
>>
>>> I am looking for a package to perform harmonic analysis with the goal of
>>> estimating the period of the
>>> dominant high frequency component in some mono-channel signals.
>>
>> You should widen your scope by looking a "time series" instead of harmonic
>> analysis. There is a task view on the subject at
>>
>> http://cran.at.r-project.org/web/views/TimeSeries.html
>
>
> ... or take a look at package tuneR.
>
> Uwe Ligges
>
>
>
>
>> Dieter
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Multiple ANOVA tests

2009-05-27 Thread Mike Lawrence
you could use ldply from the plyr package:

p = ldply(q,function(x){x$P})

Without you data I can't confirm that works, but something like that
should do it

On Wed, May 27, 2009 at 9:23 AM, Imri  wrote:
>
> Thanks for the answer!!!
> I Know how to extract the Pr(>F) value from single ANOVA table, but I have a
> list of many ANOVA tables recived by :
> a<-function(x)(aov(MPH~x))
> q<-apply(assoc[,18:20],2,a) # just for example, I have more than 3
> factors(x)
>
>> print(q)
> $X11_20502
>             Df  Sum Sq Mean Sq F value    Pr(>F)
> x             3   369.9   123.3   6.475 0.0002547 ***
> Residuals   635 12093.2    19.0
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> 246 observations deleted due to missingness
>
> $X11_21067
>             Df  Sum Sq Mean Sq F value Pr(>F)
> x             1    26.7    26.7  1.3662 0.2429
> Residuals   637 12436.4    19.5
> 246 observations deleted due to missingness
>
> $X11_10419
>             Df  Sum Sq Mean Sq F value    Pr(>F)
> x             3   527.8   175.9   9.361 4.621e-06 ***
> Residuals   635 11935.3    18.8
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> 246 observations deleted due to missingness
>
>> summary(q)
>          Length Class       Mode
> X11_20502 1      summary.aov list
> X11_21067 1      summary.aov list
> X11_10419 1      summary.aov list
>  How can I extract all the Pr(>F) values from q (not one by one)?
>
> Thanks
> Imri
>
>
>
> Mike Lawrence wrote:
>>
>> #create some data
>> y=rnorm(20)
>> x=factor(rep(c('A','B'),each=10))
>>
>> #run the anova
>> my_aov = aov(y~x)
>>
>> #summarize the anova
>> my_aov_summary = summary(my_aov)
>>
>> #show the anova summary
>> print(my_aov_summary)
>>
>> #lets see what's in the summary object
>> str(my_aov_summary)
>>
>> #looks like it's a list with 1 element which
>> #in turn is a data frame with columns.
>> #The "Pr(>F)" column looks like what we want
>> my_aov_summary[[1]]$P
>>
>> #yup, that's it. Grab the first value
>> p = my_aov_summary[[1]]$P[1]
>>
>>
>> On Wed, May 27, 2009 at 7:11 AM, Imri  wrote:
>>>
>>> Hi all -
>>> I'm trying to do multiple one-way ANOVA tests of different factors on the
>>> same variable. As a result I have a list with all the ANOVA tables, for
>>> exemple:
>>>
>>> $X11_20502
>>> Analysis of Variance Table
>>>
>>> Response: MPH
>>>           Df  Sum Sq Mean Sq F value    Pr(>F)
>>> x           3   369.9   123.3   6.475 0.0002547 ***
>>> Residuals 635 12093.2    19.0
>>> ---
>>> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>>>
>>> $X11_21067
>>> Analysis of Variance Table
>>>
>>> Response: MPH
>>>           Df  Sum Sq Mean Sq F value Pr(>F)
>>> x           1    26.7    26.7  1.3662 0.2429
>>> Residuals 637 12436.4    19.5
>>>
>>> $X11_10419
>>> Analysis of Variance Table
>>>
>>> Response: MPH
>>>           Df  Sum Sq Mean Sq F value    Pr(>F)
>>> x           3   527.8   175.9   9.361 4.621e-06 ***
>>> Residuals 635 11935.3    18.8
>>> ---
>>> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>>>
>>> My question is how can I extract from this list, just the Pr(>F) values
>>> for
>>> each x ?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Multiple-ANOVA-tests-tp23739615p23739615.html
>>> Sent from the R help mailing list archive at Nabble.com.
>>>
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>>
>> --
>> Mike Lawrence
>> Graduate Student
>> Department of Psychology
>> Dalhousie University
>>
>> Looking to arrange a meeting? Check my public calendar:
>> http://tr.im/mikes_public_calendar
>>
>> ~ Certainty is folly... I think. ~
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Multiple-ANOVA-tests-tp23739615p23741437.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University

Looking to arrange a meeting? Check my public calendar:
http://tr.im/mikes_public_calendar

~ Certainty is folly... I think. ~

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

Re: [R] r-plot

2009-05-27 Thread Jim Lemon

durden10 wrote:

Dear R-community

I have a grueling problem which appears to be impossible to solve:
I want to make a simple plot, here is my code: http://gist.github.com/118550
Unfortunately, the annotation of both the x- and y-axis are not correct, as
you can see in the following picture: 
http://www.nabble.com/file/p23739356/plot.png 
I am not an expert of R, so maybe someone can point me to the solution of

this problem, i.e. both of the axes should start and end at the min / max
values of the two vectors.

  

Hi Durden,
This example seems to work for me. Is it just the X and Y axis labels 
that you want?


data_corr<-data.frame(
Win=c(-0.08,-0.07,-0.01,-0.01,0.03,0.08,0.1,0.13,
 0.18,0.19,0.195,0.2,0.28,0.3,0.4),
Calgary=c(11,7,5,4,3,8,6,7,3,2,1,8,0,1,3)
)
par(tcl=0.35,xaxs="r") # Switch tick marks to insides of axes
plot(data_corr, type = "p", xlab="VS signal change",
ylab="Depression scale",axes=FALSE, col = "blue", lwd = 2)
#y-axis
axis(2, tcl=0.35,at=0:11)
#x-axis
test2<-seq(0,0.4,by=0.1)
axis(1, tcl=0.35,at=test2)
box()
abline(lm(data_corr[,2]~data_corr[,1]))

Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


  1   2   >