Re: [R] FW: logistic regression

2008-10-06 Thread Frank E Harrell Jr

Kjetil Halvorsen wrote:

Hola!

If the original questioner wants a guide as to how variables to measure
IN THE FUTURE, when using his model in practice, thwen I think he will 
be unhappy with any advice which forces him to measure each of the 44 
variables

when probably a small subset will do!   What is wrong with first using, let
us say, penalized likelihood, maybe with CV to choose degree of smoothing,
and SECONDLY using stepwise (maybee stepAIC from MASS) with
the predicted values from the first step model to get a good 
few-vatiables approximation which can be used in practice? If my memory 
is'nt too bad, that

idea is from harrel's book.


No, I never recommended that.  The probably is the extremely low 
probability that the method will find the "right" variables.  The 
process is unstable, and predicted values do not validate well.  If you 
want parsimony then a unified approach based on an L1 penalty (lasso an 
derivatives) is worth a look.  These methods select variables and 
penalize the remaining variables.  The coefficients will be different 
than had the remaining variables been put into an unpenalized model, 
i.e., the method penalizes for the context of not knowing the right 
variables in advance.


The penalized likelihood step you proposed is a good one but the 
unpenalized stepwise method in the second step runs into problems.


Frank



Kjetil

On Mon, Sep 29, 2008 at 9:50 PM, Frank E Harrell Jr 
<[EMAIL PROTECTED] > wrote:


Greg Snow wrote:

-Original Message-
From: [EMAIL PROTECTED]

[mailto:[EMAIL PROTECTED] 
project.org ] On Behalf Of Frank E
Harrell Jr
Sent: Saturday, September 27, 2008 7:15 PM
To: Darin Brooks
Cc: [EMAIL PROTECTED]
;
[EMAIL PROTECTED] ;
[EMAIL PROTECTED]

Subject: Re: [R] FW: logistic regression

Darin Brooks wrote:

Glad you were amused.

I assume that "booking this as a fortune" means that
this was an

idiotic way

to model the data?

Dieter was nominating this for the "fortunes" package in R.
 (Thanks
Dieter)

MARS?  Boosted Regression Trees?  Any of these a better
choice to

extract

significant predictors (from a list of about 44) for a
measured

dependent

variable?

Or use a data reduction method (principal components, variable
clustering, etc.) or redundancy analysis (to remove individual
predictors before examining associations with Y), or fit the
full model
using penalized maximum likelihood estimation.  lasso and
lasso-like
methods are also worth pursuing.


Frank (and any others who want to share an opinion):

What are your thoughts on model averaging as part of the above list?


Model averaging has good performance but no advantage over fitting a
single complex model using penalized maximum likelihood estimation.

Frank




--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED] 
801.408.8111





-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine

Department of Biostatistics   Vanderbilt University

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





--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University

__
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] column-wise z-scores by group

2008-10-06 Thread DISCCRS
Hi,

I have a dataset of historical monthly temperature data that is grouped by
weather station. I want to create z-scores of the monthly data using a base
period of a subset of years. I subset the dataset first to include only data
from the years (V2) that make up the base period so I could calculate the
appropriate means and standard deviations

 V1   V2V3   V12   V15   V16   V19
8411084 1978 40.16 63.13 44.06 63.41 63.47
8511084 1979 43.71 60.88 48.09 64.64 62.34
8611084 1980 50.61 61.64 47.93 62.10 63.45
8711084 1981 42.11 63.59 47.29 63.42 63.37
1583  18469 1978 30.78 56.93 34.62 56.40 57.39
1584  18469 1979 33.48 57.68 37.76 58.70 57.30
1585  18469 1980 40.83 54.48 39.27 56.14 57.42
1586  18469 1981 33.33 56.28 37.57 56.20 56.47
2688  25467 1978 52.61 75.51 55.02 68.20 70.70
2689  25467 1979 47.95 74.54 50.70 67.58 70.24
2690  25467 1980 55.12 72.51 56.59 66.49 71.21
2691  25467 1981 56.70 70.33 57.65 69.35 72.16

Then I split the data by group ID (V1) and got the means and std deviations:

subsets <- split(test,V1)
sub.means <- data.frame(t(sapply(subsets, mean)))
sub.sds <- data.frame(t(sapply(subsets, sd, na.rm=T)))

Here are the means, for example:

   V1 V2  V3 V12 V15 V16 V19
11084   11084 1979.5 44.1475 62.3100 46.8425 63.3925 63.1575
18469   18469 1979.5 34.6050 56.3425 37.3050 56.8600 57.1450
25467   25467 1979.5 53.0950 73.2225 54.9900 67.9050 71.0775

How can I approach the next step -- applying the means and std deviations
from the two new arrays that I created to the original dataset (by station
and by month)? Or should I be using a different approach entirely? There are
NAs throughout the dataset.
Thanks very much in advance.

-Jennifer

[[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] random normally distributed values within range

2008-10-06 Thread Matthias Kohl

one could also use the "Truncate"-methods of package distr; cf.
http://tolstoy.newcastle.edu.au/R/e5/help/08/09/1870.html

If the situation is extreme Peter Daalgard gave some sophisticated code at
http://tolstoy.newcastle.edu.au/R/e5/help/08/09/1892.html

Best,
Matthias

Rolf Turner wrote:


On 7/10/2008, at 11:54 AM, Achaz von Hardenberg wrote:


Hi all,
I need to create 100 normally distributed random values (X) which can
not exceed a specific range (i.e. 0

Presumably you want a truncated normal distribution.  Duncan Murdoch
posted some neat code on this list, back in the end of July this year,
to generate samples from such a distribution.


See:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/137154.html

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.


--
Dr. Matthias Kohl
www.stamats.de

__
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] fitting a curve to data points

2008-10-06 Thread Rolf Turner


On 7/10/2008, at 2:53 PM, Carlos Guâno Grohmann wrote:


Hello all. This is likely to be a silly question, but I have a set of
data points and I want to fit a curve to it, like this:
http://www.igc.usp.br/pessoais/guano/temp/curve.png.

which function should I use?


Have a look at smooth.spline() and loess().

cheers,

Rolf Turner
##
Attention: 
This e-mail message is privileged and confidential. If you are not the 
intended recipient please delete the message and notify the sender. 
Any views or opinions presented are solely those of the author.


This e-mail has been scanned and cleared by MailMarshal 
www.marshalsoftware.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] Load a program at the front end

2008-10-06 Thread Bernardo Rangel Tura
Em Qui, 2008-10-02 às 14:36 -0400, Gang Chen escreveu:
> I want to run a R program, prog.R,  interactively. My question is, is
> there a way I can start prog.R on the shell terminal when invoking R,
> instead of using source() inside R?
> 
> TIA,
> Gang

Hi Gang

I my system just only type:

 R --no-save 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] The Innagural Atlanta useR Group Meeting!

2008-10-06 Thread zubin
Announcing a new Meetup for Atlanta useR Group (R Programming Language)!
>
> What: The Innagural Atlanta useR Group Meeting!
>
> When: November 5, 2008 7:00 AM
>
> Where: Click the link below to find out!
>
> Meetup Description: Hello All!
>
> I am putting this on the books for the first Atlanta useR meeting. I 
> apologize fro the delays, but I think everyone will be happy that we 
> waited. The plan is to have a catered breakfast meeting at Maggiano's 
> thanks to the generous folks as 5x5 and IHG. The agenda is still up 
> for grabs, but for now, the thoughts are.
>
> 1. Intro to R
> 2. Comparisons with SAS
> 3. Where to find more
>
> There is also an idea of some sort of contest (i.e. how to solve a 
> problem in R) with a potential prize. Any other ideas about content 
> will be appreciated, like are there more advanced users who want more 
> than an intro. Finally, there will be a raffle for a book generously 
> donated by CRC press (Statistical Computing with R by Maria L. Rizzo).
>
> Since this is a catered event, I need everyone that is interested to 
> RSVP as soon as possible. To this end, I will need to know who/how 
> many are coming by the end of this week.
>
> As always, if you have questions or concerns please feel free to 
> contact me.
>
> Cheers,
> Derek
>
> Learn more here:
> http://businessintell.meetup.com/4/calendar/8908133/
>
>
>
>
> --
> Please Note: If you hit "*REPLY*", your message will be sent to 
> *everyone* on this mailing list ([EMAIL PROTECTED] 
> )
> This message was sent by Derek M Norton ([EMAIL PROTECTED]) from 
> Atlanta useR Group (R Programming Language) 
> .
> To learn more about Derek M Norton, visit his/her member profile 
> 
> To unsubscribe or to update your mailing list settings, click here 
> 
>
> Meetup Support: [EMAIL PROTECTED]
> 632 Broadway, New York, NY 10012 USA 

[[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] fitting a curve to data points

2008-10-06 Thread Carlos "Guâno" Grohmann
Hello all. This is likely to be a silly question, but I have a set of
data points and I want to fit a curve to it, like this:
http://www.igc.usp.br/pessoais/guano/temp/curve.png.

which function should I use?

many thanks

Carlos

-- 
+---+
  Carlos Henrique Grohmann - Guano
  Geologist M.Sc  - Doctorate Student at IGc-USP - Brazil
Linux User #89721  - carlos dot grohmann at gmail dot com
+---+
_
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke

Can't stop the signal.

__
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] libg2c.so with new Debian

2008-10-06 Thread Erin Hodgess
Hi R People:

I just installed Debian on my desktop and am compiling R from source.

However, I'm getting the error message:

checking for Fortran 77 libraries of f77...
checking how to get verbose linking output from gcc -std=gnu99... -v
checking for C libraries of gcc -std=gnu99...  -L/usr/local/lib
-L/usr/lib/gcc/i486-linux-gnu/4.3.2
-L/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib -L/lib/../lib
-L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.3.2/../../.. -lgcc_s
checking for dummy main to link with Fortran 77 libraries... none
checking for Fortran 77 name-mangling scheme... lower case,
underscore, extra underscore
checking whether f77 appends underscores to external names... yes
checking whether f77 appends extra underscores to external names... yes
checking whether mixed C/Fortran code can be run... configure:
WARNING: cannot run mixed C/Fortran code
configure: error: Maybe check LDFLAGS for paths to Fortran libraries?
[EMAIL PROTECTED]:~/Desktop/R-2.7.2$

I know that it's looking for libg2c.so, but I can't seem to find that
library.  When I check on the Internet, it is deprecated.

Any suggestions, please?

Thanks in advance,
Sincerely,
Erin

-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: [EMAIL PROTECTED]

__
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] Automatic code diagramming for R?

2008-10-06 Thread Erik Iverson
This thread mentioning package mvbutils, function foodweb() might give 
you a start?


http://tolstoy.newcastle.edu.au/R/help/06/04/24587.html

Best,
Erik

Ben Bryant wrote:

Greetings -

Is anyone aware of an automatic code diagrammer/flow chart creator that
works for the R language (either a contributed package, or external
software)?  I need to explain some code structure of a package I'm working
on to non-R users, and would find it extremely helpful to have such a
program similar to, for example, Visustin (
http://www.aivosto.com/visustin.html ).  I can do it "by hand" (possibly
with the help of the 'diagram' package) but it seems like automated
capabilities for recognizing nested structures and argument-passing would be
of good general use to package developers.

Much appreciated,
-Ben Bryant

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


Re: [R] FW: logistic regression

2008-10-06 Thread Kjetil Halvorsen
Hola!

If the original questioner wants a guide as to how variables to measure
IN THE FUTURE, when using his model in practice, thwen I think he will be
unhappy with any advice which forces him to measure each of the 44 variables
when probably a small subset will do!   What is wrong with first using, let
us say, penalized likelihood, maybe with CV to choose degree of smoothing,
and SECONDLY using stepwise (maybee stepAIC from MASS) with
the predicted values from the first step model to get a good few-vatiables
approximation which can be used in practice? If my memory is'nt too bad,
that
idea is from harrel's book.

Kjetil

On Mon, Sep 29, 2008 at 9:50 PM, Frank E Harrell Jr <
[EMAIL PROTECTED]> wrote:

> Greg Snow wrote:
>
>> -Original Message-
>>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>>> project.org] On Behalf Of Frank E Harrell Jr
>>> Sent: Saturday, September 27, 2008 7:15 PM
>>> To: Darin Brooks
>>> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED];
>>> [EMAIL PROTECTED]
>>> Subject: Re: [R] FW: logistic regression
>>>
>>> Darin Brooks wrote:
>>>
 Glad you were amused.

 I assume that "booking this as a fortune" means that this was an

>>> idiotic way
>>>
 to model the data?

>>> Dieter was nominating this for the "fortunes" package in R.  (Thanks
>>> Dieter)
>>>
>>>  MARS?  Boosted Regression Trees?  Any of these a better choice to

>>> extract
>>>
 significant predictors (from a list of about 44) for a measured

>>> dependent
>>>
 variable?

>>> Or use a data reduction method (principal components, variable
>>> clustering, etc.) or redundancy analysis (to remove individual
>>> predictors before examining associations with Y), or fit the full model
>>> using penalized maximum likelihood estimation.  lasso and lasso-like
>>> methods are also worth pursuing.
>>>
>>
>> Frank (and any others who want to share an opinion):
>>
>> What are your thoughts on model averaging as part of the above list?
>>
>
> Model averaging has good performance but no advantage over fitting a single
> complex model using penalized maximum likelihood estimation.
>
> Frank
>
>
>>
>> --
>> Gregory (Greg) L. Snow Ph.D.
>> Statistical Data Center
>> Intermountain Healthcare
>> [EMAIL PROTECTED]
>> 801.408.8111
>>
>>
>>
>>
>
> --
> Frank E Harrell Jr   Professor and Chair   School of Medicine
> Department of Biostatistics   Vanderbilt University
>
> __
> 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] Fisher inverse cumulative probabilities

2008-10-06 Thread David Scott

On Mon, 6 Oct 2008, Raphael Saldanha wrote:


Hi!
How can I retrieve fisher's inverse cumulative probabilities, like, in
Excel, with=INF(0.05,2;6) ?





qf(0.95,2,6)

[1] 5.143253

which is the same as
=FINV(0.05,2,6)

in Excel, presuming that is what you are after.

Remember that on this list and generally among statisticians R gives the 
definitive answer rather than Excel.


David Scott



_
David Scott Department of Statistics, Tamaki Campus
The University of Auckland, PB 92019
Auckland 1142,NEW ZEALAND
Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000
Email:  [EMAIL PROTECTED]

Graduate Officer, Department of Statistics
Director of Consulting, Department of Statistics

__
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] Automatic code diagramming for R?

2008-10-06 Thread Gabor Grothendieck
findGlobals in the codetools package can find all the functions
that a function calls and you could construct a call graph
from that by combining that with RGraphviz in Bioconductor.

For example, the proto package can automatically create a graph
using RGraphviz showing the parent child relationship among the proto
objects in a program.  The graph at the top of the following page was generated
like that from the program that you can view by clicking on the image:
http://code.google.com/p/r-proto/wiki/Overview
Its mainly applicable if you use proto but does illustrate the use of
RGraphviz.

On Mon, Oct 6, 2008 at 8:32 PM, Ben Bryant <[EMAIL PROTECTED]> wrote:
> Greetings -
>
> Is anyone aware of an automatic code diagrammer/flow chart creator that
> works for the R language (either a contributed package, or external
> software)?  I need to explain some code structure of a package I'm working
> on to non-R users, and would find it extremely helpful to have such a
> program similar to, for example, Visustin (
> http://www.aivosto.com/visustin.html ).  I can do it "by hand" (possibly
> with the help of the 'diagram' package) but it seems like automated
> capabilities for recognizing nested structures and argument-passing would be
> of good general use to package developers.
>
> Much appreciated,
> -Ben Bryant
>
>[[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] Fisher inverse cumulative probabilities

2008-10-06 Thread Raphael Saldanha
Hi!
How can I retrieve fisher's inverse cumulative probabilities, like, in
Excel, with=INF(0.05,2;6) ?


Regards,

Raphael Saldanha
UFJF - Brazil

[[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] Automatic code diagramming for R?

2008-10-06 Thread Ben Bryant
Greetings -

Is anyone aware of an automatic code diagrammer/flow chart creator that
works for the R language (either a contributed package, or external
software)?  I need to explain some code structure of a package I'm working
on to non-R users, and would find it extremely helpful to have such a
program similar to, for example, Visustin (
http://www.aivosto.com/visustin.html ).  I can do it "by hand" (possibly
with the help of the 'diagram' package) but it seems like automated
capabilities for recognizing nested structures and argument-passing would be
of good general use to package developers.

Much appreciated,
-Ben Bryant

[[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] random normally distributed values within range

2008-10-06 Thread Rolf Turner


On 7/10/2008, at 11:54 AM, Achaz von Hardenberg wrote:


Hi all,
I need to create 100 normally distributed random values (X) which can
not exceed a specific range (i.e. 0

Presumably you want a truncated normal distribution.  Duncan Murdoch
posted some neat code on this list, back in the end of July this year,
to generate samples from such a distribution.


See:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/137154.html

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] random normally distributed values within range

2008-10-06 Thread Pedro.Rodriguez
Hi Achaz,

Maybe you are interested in the generalized beta distribution?

To the best of my knowledge, there is no way to restrict the values of
normal deviates, since one may end up with a different distribution.

Regards,

Pedro 

 



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Achaz von Hardenberg
Sent: Monday, October 06, 2008 6:55 PM
To: r-help@r-project.org
Subject: [R] random normally distributed values within range

Hi all,
I need to create 100 normally distributed random values (X) which can  
not exceed a specific range (i.e. 0https://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] querry in simple "for" loop in Box plot

2008-10-06 Thread jim holtman
worked fine for me (after removing 'data=xx' which may have caused
caused problems since it is supposed to be a dataframe or a list, not
a matrix)

> par(mfrow=c(3,2))
> for(i in 2:7)
+ {
+ boxplot(xx[,i]~xx[,1],xlab="lev")
+ print(i)
+ }
[1] 2
[1] 3
[1] 4
[1] 5
[1] 6
[1] 7


On Mon, Oct 6, 2008 at 12:55 PM, Shanta Man Shakya <[EMAIL PROTECTED]> wrote:
> Dear R users,
>
> I am new users of this software. I want to make box plot. Here, i have 
> simulated data set with following commands:
>
> x<-matrix(rnorm(90),nrow=10,ncol=9)
> x
> a<-matrix(c(1,1,1,1,1,2,2,2,2,2),nrow=10,ncol=1)
> xx<-cbind(a,x)
> colnames(xx)<-c("a","b","c","d","e","f","g","h","i","j")
> rownames(xx)<-c("bro","cc","tu","so","ys","vt","ft","pc","ro","rc")
> xx
> factor(xx[,1])
>
> Here, i want to make boxplot of group "1" and "2" of column "a" by using 
> "for" loop because i have very large real data set.
> I tried by using following "for" loop but it is not working.
>
>> par(mfrow=c(3,2))
> for(i in 2:7)
> {
> boxplot(xx[,i]~xx[,1],data=xx,xlab="lev")
> print(i)
> }
>  # I am getting following message:
>
> Error in eval(expr, envir, enclos) :
>   only 0's may be mixed with negative subscripts
>
> I could not find what's wrong in writing "for" loop. I think this is very 
> simple for regular users. I request for finding my mistakes and correction on 
> it.
>
> Thanks,
>
> SHANT
>
>
>
>[[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.
>
>



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

What is the problem that you are trying to solve?

__
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] random normally distributed values within range

2008-10-06 Thread Achaz von Hardenberg

Hi all,
I need to create 100 normally distributed random values (X) which can  
not exceed a specific range (i.e. 0With rnorm I cannot specify Max and min  values among which values  
have to stay, like in runif so does some other simple way exist to do  
this with normally distributed random values?


thanks a lot in advance,

Dr. Achaz von Hardenberg
 


Centro Studi Fauna Alpina - Alpine Wildlife Research Centre
Servizio Sanitario e della Ricerca Scientifica
Parco Nazionale Gran Paradiso, Degioz, 11, 11010-Valsavarenche (Ao),  
Italy


__
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] Graphics window BUG

2008-10-06 Thread T.D.Rudolph

I think I managed to figure out the problem (for the record I use Windows XP
2002):

One is required to set options in Edit-GUI Preferences, then change "Pager
style" to single window.  In the graphics window (x11()) choose
History-Clear History, then History-Record each time you wish to generate a
new series of figures for review in the single window (as opposed to
numerous separate ones).  At this point scrolling using PgUp and PgDn seems
to work fine.

Tyler


T.D.Rudolph wrote:
> 
> I thought this problem would be resolved when I switched to R version
> 2.7.0 (for Windows), but no - anytime I plot something that produces more
> than one page of graphics, the graphics window starts by showing the first
> page, until such time as I hit enter to show me the next page, at which
> time it speeds through every consecutive page and freezes on the last one. 
> At this point the last page is all I see and I am incapable of scrolling
> from one graphic to the next as I see fit.  I have had this problem for as
> long as I have used R; recording history doesn't seem to help
> 
> Tyler
> 

-- 
View this message in context: 
http://www.nabble.com/Graphics-window-BUG-tp19844961p19845962.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 on the Freakonomics Blog

2008-10-06 Thread Scillieri, John
http://freakonomics.blogs.nytimes.com/2008/10/06/free-super-crunching-so
ftware/

>>> This e-mail and any attachments are confidential, may contain legal,
professional or other privileged information, and are intended solely for the
addressee.  If you are not the intended recipient, do not use the information
in this e-mail in any way, delete this e-mail and notify the sender. CEG-IP2

__
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] Graphics window BUG

2008-10-06 Thread T.D.Rudolph

I thought this problem would be resolved when I switched to R version 2.7.0
(for Windows), but no - anytime I plot something that produces more than one
page of graphics, the graphics window starts by showing the first page,
until such time as I hit enter to show me the next page, at which time it
speeds through every consecutive page and freezes on the last one.  At this
point the last page is all I see and I am incapable of scrolling from one
graphic to the next as I see fit.  I have had this problem for as long as I
have used R; recording history doesn't seem to help

Tyler
-- 
View this message in context: 
http://www.nabble.com/Graphics-window-BUG-tp19844961p19844961.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] Sweave and echoing code chunks conditionally

2008-10-06 Thread Sean Davis
On Mon, Oct 6, 2008 at 3:30 PM, Gabor Grothendieck
<[EMAIL PROTECTED]> wrote:
> Try
>
> \SweaveOpts{echo=FALSE}
> or
> \SweaveOpts{echo=TRUE}

Perfect (and obvious).  Thanks.

Sean


> to set the default for echo one way or the other.
>
> On Mon, Oct 6, 2008 at 3:27 PM, Sean Davis <[EMAIL PROTECTED]> wrote:
>> I have started to use Sweave to prepare reports for "end-users" of
>> statistical analyses.  For these users, there is not generally
>> interest in the code used to accomplish the analysis, but only the
>> results.  However, sometimes I would like to prepare the same
>> document, but with code chunks echoed, for my own use "on-the-fly"
>> when discussing the statistical results.  Is there a convenient way to
>> set things up so that with a single switch I can change things like
>> echo behavior throughout a document?  Of course, a quick sed script
>> would do the trick, but I was interested in other ideas?
>>
>> Thanks,
>> Sean
>>
>> __
>> 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] Sweave and echoing code chunks conditionally

2008-10-06 Thread Gabor Grothendieck
Try

\SweaveOpts{echo=FALSE}
or
\SweaveOpts{echo=TRUE}

to set the default for echo one way or the other.

On Mon, Oct 6, 2008 at 3:27 PM, Sean Davis <[EMAIL PROTECTED]> wrote:
> I have started to use Sweave to prepare reports for "end-users" of
> statistical analyses.  For these users, there is not generally
> interest in the code used to accomplish the analysis, but only the
> results.  However, sometimes I would like to prepare the same
> document, but with code chunks echoed, for my own use "on-the-fly"
> when discussing the statistical results.  Is there a convenient way to
> set things up so that with a single switch I can change things like
> echo behavior throughout a document?  Of course, a quick sed script
> would do the trick, but I was interested in other ideas?
>
> Thanks,
> Sean
>
> __
> 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] Sweave and echoing code chunks conditionally

2008-10-06 Thread Sean Davis
I have started to use Sweave to prepare reports for "end-users" of
statistical analyses.  For these users, there is not generally
interest in the code used to accomplish the analysis, but only the
results.  However, sometimes I would like to prepare the same
document, but with code chunks echoed, for my own use "on-the-fly"
when discussing the statistical results.  Is there a convenient way to
set things up so that with a single switch I can change things like
echo behavior throughout a document?  Of course, a quick sed script
would do the trick, but I was interested in other ideas?

Thanks,
Sean

__
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] 3 curves / 1 plot

2008-10-06 Thread Julian Burgos
You can use the points() and lines() functions to add points and lines 
to an existing plot.


Julian

Michel PETITJEAN wrote:

I am a new user of R.
Please does somebody knows how to plot 3 datasets
(x1,a1),...,(xn,an), (x1,b1),...,(xn,bn), and (x1,c1),...,(xn,cn)
on a single x,y plot, each of the three datasets being plotted with
its own character pch() ?
(three calls to plot() erase the two first datasets).
Thank you very much.

Michel Petitjean,
DSV/iBiTec-S/SB2SM (CNRS URA 2096), CEA Saclay, bat. 528,
91191 Gif-sur-Yvette Cedex, France.
Phone: +331 6908 4006 / Fax: +331 6908 4007
E-mail: [EMAIL PROTECTED]
http://petitjeanmichel.free.fr/itoweb.petitjean.html

__
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] Lattice and Axis height

2008-10-06 Thread Deepayan Sarkar
On Mon, Oct 6, 2008 at 10:37 AM, Saptarshi Guha
<[EMAIL PROTECTED]> wrote:
> Hello,
> My plots consist of 2 rows, 1 column, many pages
> I've managed to selectively turn of strips for the bottom panel and
> roll my own strip for the top
>
>  par.strip.text = list(lines = c(0,3),cex=0.6)
>
> I have my own custom prepanel function too.
> What i'd like to do is turn off the x-axis for the top panel (since on
> a given page the xlim is same for both top and bottom panel, but the
> ylims are different)
> I've tried scales(x=list(draw=(T,F),relation="free") which doesn't
> work(i'm still using relation="free")
> (Relation="same" doesn't reflect the changing xlims for each page)
> In the lattice book, it mentions that panel, strip and between are
> replicated and axis.top seems useful but don't know
> how to use.
>
> Since these the bottom strip of every panel is grid viewport with a
> height, there could be an option to set the height to 0 when I'm the
> top panel.
> Or maybe like par.strip.text I could set it to a vector equal to the
> length of the panels, alternating (Draw,DontDraw,Draw,)
>
> Is this possible?

See

https://stat.ethz.ch/pipermail/r-help/2006-March/101248.html

Note that if your prepanel function gives you the same xlim for both
rows for a given column, you don't need to specify the limits
explicitly.

-Deepayan


> Regards
> Saptarshi
>
> P.S I'm essentially passing dummy variables to xyplot and for each
> value of the dummy variable pulling in data from a postgres database
> setting my limits for each panel based on the pulled in data and
> plotting that.
>
>
> Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha
>
>
>[[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.


Re: [R] Color of title in legend()

2008-10-06 Thread stephen sefick
not reproducible

On Mon, Oct 6, 2008 at 2:01 PM, Michael Kubovy <[EMAIL PROTECTED]> wrote:
> Dear R-helpers,
>
> This produces a red title. How do I make it black, without making the
> labels black?
>
> legend(title = 'Channel Integration', 0.7, 0.3,
> c('loudness','luminance'), col = c('red', 'blue'), text.col = c('red',
> 'blue'), lty = 1, xjust = 0.5, bty = 'n')
>
> _
> 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/
>
>
>
>
>
>[[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
Research Scientist
Southeastern Natural Sciences Academy

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] package question

2008-10-06 Thread stephen sefick
library()
viginette's usually describe how to use the packages with examples.

On Mon, Oct 6, 2008 at 2:24 PM, ANJAN PURKAYASTHA
<[EMAIL PROTECTED]> wrote:
> hi,
> am new to R. what command do i use to check of certain packages have been
> loaded?
> Also, it seems that most packages come with "vignette"- is this a document
> that describes the usage of the package?
> thanks for your help,
> anjan
>
> --
> =
> anjan purkayastha, phd
> bioinformatics analyst
> whitehead institute for biomedical research
> nine cambridge center
> cambridge, ma 02142
>
> purkayas [at] wi [dot] mit [dot] edu
> 703.740.6939
>
>[[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
Research Scientist
Southeastern Natural Sciences Academy

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] querry in simple "for" loop in Box plot

2008-10-06 Thread Shanta Man Shakya
Dear R users,

I am new users of this software. I want to make box plot. Here, i have 
simulated data set with following commands:

x<-matrix(rnorm(90),nrow=10,ncol=9)
x
a<-matrix(c(1,1,1,1,1,2,2,2,2,2),nrow=10,ncol=1)
xx<-cbind(a,x)
colnames(xx)<-c("a","b","c","d","e","f","g","h","i","j")
rownames(xx)<-c("bro","cc","tu","so","ys","vt","ft","pc","ro","rc")
xx
factor(xx[,1])

Here, i want to make boxplot of group "1" and "2" of column "a" by using "for" 
loop because i have very large real data set.
I tried by using following "for" loop but it is not working.

> par(mfrow=c(3,2))
for(i in 2:7)
{
boxplot(xx[,i]~xx[,1],data=xx,xlab="lev")
print(i)
}
 # I am getting following message: 

Error in eval(expr, envir, enclos) : 
  only 0's may be mixed with negative subscripts

I could not find what's wrong in writing "for" loop. I think this is very 
simple for regular users. I request for finding my mistakes and correction on 
it.

Thanks,

SHANT


  
[[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] package question

2008-10-06 Thread ANJAN PURKAYASTHA
hi,
am new to R. what command do i use to check of certain packages have been
loaded?
Also, it seems that most packages come with "vignette"- is this a document
that describes the usage of the package?
thanks for your help,
anjan

-- 
=
anjan purkayastha, phd
bioinformatics analyst
whitehead institute for biomedical research
nine cambridge center
cambridge, ma 02142

purkayas [at] wi [dot] mit [dot] edu
703.740.6939

[[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] question on lmList

2008-10-06 Thread Dieter Menne
eugen pircalabelu  yahoo.com> writes:

> Using the lmList function from “nlme package” I get the following error 
>> message: 
> 
> “Error in !unlist(lapply(sum.lst, is.null)) : invalid argument type”
> 

try str(zz) to check if your data are strange. And plot the data, maybe there is
something funny in the data set. Also try traceback() after the error occurred,
this could give you a hint what's wrong.

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] Color of title in legend()

2008-10-06 Thread Michael Kubovy
Dear R-helpers,

This produces a red title. How do I make it black, without making the  
labels black?

legend(title = 'Channel Integration', 0.7, 0.3,  
c('loudness','luminance'), col = c('red', 'blue'), text.col = c('red',  
'blue'), lty = 1, xjust = 0.5, bty = 'n')

_
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/





[[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] Stacked area chart and legends

2008-10-06 Thread hadley wickham
On Mon, Oct 6, 2008 at 10:54 AM, mbr <[EMAIL PROTECTED]> wrote:
>
> I have found lots of good advice on this forum about stacked area charts but
> I've run into problems with the 2 recommended options: stackploy in plotrix
> or qplot in ggplot2. I have a many page report that will be in a 2x2 page
> format "par(mfrow=c(2,2))"" and need one of the page components to be a
> stacked chart.
>
> I'd prefer to use stackpoly, if possible, but I'm stuck on how to do the
> legend in hopefully a relatively simple way. I just need a simple legend to
> be outside the plot area (b/c the plot area is full as I'm doing it as 100%
> stacked area chart format) on the right side with the little box with the
> color and the series name next to it – same/similar to Excel format.
>
> The qplot approach would work as well and seems like the legend is built
> into the default, but the graph always ends up on its own page and can't
> figure out how to force it into one of boxes of my 2x2 page layout. I like
> the looks of the stackpoly more as consistent with other graphs I have on
> report but qplot stacked chart would be fine if I could get it into the
> layout.

http://had.co.nz/ggplot2/book/grid.pdf describes how to position
multiple ggplots on the same page.  However, this won't work with a
mix of base graphics and grid graphics (like lattice or ggplot).  You
either need to create all of your plot with one plotting system, or
jump through some slightly painful hoops.

Hadley

-- 
http://had.co.nz/

__
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 and Axis height

2008-10-06 Thread Saptarshi Guha
Hello,
My plots consist of 2 rows, 1 column, many pages
I've managed to selectively turn of strips for the bottom panel and  
roll my own strip for the top

  par.strip.text = list(lines = c(0,3),cex=0.6)

I have my own custom prepanel function too.
What i'd like to do is turn off the x-axis for the top panel (since on  
a given page the xlim is same for both top and bottom panel, but the  
ylims are different)
I've tried scales(x=list(draw=(T,F),relation="free") which doesn't  
work(i'm still using relation="free")
(Relation="same" doesn't reflect the changing xlims for each page)
In the lattice book, it mentions that panel, strip and between are  
replicated and axis.top seems useful but don't know
how to use.

Since these the bottom strip of every panel is grid viewport with a  
height, there could be an option to set the height to 0 when I'm the  
top panel.
Or maybe like par.strip.text I could set it to a vector equal to the  
length of the panels, alternating (Draw,DontDraw,Draw,)

Is this possible?
Regards
Saptarshi

P.S I'm essentially passing dummy variables to xyplot and for each  
value of the dummy variable pulling in data from a postgres database
setting my limits for each panel based on the pulled in data and  
plotting that.


Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha


[[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] Need to calculate within- and between- run CV

2008-10-06 Thread Michal Figurski

Dear R-helpers,

I have a dataset named "qu", organized as follows:

Sample  Run Replicate   Value
1   1   1   25
1   1   2   40
1   1   3   33
1   1   4   29
1   2   1   37
1   2   2   44
1   2   3   45
1   3   1   25
1   3   2   40
1   4   1   33
1   4   2   29
1   4   3   25
2 ...

Basically, a sample was run on an assay multiple times within a single 
day. Each of these results is "Replicate". Then run was repeated several 
times in consecutive days - variable "Run". There are 210 such samples.


I need to actually calculate the CV for each sample:
 - within run (between replicates) - that's easy to do in Excel
 - between run - that's the problem.

I was thinking of using either 'aov' or 'lme' to solve this. However, I 
don't know how to interpret the output. For example, a summary output 
from "aov(Value~Run+Replicate, subset(qu,Sample==79))' for one sample was:


Df Sum Sq Mean Sq F value Pr(>F)
Run  1  4.000   4.000  0.3214 0.6104
Replicate1 73.500  73.500  5.9062 0.0933 .
Residuals3 37.333  12.444
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Do you guys think this is correct approach?
How do I extract these numbers (sum of squares) to store in a separate 
dataframe for further calculations?


And how should I interpret the "Residual" in this setting?

I will appreciate your comments.

--
Michal J. Figurski

__
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] Convert Binary to Decimal

2008-10-06 Thread Earl F. Glynn
"Jason Thibodeau" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hello,
>
> A few weeks ago I asked about converting a decimal number to binary. This
> time, I need to do the opposite, take a binary number, and convert ti to 
> its
> decimal equivalent. I have googled, but didn't find much in the way of
> elegant solutions. Since you all were such a help last time, I figured I'd
> ask you again.

Try a Google search for:
"Marc Schwartz"  bin2dec

efg
Earl F Glynn
Stowers Institute for Medical Research

__
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] Computing on the language redux

2008-10-06 Thread Bert Gunter

Warning: This is only for those interested in R language minutiae

A recent post on this list asked if there was a simple way to change the R
language object:

ex1 <- expression(x < a) ## just the part to the right of the <- assignment

to the object

expression( x < a & y < b)   ## or something like this

Phil Spector showed how to do this by essentially deparsing and reparsing
the string:

parse(text =paste(ex1, "& y < b"))

Howwever, Duncan Murdoch commented in a subsequent post that this approach
might fail under certain circumstances and that a better approach would be
to compute on the language object directly using the bquote() function:

ex1[[1]] <- bquote( .(ex1[[1]]) & y < b)

The important idea that Duncan highlighted was that expressions are just
special kinds of lists (parse trees, actually) and that this allows the list
assignment shown. He also mentioned that bquote() was a convenience function
based on the fundamental language object function, substitute(), and that
substitute() could be used directly, but it was somewhat tricky. For
completeness, I just wanted to show the substitute construction, which
actually doesn't seem all that tricky to me. Here is the complete code
sequence to check:

ex1 <- expression(x < a)   ## original
ex2 <- bquote( .(ex1[[1]]) & y < b) ## Using bquote
ex3 <- substitute( z & y < b,list(z = ex1[[1]])) ## using substitute
directly
identical(ex2,ex3) ##  TRUE


Cheers to all,

Bert Gunter
Genentech Nonclinical Statistics

__
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] Convert Binary to Decimal

2008-10-06 Thread Jason Thibodeau
Hello,

A few weeks ago I asked about converting a decimal number to binary. This
time, I need to do the opposite, take a binary number, and convert ti to its
decimal equivalent. I have googled, but didn't find much in the way of
elegant solutions. Since you all were such a help last time, I figured I'd
ask you again.

Thanks in advance,

Jason Thibodeau

[[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] easier way to do this without a loop? (successive euclidean distances between points)

2008-10-06 Thread Henrique Dallazuanna
Or just:

diag(rdist(z, z)[,-1])

On Mon, Oct 6, 2008 at 1:58 PM, Henrique Dallazuanna <[EMAIL PROTECTED]> wrote:
> Try this:
>
> diag(rdist(rbind(z, 0), rbind(0, z))[,-(1:2)])
>
> On Mon, Oct 6, 2008 at 1:49 PM, stephen sefick <[EMAIL PROTECTED]> wrote:
>> a <- c(1:10)
>> b <- c(.5, .6, .9, 10, .4, 3, 4, 9, 0, 11)
>> d <- c(21:30)
>>
>> z <- data.frame(a,b,d)
>> library(fields)
>> results <- c()
>> for(i in 1:(length(rownames(z))-1)){
>>  results[i] <- rdist(z[i,], z[(i+1),])
>>  }
>>
>> results.1 <- data.frame(results)
>>  f <- rownames(z)
>>  r <- f[-1]
>>  rownames(results.1) <- r
>>  colnames(results.1) <- f[1]
>>
>> this does what I want it to do - is there an easier/generic way of
>> doing this.  I will be using this to calculate euclidean distances
>> between successive time steps on ordination scores.
>> thanks
>>
>> --
>> Stephen Sefick
>> Research Scientist
>> Southeastern Natural Sciences Academy
>>
>> 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.
>>
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>



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

__
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] easier way to do this without a loop? (successive euclidean distances between points)

2008-10-06 Thread Henrique Dallazuanna
Try this:

diag(rdist(rbind(z, 0), rbind(0, z))[,-(1:2)])

On Mon, Oct 6, 2008 at 1:49 PM, stephen sefick <[EMAIL PROTECTED]> wrote:
> a <- c(1:10)
> b <- c(.5, .6, .9, 10, .4, 3, 4, 9, 0, 11)
> d <- c(21:30)
>
> z <- data.frame(a,b,d)
> library(fields)
> results <- c()
> for(i in 1:(length(rownames(z))-1)){
>  results[i] <- rdist(z[i,], z[(i+1),])
>  }
>
> results.1 <- data.frame(results)
>  f <- rownames(z)
>  r <- f[-1]
>  rownames(results.1) <- r
>  colnames(results.1) <- f[1]
>
> this does what I want it to do - is there an easier/generic way of
> doing this.  I will be using this to calculate euclidean distances
> between successive time steps on ordination scores.
> thanks
>
> --
> Stephen Sefick
> Research Scientist
> Southeastern Natural Sciences Academy
>
> 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.
>



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

__
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] easier way to do this without a loop? (successive euclidean distances between points)

2008-10-06 Thread stephen sefick
a <- c(1:10)
b <- c(.5, .6, .9, 10, .4, 3, 4, 9, 0, 11)
d <- c(21:30)

z <- data.frame(a,b,d)
library(fields)
results <- c()
for(i in 1:(length(rownames(z))-1)){
  results[i] <- rdist(z[i,], z[(i+1),])
 }

results.1 <- data.frame(results)
  f <- rownames(z)
  r <- f[-1]
  rownames(results.1) <- r
  colnames(results.1) <- f[1]

this does what I want it to do - is there an easier/generic way of
doing this.  I will be using this to calculate euclidean distances
between successive time steps on ordination scores.
thanks

-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

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] Computationally singular [provides coefficients but not covariance matrix]

2008-10-06 Thread dimitris kapetanakis

Hi,

I am estimating a regression but the summary command is unable to provide me
results, while the coefficients are available from the coefficients value. I
suppose that it cannot estimate the covariance matrix. Is there any command
that I can relax the tolerance so it can estimate the covariance matrix.

The code and the error of R is:

eq1<-rq(y~factor(year)+factor(state)+x1+x2+x3, tau=0.05, data=data1)

summary(eq1)

 summary(qr.05.nox)
Error in solve.default(crossprod(x)) : 
  system is computationally singular: reciprocal condition number =
4.51499e-31
Error in diag(solve(crossprod(x))) : 
  error in evaluating the argument 'x' in selecting a method for function
'diag'


Any help would be highly appreciated 

Thanks
-- 
View this message in context: 
http://www.nabble.com/Computationally-singular--provides-coefficients-but-not-covariance-matrix--tp19841443p19841443.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] stepplr

2008-10-06 Thread Uwe Ligges



stephen sefick wrote:

you are going to have to install it from source-  look at the type
argument in ?install.packages.  There is no windows binary.



The reason is that stepplr fails the checks under Windows, hence we do 
not provide a binary version. Please ask the package maintainer to fix 
the Windows issue.


Indeed, as Stephen Sefick pointed out already, if you want to risk using 
a package that does not pass the checks, you will need to compile it 
yourself.


Best wishes,
Uwe Ligges




On Mon, Oct 6, 2008 at 10:35 AM, Samor Gandhi <[EMAIL PROTECTED]> wrote:

Hello everybody,

I am trying to install the library stepplr under windows 
(http://www.maths.bris.ac.uk/R/web/packages/stepPlr/index.html), in order to 
use the function plr, but I still have problem to find the right link for this 
purpose!

I am very thankful for your help!
Samor

__
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] stepplr

2008-10-06 Thread stephen sefick
you are going to have to install it from source-  look at the type
argument in ?install.packages.  There is no windows binary.

On Mon, Oct 6, 2008 at 10:35 AM, Samor Gandhi <[EMAIL PROTECTED]> wrote:
> Hello everybody,
>
> I am trying to install the library stepplr under windows 
> (http://www.maths.bris.ac.uk/R/web/packages/stepPlr/index.html), in order to 
> use the function plr, but I still have problem to find the right link for 
> this purpose!
>
> I am very thankful for your help!
> Samor
>
> __
> 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
Research Scientist
Southeastern Natural Sciences Academy

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] Stacked area chart and legends

2008-10-06 Thread mbr

I have found lots of good advice on this forum about stacked area charts but
I’ve run into problems with the 2 recommended options: stackploy in plotrix
or qplot in ggplot2. I have a many page report that will be in a 2x2 page
format “par(mfrow=c(2,2))”” and need one of the page components to be a
stacked chart. 

I’d prefer to use stackpoly, if possible, but I’m stuck on how to do the
legend in hopefully a relatively simple way. I just need a simple legend to
be outside the plot area (b/c the plot area is full as I’m doing it as 100%
stacked area chart format) on the right side with the little box with the
color and the series name next to it – same/similar to Excel format.

The qplot approach would work as well and seems like the legend is built
into the default, but the graph always ends up on its own page and can’t
figure out how to force it into one of boxes of my 2x2 page layout. I like
the looks of the stackpoly more as consistent with other graphs I have on
report but qplot stacked chart would be fine if I could get it into the
layout.

Please let me know if you have any suggestions or could point me to
somewhere this has been discussed before. Many thanks for any help.


-- 
View this message in context: 
http://www.nabble.com/Stacked-area-chart-and-legends-tp19840703p19840703.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] Extracting text from html code using the RCurl package.

2008-10-06 Thread Tony Breyal
Dear R-help,

I want to download the text from a web page, however what i end up
with is the html code. Is there some option that i am missing in the
RCurl package? Or is there another way to achieve this? This is the
code i am using:

> library(RCurl)
> my.url <- 'https://stat.ethz.ch/mailman/listinfo/r-help'
> html.file <- getURI(my.url, ssl.verifyhost = FALSE, ssl.verifypeer = FALSE, 
> followlocation = TRUE)
> print(html.file)

I thought perhaps the htmlTreeParse() function from the XML package
might help, but I just don't know what to do next with it:

> library(XML)
> htmlTreeParse(html.file)

Many thanks for any help you can provide,
Tony Breyal


> sessionInfo()
R version 2.7.2 (2008-08-25)
i386-pc-mingw32

locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom.
1252;LC_MONETARY=English_United Kingdom.
1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252

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

other attached packages:
[1] XML_1.94-0  RCurl_0.9-4

__
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 in X11

2008-10-06 Thread Carlos Morales
Hello everyone,

I'm trying to plot a graphic in Linux, when I type X11() then I have an error 
which is the next: Error in X11(d$display, d$width, d$height, d$pointsize, 
d$gamma, d$colortype,  :
 unable to start device X11cairo

 
Why?, what I must do to fix it?. Thanks so much
 
Carlos




__
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] horizontal boxplot + xlim

2008-10-06 Thread Richard . Cotton
> True, I made a mistake here. Still, I have problems to visualize my data 
(not 
> the example code I used). I just see a flat line instead a proper 
plot...
> 
> Another example code with creating a strange plot:
> 
> x <- rnorm(100) + 100
> maxval <- max(x)
> boxplot(x, notch=TRUE, xlim = c(0,maxval), horizontal = TRUE)

When you use horizontal=TRUE, the meanings of the xlim and ylim arguments 
to boxplot are swapped.  Thus xlim affects the range of the vertical axis. 
 Take a look at 

boxplot(x, notch=TRUE, ylim = c(0,maxval))
and
boxplot(x, notch=TRUE, ylim = c(0,maxval), horizontal = TRUE)

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

__
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] stepplr

2008-10-06 Thread Samor Gandhi
Hello everybody,

I am trying to install the library stepplr under windows 
(http://www.maths.bris.ac.uk/R/web/packages/stepPlr/index.html), in order to 
use the function plr, but I still have problem to find the right link for this 
purpose!

I am very thankful for your help!
Samor

__
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] lmer: random factor nested in a fixed factor

2008-10-06 Thread Christian Ritz
Dear Agnes,

I think your model specification should look like this:

YourModel1 <- lmerlmer(y ~ poptype*matingtype + (1|poptype:pop) + 
(1|poptype:fam),
data = ...)


The "1" in front of "|" refers to models that are random intercepts models as 
opposed to
general random coefficients models in which case "1" would need to be replaced 
by a
variable that is quantitative. So, the "(poptype|/pop/fam)" construction is 
definitely not
relevant to your problem, unless "poptype" is a quantitative variable...

The combined factor "poptype:pop" corresponds to the factor pop, but taking the 
nesting
structure into account. Similar for the construction "poptype:fam".

>From the summary output of the lmer() fit you should be able to check whether 
>or not the
correct number of groups are used for these random factors.

Kind regards
Christian

__
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] horizontal boxplot + xlim

2008-10-06 Thread Antje

[EMAIL PROTECTED] schrieb:
I get a strange behaviour of a boxplot with the following code. 
There seems to 
be a problem with the xlim-parameter. Did I do anything wrong? What 
else can I 
do to force the boxplot to have a defined x-range?


x <- rnorm(100)
boxplot(x, notch=TRUE, xlab=parameter, xlim <- c(-4,4), horizontal = 

TRUE)

Did you mean xlim = c(-4,4) in that statement, rather than '<-'?


True, I made a mistake here. Still, I have problems to visualize my data (not 
the example code I used). I just see a flat line instead a proper plot...


Another example code with creating a strange plot:

x <- rnorm(100) + 100
maxval <- max(x)
boxplot(x, notch=TRUE, xlim = c(0,maxval), horizontal = TRUE)

Any idea?


Antje




Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

This message contains privileged and confidential information intended
for the addressee(s) only. If this message was sent to you in error,
you must not disseminate, copy or take any action in reliance on it and
we request that you notify the sender immediately by return email.

Opinions expressed in this message and any attachments are not
necessarily those held by the Health and Safety Laboratory or any person
connected with the organisation, save those by whom the opinions were
expressed.

Please note that any messages sent or received by the Health and Safety
Laboratory email system may be monitored and stored in an information
retrieval system.



Scanned by MailMarshal - Marshal's comprehensive email content security
solution. Download a free evaluation of MailMarshal at www.marshal.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] question on lmList

2008-10-06 Thread eugen pircalabelu
Hi list,

Using the lmList function from “nlme package” I get the following error 
message: 

“Error in !unlist(lapply(sum.lst, is.null)) : invalid argument type”

#  this is the syntax used
#  fm_cream <-lmList(MULTDV~TIME|cod, data=zz, na.action=na.omit)
#  summary(fm_cream)

When I generate a simple example the function works, but on the real data I get 
that message. I imagine that it is a common message when data is misused, but I 
don’t know where the problem could be. Has anyone encountered this message and 
what does it mean exactly? Is there a “guide” or something more detailed about 
the general error messages from different packages, somewhere?

Thank you very much and have a great day ahead!

Eugen Pircalabelu




__
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] Rmpi memory error

2008-10-06 Thread David Ruau

Hi List,

I am testing to see if Rmpi work on our cluster.
I load Rmpi and try a simple test:

> library(Rmpi)
> mpi.spawn.Rslaves(nslaves = 4)

 *** caught segfault ***
address 0x248cba8, cause 'memory not mapped'

Traceback:
 1: .Call("mpi_comm_spawn", as.character(slave),  
as.character(slavearg), as.integer(nslaves), as.integer(info),  
as.integer(root), as.integer(intercomm

), PACKAGE = "Rmpi")
 2: mpi.comm.spawn(slave = system.file("Rslaves.sh", package =  
"Rmpi"), slavearg = arg, nslaves = nslaves, info = 0, root =  
root, intercomm = intercom

m)
 3: mpi.spawn.Rslaves(nslaves = 4)
aborting ...

Anybody has an idea of why it crash my R session?
We have a fairly old version of R on the cluster but the admin refuse  
to install a new one because of dependencies...


> sessionInfo()
R version 2.7.0 (2008-04-22)
x86_64-unknown-linux-gnu

locale:
C

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

other attached packages:
[1] Rmpi_0.5-5

__
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] Query about computational demand

2008-10-06 Thread jgarcia
Hi all;
I've programmed a couple of C libraries which are loaded dynamically into
R (Linux). With one of these, I'm conducting Monte Carlo analysis, but
every individual execution of my model is about 15'. So, I'm running 1000
executions in about 11 days.

This is not enough for my needings, as I need about 5 executions for a
sensible analisis of the parameter space. I'm not an expert programmer,
and so, I've got several doubts:

a) I leave R to manage all memory issues. Would a similar C code be faster
if it would be executed as an isolated code outside R?

b) I've been offered two options, to execute remotely the Monte Carlo runs.
Xeon x86_64:  with 8   processors
Itanium:  with 128 processors y 500Gb de RAM

With the common R programming (without any specific programming for
parallel computing), would my dynamically loaded C library and R benefit
of having several processors?

c) How could I report to the people who perhaps offer me the computational
resources the maximum amount of memory I need?

Thanks, and sorry if these are too basic questions.

Javier
--


> On 03/10/2008 7:19 PM, Tomas Lanczos wrote:
>> Thank You for Your answer, Duncan,
>>
>> Duncan Murdoch wrote:
>>> On 03/10/2008 4:33 AM, Tomas Lanczos wrote:
 hello,

 I wish to create some 3d scatter diagrams visualising different
 grouped data set by a given field in the database. I tried the
 scatterplot3d package, as well as the plot3d and scatter3d functions
 (both within the rgl resp. Rcmdr package). My first question is,
 whether is it possibe to group data in the scatterplot3d and plot3d,
 because I did not succeed to use the groups = ... function.
>>> There is no groups argument to plot3d, but you can set characteristics
>>> of each point separately.  So if you can calculate a colour for each
>>> point yourself, you can do something like
>>>
>>> plot3d(br_scatter[,c("cl", "br", "hco3")], col=colour)
>> I see, but it is something new for me. So, if I understood You well, You
>> advice to prepare another column containing colour codes (colour names?)
>> for each point?
>
> Yes, though it needn't be a column of br_scatter.  A vector of the right
> length will work.
>
> Duncan Murdoch
>>
>>> If you want different sizes for each point, you have to plot each
>>> group separately; the size= attribute can't be a vector.  You could
>>> also use text3d to plot character labels, e.g.
>>>
>>> plot3d(br_scatter[,c("cl", "br", "hco3")], type="n")
>>> text3d(br_scatter[,c("cl", "br", "hco3")],
>>> text=br_scatter$stratigraphy)
>> In some cases it should be nice, but I have hundreds of points, no space
>> left for labels, but I can use it later.
>>
>> Tomas
>>> Duncan Murdoch
>>>
 The scatter3d behaves a bit wierdly with the groups function: it
 works well with data imported from a CSV file, but when I tried to
 apply it to a data imported from a PostgreSQL database (using the
 Rdbi and RdbiPgSQL packages) it gives me this error message:

 ERROR:
groups variable must be a factor.

 To be more clear here is a command I used with the scatter3d (exactly
 the same for the both datasets):

 scatter3d(br_scatter$cl, br_scatter$br, br_scatter$hco3,
 fit="linear", residuals=TRUE, bg="white", axis.scales=TRUE,
 grid=TRUE, ellipsoid=FALSE, xlab="cl", ylab="br", zlab="hco3", groups
 = br_scatter$stratigraphy)

 the dataset I used is here (the same is the data imported from the
 CSV file and from a PostgreSQL table) looks like this (a part of it):

  stratigraphy   brhco3  cl
 1 sarmat 0.2327793352  507.006513  262.781114
 2 sarmat 0.3741990388 1021.788317  214.254486
 3  baden 0.3354024830 1268.847582  253.639356
 4 sarmat 0.0938626352   46.514244   38.995620
 5 sarmat 0.1163896676   18.300686   72.984568
 6 sarmat 0.2090008010   77.777917  131.989947
 7 sarmat 0.2815879055   53.802018  146.804052
 8  panon 0.0450540649   81.590560  274.980467
 9  baden 0.5619243092   61.752316  275.978980
 10karpat 0.4655586704   16.019351  179.537807
 11mezozoikum 0.6244993993  133.442504  152.986938
 12 panon 0.1539347217  132.679975   65.994974
 13sarmat 0.0375450541   19.825743   24.996686
 14sarmat 0.0375450541   20.588272   26.280086
 15 baden 0.0463055667   19.063215   26.494456
 16 baden 0.1864737685   40.414016   93.992841
 17sarmat 0.9236083300   90.740903  597.954458
 18 panon 0.8022126552   57.189645  499.961921
 19 panon 0.4830796956   68.627574  280.001241
 20 panon 0.1163896676   73.202745   53.995887

 So why the exactly same "stratigraphy" field is a factor in the
 dataset imported from a CSV file and why is not a factor in the
 dataset imported fro

[R] lme and lmer df's and F-statistics again

2008-10-06 Thread Julia S.

Dear R-users,

I did do a thorough search and read many articles and forum threads on the
lme and lmer methods and their pitfalls and problems. I, being not a good
statistician but a mere "user", came to the conclusion that the most correct
form of reporting statistics for a mixed linear model would be to report the
parameter estimates and SEs, and, if the sample size is considerably high,
p-values of a student's t-test on those. 

Now, I did that in my article and I got a response from a reviewer that I
additionally should give the degrees of freedom, and the F-statistics. From
what I read here, that would be incorrect to do, and I sort of intuitively
also understand why (at least I think I do). 

Well, writing on my rebuttal, I find myself being unable to explain in a
few, easy to understand (and, at the same time, correct) sentences stating
that it is not a good idea to report (most likely wrong) dfs and F
statistics. Can somebody here help me out with a correct explanation for a
laymen? 

Any help is dearly appreciated,

Jule
-- 
View this message in context: 
http://www.nabble.com/lme-and-lmer-df%27s-and-F-statistics-again-tp19835361p19835361.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] horizontal boxplot + xlim

2008-10-06 Thread Richard . Cotton
> I get a strange behaviour of a boxplot with the following code. 
> There seems to 
> be a problem with the xlim-parameter. Did I do anything wrong? What 
> else can I 
> do to force the boxplot to have a defined x-range?
> 
> x <- rnorm(100)
> boxplot(x, notch=TRUE, xlab=parameter, xlim <- c(-4,4), horizontal = 
TRUE)

Did you mean xlim = c(-4,4) in that statement, rather than '<-'?

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

__
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] Read.table fail to recognize (+/-) sign

2008-10-06 Thread Aleksey Naumov
I am able to replicate your problem, using R 2.7.2:

R version 2.7.2 (2008-08-25)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
...

> source <- read.table("clipboard")
> source
V1   V2V3 V4   V5   V6V7
1 HIT1 hg18  chr8  +  1759549  1894206 Human
2 HIT5 hg18 chr11  -  8593662  8636959 Human
3 HIT7 hg18  chr5  + 31675274 32146794 Human
4 HIT00011 hg18  chr5  + 79739648 79810715 Human

'data.frame':   4 obs. of  7 variables:
 $ V1: Factor w/ 4 levels "HIT1",..: 1 2 3 4
 $ V2: Factor w/ 1 level "hg18": 1 1 1 1
 $ V3: Factor w/ 3 levels "chr11","chr5",..: 3 1 2 2
 $ V4: Factor w/ 2 levels "-","+": 2 1 2 2
 $ V5: int  1759549 8593662 31675274 79739648
 $ V6: int  1894206 8636959 32146794 79810715
 $ V7: Factor w/ 1 level "Human": 1 1 1 1

Plus/minus signs get read into factor variable V4. If spaces b/w the signs
and the numbers are eliminated, everything works as expected.

Aleksey



On Mon, Oct 6, 2008 at 10:06 AM, Prof Brian Ripley <[EMAIL PROTECTED]>wrote:

> Please do show us the courtesy of following the posting guide, and make
> sure you use a current version of R.  R 2.7.2 and 2.8.0 beta do not do this,
> and you were asked to update *before* posting.
>
> [My guess is that you are using the long-obsolete 2.7.0.]
>
>
> On Mon, 6 Oct 2008, Gundala Viswanath wrote:
>
>  Dear all,
>>
>> I have the following dataset:
>>
>> # HIT or acc, UCSC genome, chromosome, strand, start, end, species name
>> HIT1hg18chr8+   1759549 1894206 Human
>> HIT5hg18chr11   -   8593662 8636959 Human
>> HIT7hg18chr5+   3167527432146794Human
>> HIT00011hg18chr5+   7973964879810715Human
>>
>> (also downloadable at http://dpaste.com/82688/plain/  )
>>
>> However with the following command:
>>
>>  source <- read.table("clipboard")
>>> source
>>>
>>   V1   V2V3 V4V5V6V7
>> 1 HIT1 hg18  chr8  0   1759549   1894206 Human
>> 2 HIT5 hg18 chr11  0   8593662   8636959 Human
>> 3 HIT7 hg18  chr5  0  31675274  32146794 Human
>> 4 HIT00011 hg18  chr5  0  79739648  79810715 Human
>>
>> Note that the V4 column read.table fail to capture the PLUS/MINUS sign,
>> it gives 0 instead.
>>
>> Is there a way I can enable read.table to recognize those signs?
>>
>>
>> - Gundala Viswanath
>> Jakarta - Indonesia
>>
>> __
>> 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.
>>
>
> Thar *does* apply to you!
>
>
> --
> Brian D. Ripley,  [EMAIL PROTECTED]
> Professor of Applied Statistics,  
> http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel:  +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UKFax:  +44 1865 272595
>
>
> __
> R-help@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] lmer: random factor nested in a fixed factor

2008-10-06 Thread Marie-Agnes Coutellec

Hi all,

I try to build a model using lmer, with 2 crossed fixed factors (poptype 
and matingtype) and 2 random factors (pop and family) which I want to 
nest within poptype. Which of these formulae should I use ?

1. lmer(y~poptype*matingtype + (1|poptype/pop/fam))
2. lmer(y~poptype*matingtype + (poptype|/pop/fam))

thanks in advance
Agnes

--

Marie-Agnès Coutellec
UMR INRA-Agrocampus Ouest 985 ESE
Equipe Ecotoxicologie et Qualité des Milieux Aquatiques
65 rue de Saint-Brieuc - CS 84215
35042 Rennes cedex - FRANCE

tél.: +33(0)2 23 48 52 48
fax:  +33(0)2 23 48 54 40

__
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] horizontal boxplot + xlim

2008-10-06 Thread Antje

Hi there,

I get a strange behaviour of a boxplot with the following code. There seems to 
be a problem with the xlim-parameter. Did I do anything wrong? What else can I 
do to force the boxplot to have a defined x-range?


x <- rnorm(100)
boxplot(x, notch=TRUE, xlab=parameter, xlim <- c(-4,4), horizontal = TRUE)


Antje

__
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] redirected to r-help (was RE: metafiles under windows)

2008-10-06 Thread Liaw, Andy
 
My experience is that this could happen when I switch between an
external display and the laptop LCD that have different resolution.
Can't seem to fix it short of reboot.  If anyone has better solution,
I'm all ears.

Best,
Andy

From: [EMAIL PROTECTED]
> 
> Probably not a bug, not tested on a recent version of R, no 
> reproducible 
> code given, hence no chance for us to identify any problem.
> If you have questions, please use R-help *after* reading its 
> posting guide.
> 
> Best,
> Uwe Ligges
> 
> 
> 
> [EMAIL PROTECTED] wrote:
> > Full_Name: David Stevens
> > Version: 2.7.0
> > OS: Window SP
> > Submission from: (NULL) (129.123.9.110)
> > 
> > 
> > Lately I've been copying graphics to a metafile to paste to 
> a document. No
> > matter what the graphics window size, the pasted graphic 
> only fills the upper
> > left 1/3 of the allocated space. How can I make it fill the space
> > 
> > __
> > [EMAIL PROTECTED] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
Notice:  This e-mail message, together with any attachme...{{dropped:12}}

__
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] Read.table fail to recognize (+/-) sign

2008-10-06 Thread Prof Brian Ripley
Please do show us the courtesy of following the posting guide, and make 
sure you use a current version of R.  R 2.7.2 and 2.8.0 beta do not do 
this, and you were asked to update *before* posting.


[My guess is that you are using the long-obsolete 2.7.0.]

On Mon, 6 Oct 2008, Gundala Viswanath wrote:


Dear all,

I have the following dataset:

# HIT or acc, UCSC genome, chromosome, strand, start, end, species name
HIT1hg18chr8+   1759549 1894206 Human
HIT5hg18chr11   -   8593662 8636959 Human
HIT7hg18chr5+   3167527432146794Human
HIT00011hg18chr5+   7973964879810715Human

(also downloadable at http://dpaste.com/82688/plain/  )

However with the following command:


source <- read.table("clipboard")
source

   V1   V2V3 V4V5V6V7
1 HIT1 hg18  chr8  0   1759549   1894206 Human
2 HIT5 hg18 chr11  0   8593662   8636959 Human
3 HIT7 hg18  chr5  0  31675274  32146794 Human
4 HIT00011 hg18  chr5  0  79739648  79810715 Human

Note that the V4 column read.table fail to capture the PLUS/MINUS sign,
it gives 0 instead.

Is there a way I can enable read.table to recognize those signs?


- Gundala Viswanath
Jakarta - Indonesia

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


Thar *does* apply to you!


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

__
R-help@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] aggregate empty row for pretty appearance also subtotal if possible

2008-10-06 Thread Sharma, Dhruv
Thanks Jim.

Dhruv 

-Original Message-
From: jim holtman [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 03, 2008 10:41 PM
To: Sharma, Dhruv
Cc: r-help@r-project.org
Subject: Re: [R] aggregate empty row for pretty appearance also subtotal
if possible


You can try reshape:

> n <- 2000
> x <- data.frame(a=sample(letters[1:2],n,TRUE), 
> b=sample(LETTERS[1:2],n,TRUE),
+ c=sample(month.abb[1:2], n, TRUE), d=sample(LETTERS[25:26], n,
TRUE), value=runif(n))
> str(x)
'data.frame':   2000 obs. of  5 variables:
 $ a: Factor w/ 2 levels "a","b": 2 1 2 1 1 2 2 2 2 1 ...
 $ b: Factor w/ 2 levels "A","B": 1 2 1 1 2 1 1 1 2 1 ...
 $ c: Factor w/ 2 levels "Feb","Jan": 2 2 2 1 1 1 1 2 2 1 ...
 $ d: Factor w/ 2 levels "Y","Z": 1 2 1 2 1 2 2 1 1 1 ...
 $ value: num  0.416 0.470 0.581 0.500 0.067 ...
> require(reshape)
> x.m <- melt(x, measured="value")
Using a, b, c, d as id variables
> cast(x.m, a+b+c+d ~ ., fun.aggregate=length, margins=c('a', 'b', 'c'))
   a b c d (all)
1  a A   Feb Y   124
2  a A   Feb Z   124
3  a A   Jan Y   109
4  a A   Jan Z   115
5  a B   Feb Y   120
6  a B   Feb Z   152
7  a B   Jan Y   141
8  a B   Jan Z   129
9  a (all) (all) (all)  1014
10 b A   Feb Y   124
11 b A   Feb Z   150
12 b A   Jan Y   115
13 b A   Jan Z   136
14 b B   Feb Y   117
15 b B   Feb Z   131
16 b B   Jan Y   119
17 b B   Jan Z94
18 b (all) (all) (all)   986
19 (all) A (all) (all)   997
20 (all) B (all) (all)  1003
21 (all) (all)   Feb (all)  1042
22 (all) (all)   Jan (all)   958
>


On Fri, Oct 3, 2008 at 3:49 PM, Sharma, Dhruv <[EMAIL PROTECTED]>
wrote:
> Hi,
> By the way if there are many columns in the aggregate like x1,x2,x3 
> for example how would the subtotal code change?
> Is it possible to get subtotal for multiple columns by Group.1 e.g.
> below?
>
> Thanks
> Dhruv
>
>
> -Original Message-
> From: jim holtman [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 02, 2008 10:28 PM
> To: Sharma, Dhruv
> Cc: r-help@r-project.org
> Subject: Re: [R] aggregate empty row for pretty appearance also 
> subtotal if possible
>
>
> Here is one way of doing it:
>
>> dat <- read.table(textConnection("Group1 Group2  x
> + AY1
> + BN1
> + AY1
> + BN   420164904
> + AN   3"), header=TRUE, as.is=TRUE)
>> closeAllConnections()
>> d <- aggregate(dat$x, list(dat$Group1, dat$Group2), sum) # split on 
>> Group.1, and add row with sum d.l <- lapply(split(d, d$Group.1), 
>> function(.df){
> + rbind(.df, list('','',sum(.df$x)))
> + })
>> do.call(rbind, d.l)
> Group.1 Group.2 x
> A.1A   N 3
> A.3A   Y 2
> A.31 5
> B.2B   N 420164905
> B.21 420164905
>
>
> On Thu, Oct 2, 2008 at 5:46 PM, Sharma, Dhruv 
> <[EMAIL PROTECTED]>
> wrote:
>> Hi,
>>   To pretty print aggregates by various dimensions I needed to add a 
>> empty row in output of aggregate.
>>
>>For example.
>>
>>  d<-(aggregate(data[,cbind("x")], by=list(data$group1,data$group2),
>> sum))
>>
>>  Group.1 Group.2  x
>> 1 A   N 3
>> 2 A   Y2
>> 3 B   N 420164905
>>
>> Is there a way to add an empty row between group1 and group 2.
>> So that it looks like
>>  Group.1 Group.2  x
>> 1 A   N 3
>> 2 A   Y 2
>> 3
>> 4 B   N 420164905
>>
>>
>> I need to format a series of aggregates by multi dimensions and I 
>> wanted to break the data by empty row between group 1 that people can

>> see some space.
>>
>> Also is there a way to add subtotals by group 1 into the mix :
>>  Group.1 Group.2  x
>> 1 A   N   3
>> 2 A   Y2
>> 3 5
>> 4 B   N 420164905
>> 5  420164905
>>
>>
>> original data is something like:
>> data
>> Group1 Group2  x
>> AY1
>> BN1
>> AY1
>> BN   420164904
>> AN   3
>>
>>
>> thanks
>> Dhruv
>>
>>[[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.
>>
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solv

[R] Odp: Read.table fail to recognize (+/-) sign

2008-10-06 Thread Petr PIKAL
Hi

works for me, which version of R?

> read.table("clipboard")
V1   V2V3 V4   V5   V6V7
1 HIT1 hg18  chr8  +  1759549  1894206 Human
2 HIT5 hg18 chr11  -  8593662  8636959 Human
3 HIT7 hg18  chr5  + 31675274 32146794 Human
4 HIT00011 hg18  chr5  + 79739648 79810715 Human



Petr Pikal
[EMAIL PROTECTED]
724008364, 581252140, 581252257


[EMAIL PROTECTED] napsal dne 06.10.2008 15:53:02:

> Dear all,
> 
> I have the following dataset:
> 
> # HIT or acc, UCSC genome, chromosome, strand, start, end, species name
> HIT1hg18chr8+   1759549 1894206 Human
> HIT5hg18chr11   -   8593662 8636959 Human
> HIT7hg18chr5+   3167527432146794Human
> HIT00011hg18chr5+   7973964879810715Human
> 
> (also downloadable at http://dpaste.com/82688/plain/  )
> 
> However with the following command:
> 
> > source <- read.table("clipboard")
> > source
> V1   V2V3 V4V5V6V7
> 1 HIT1 hg18  chr8  0   1759549   1894206 Human
> 2 HIT5 hg18 chr11  0   8593662   8636959 Human
> 3 HIT7 hg18  chr5  0  31675274  32146794 Human
> 4 HIT00011 hg18  chr5  0  79739648  79810715 Human
> 
> Note that the V4 column read.table fail to capture the PLUS/MINUS sign,
> it gives 0 instead.
> 
> Is there a way I can enable read.table to recognize those signs?
> 
> 
> - Gundala Viswanath
> Jakarta - Indonesia
> 
> __
> 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] Read.table fail to recognize (+/-) sign

2008-10-06 Thread Gundala Viswanath
Dear all,

I have the following dataset:

# HIT or acc, UCSC genome, chromosome, strand, start, end, species name
HIT1hg18chr8+   1759549 1894206 Human
HIT5hg18chr11   -   8593662 8636959 Human
HIT7hg18chr5+   3167527432146794Human
HIT00011hg18chr5+   7973964879810715Human

(also downloadable at http://dpaste.com/82688/plain/  )

However with the following command:

> source <- read.table("clipboard")
> source
V1   V2V3 V4V5V6V7
1 HIT1 hg18  chr8  0   1759549   1894206 Human
2 HIT5 hg18 chr11  0   8593662   8636959 Human
3 HIT7 hg18  chr5  0  31675274  32146794 Human
4 HIT00011 hg18  chr5  0  79739648  79810715 Human

Note that the V4 column read.table fail to capture the PLUS/MINUS sign,
it gives 0 instead.

Is there a way I can enable read.table to recognize those signs?


- Gundala Viswanath
Jakarta - Indonesia

__
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] t.test() on a list

2008-10-06 Thread Petr PIKAL
Hi

maybe not an answer you like but

apply(do.call(rbind, lapply(myList, c)), 2, t.test)

shall give you desired results

Regards
Petr


[EMAIL PROTECTED] napsal dne 02.10.2008 23:25:23:

> I appreciate your suggestion. The example I provided was fabricated
> because I was only focusing on the programming perspective on how to
> deal with such a data structure, not real statistical issues. Do you
> mind elaborating a little more why that would not be appreciate? I
> know I can do it with a couple of loops,  but I still appreciate
> suggestions on how to write a line or two to run t-tests on such a
> data structure.
> 
> Thanks,
> Gang
> 
> 
> On Thu, Oct 2, 2008 at 5:11 PM, Bert Gunter <[EMAIL PROTECTED]> 
wrote:
> > I am sure you will get helpful answers. I am almost as sure that you
> > shouldn't be doing this. I suggest you consult with your local 
statistician.
> >
> > -- Bert Gunter
> >
> > -Original Message-
> > From: [EMAIL PROTECTED] [
mailto:[EMAIL PROTECTED] On
> > Behalf Of Gang Chen
> > Sent: Thursday, October 02, 2008 11:24 AM
> > To: [EMAIL PROTECTED]
> > Subject: [R] t.test() on a list
> >
> > I have a list, myList, with each of its 9 components being a 15X15
> > matrix. I want to run a t-test across the list for each component in
> > the matrix. For example, the first t-test is on myList[[1]][1, 1],
> > myList[[2]][1, 1], ..., myList[[9]][1, 1]; and there are totally 15X15
> > t-tests. How can I run these t-tests in a simple way?
> >
> > TIA,
> > Gang
> 
> __
> 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] ignore error in for-loop

2008-10-06 Thread Wacek Kusnierczyk
Erich STRIESSNIG wrote:
> Hi all,
>
> Can anybody tell me what to do in case an error occurs inside a
> for-loop and I don't want the program to exit the loop? Rather instead
> I would like it to just go to the next number in the loop and try
> again with the new number. Is there any function like "on error go
> back to" or "skip error" ... ?

there's the keyword 'next' in r which you could use to proceed to the
next value in a for loop.
you can also use try({...}) within the loop, e.g.:

for (i in 0:3)
   try({if (i==2) stop(i); print(i)}, silent=TRUE)

[1] 0
[1] 1
[1] 3

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] Odp: an unsophisticated question about recoding in a data frame with control structure if {}

2008-10-06 Thread Petr PIKAL
Hi

yourm question has two aspects. one is simple

data.frame$thevector[dataframe$factor=='3'] <- an arithmetic.mean

> zdrz
doba otac sklon
1  189.0  0.6   110
2  256.0  0.680
3  286.0  0.650
4  105.0  1.250
zdrz$otac==0.6
zdrz$sklon[zdrz$otac==0.6]<-11

> zdrz
doba otac sklon
1  189.0  0.611
2  256.0  0.611
3  286.0  0.611
4  105.0  1.250

The second part is not so simple and depends on how you want to compute 
mean. As I understand you want to sum 9 differences but some of them can 
be NA. Then you need to think what you want to do when few results will be 
NA

> sum(c(1:8,NA), na.rm=T)/9
[1] 4
> sum(c(1:8,NA), na.rm=T)/8
[1] 4.5
> 

Which one is correct from your point of view. 

I would split data frame according to condition

nes.split<-split(nes2004, nes2004$Rrace2 == "1")

then I would compute desired mean and make a new column

iris.spl<-split(iris, iris$Species)
mmm<-sapply(iris.spl, mean)

here you can use your function instead of mean

mmm
 setosa versicolor virginica
Sepal.Length  5.006  5.936 6.588
Sepal.Width   3.428  2.770 2.974
Petal.Length  1.462  4.260 5.552
Petal.Width   0.246  1.326 2.026
Species  NA NANA
iris$means<-mmm[1,][match(iris$Species,colnames(mmm))]
head(iris)
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species means
1  5.1 3.5  1.4 0.2  setosa 5.006
2  4.9 3.0  1.4 0.2  setosa 5.006
3  4.7 3.2  1.3 0.2  setosa 5.006


Regards
Petr
 

[EMAIL PROTECTED] napsal dne 01.10.2008 11:05:17:

> Hello all, 
> 
> I apologize for a terribly simple question.  I'm used to using Stata and 
am 
> trying to `switch' over to R. 
> 
> I would like to recode a vector in a data frame when the value of it 
meets the
> following condition:  if 
(dataframe$factor=='3'){dataframe$thevector<-(an 
> arithmetic mean).  What I would like to result is the creation of a new 
> variable within the data frame for which all observations that =='3' get 
the 
> mean.  Yet, I receive an error message that R is only reading the first 
> element of the factor: 
> 
> Warning message:
> In if (nes2004$Rrace2 == "1") { :
>   the condition has length > 1 and only the first element will be used
> 
> As the command in question actually appears: 
> if (nes2004$Rrace2=='3') {
> 
nes2004$Hethno<-(((nes2004$Hint-nes2004$Wint)+(nes2004$Hint-nes2004$Bint)+
> 
(nes2004$Hint-nes2004$Aint)+(nes2004$Hwork-nes2004$Wwork)+(nes2004$Hwork-
> 
nes2004$Bwork)+(nes2004$Hwork-nes2004$Awork)+(nes2004$Htrus-nes2004$Wtrus)+
> (nes2004$Htrus-nes2004$Btrus)+(nes2004$Htrus-nes2004$Atrus))/9) }
> 
> The other problem here too, is that each of these variables contain 
varying 
> counts of NA observations. 
> 
> I've tried to work around this by using ifelse, and other commands, but 
I can 
> not figure out where to begin re-thinking how I do this.  Any guidance 
would 
> be appreciated. 
> 
> Thank you. 
> Whitt 
> 
> 
> 
> 
> H. Whitt Kilburn, Ph.D.
> Assistant Professor
> Grand Valley State University
> Political Science Department
> 1124 AuSable Hall
> 1 Campus Drive
> Allendale, MI 49401-9403
> Phone:(616) 331-8831
> Fax:(616) 331-3550
> http://faculty.gvsu.edu/kilburnw
> 
> __
> 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] ignore error in for-loop

2008-10-06 Thread ONKELINX, Thierry
Dear Erich,

Have a look at the try()-function.

HTH,

Thierry 




ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
[EMAIL PROTECTED] 
www.inbo.be 

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Namens Erich STRIESSNIG
Verzonden: maandag 6 oktober 2008 15:04
Aan: r-help@r-project.org
Onderwerp: [R] ignore error in for-loop

Hi all,

Can anybody tell me what to do in case an error occurs inside a 
for-loop and I don't want the program to exit the loop? Rather 
instead I would like it to just go to the next number in the loop and 
try again with the new number. Is there any function like "on error 
go back to" or "skip error" ... ?

Thanks in advance,
Erich



Erich STRIESSNIG
IIASA
International Institute for Applied Systems Analysis
A-2361 Laxenburg, Austria
E-Mail: [EMAIL PROTECTED]
Phone : +43 2236 807-0
Fax   : +43 2236 71313

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

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.

__
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] ignore error in for-loop

2008-10-06 Thread Erich STRIESSNIG

Hi all,

Can anybody tell me what to do in case an error occurs inside a 
for-loop and I don't want the program to exit the loop? Rather 
instead I would like it to just go to the next number in the loop and 
try again with the new number. Is there any function like "on error 
go back to" or "skip error" ... ?


Thanks in advance,
Erich



Erich STRIESSNIG
IIASA
International Institute for Applied Systems Analysis
A-2361 Laxenburg, Austria
E-Mail: [EMAIL PROTECTED]
Phone : +43 2236 807-0
Fax   : +43 2236 71313

__
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 Grep Under Loop

2008-10-06 Thread Gustaf Rydevik
On Mon, Oct 6, 2008 at 2:16 PM, Gundala Viswanath <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> This is the sample of the source data (tab delimited)
>
> http://dpaste.com/82660/plain/
>
> - Gundala Viswanath
> Jakarta - Indonesia
>

Hi,

using this data, your original code works flawlessly - nothing to
correct. Perhaps you changed something between your original run and
this?

/Gustaf
---
> hm_acc <- c("XM_528056","AB002296")
> for (i in 1:length(hm_acc)){
+
+hm_acc_id <- as.character(hm_acc[i])
+print(hm_acc_id)
+
+hm_allk <- grep(hm_acc_id,source$V1)
+hm_all <- source[hm_allk,]
+
+print(hm_all)
+ }
[1] "XM_528056"
  V1  V2   V3 V4  V5  V6 V7
13 XM_528056 panTro2 chr8  + 1775569 1896107 Chimpanzee
[1] "AB002296"
V1  V2   V3 V4V5V6 V7
1 AB002296 panTro2 chr6  - 162615884 162626270 Chimpanzee
>





-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik

__
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 Grep Under Loop

2008-10-06 Thread Gundala Viswanath
Dear all,

This is the sample of the source data (tab delimited)

http://dpaste.com/82660/plain/

- Gundala Viswanath
Jakarta - Indonesia



On Mon, Oct 6, 2008 at 9:05 PM, Gustaf Rydevik <[EMAIL PROTECTED]> wrote:
> On Mon, Oct 6, 2008 at 1:37 PM, Gundala Viswanath <[EMAIL PROTECTED]> wrote:
>> Dear all,
>>
>> I have no problem with this individual grep command:
>>
>>> datk <- grep("XM_528056", source$V1)
>>> dat2 <- source[datk,]
>>> print(dat2)
>> V1  V2   V3 V4  V5  V6 V7
>> 35995 XM_528056 panTro2 chr8  + 1775569 1896107 Chimpanzee
>>
>>
>> BUT, when I run them under the loop it gives this error:
>>
>>
>>> hm_acc <- c("XM_528056","AB002296")
>>> for (i in 1:length(hm_acc)){
>> +
>> +hm_acc_id <- as.character(hm_acc[i])
>> +print(hm_acc_id)
>> +
>> +hm_allk <- grep(hm_acc_id,source$V1)
>> +hm_all <- source[hm_allk,]
>> +
>> +print(hm_all)
>> + }
>>
>> [1] "XM_528056"
>> [1] V1 V2 V3 V4 V5 V6 V7
>> <0 rows> (or 0-length row.names)
>> [1] "AB002296"
>> [1] V1 V2 V3 V4 V5 V6 V7
>> <0 rows> (or 0-length row.names)
>> .
>>
>> What's wrong with my way of using grep?
>> Please advice.
>>
>>
>> - Gundala Viswanath
>> Jakarta - Indonesia
>>
>
>
> Hi,
>
> Could you give us a small sample of the "source" data, so that your
> example is reproducible?
> From looking at your code, it seems as if you copied something wrong.
> First you write:
>  grep("XM_528056", source$V1)
>
> ,but when you print dat2 it seems as if your ID-code ("XM_528056") is
> in V2, not V1.
>
>
> regards,
>
> Gustaf
>
>
> --
> Gustaf Rydevik, M.Sci.
> tel: +46(0)703 051 451
> address:Essingetorget 40,112 66 Stockholm, SE
> skype:gustaf_rydevik
>

__
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 Grep Under Loop

2008-10-06 Thread Gustaf Rydevik
On Mon, Oct 6, 2008 at 1:37 PM, Gundala Viswanath <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> I have no problem with this individual grep command:
>
>> datk <- grep("XM_528056", source$V1)
>> dat2 <- source[datk,]
>> print(dat2)
> V1  V2   V3 V4  V5  V6 V7
> 35995 XM_528056 panTro2 chr8  + 1775569 1896107 Chimpanzee
>
>
> BUT, when I run them under the loop it gives this error:
>
>
>> hm_acc <- c("XM_528056","AB002296")
>> for (i in 1:length(hm_acc)){
> +
> +hm_acc_id <- as.character(hm_acc[i])
> +print(hm_acc_id)
> +
> +hm_allk <- grep(hm_acc_id,source$V1)
> +hm_all <- source[hm_allk,]
> +
> +print(hm_all)
> + }
>
> [1] "XM_528056"
> [1] V1 V2 V3 V4 V5 V6 V7
> <0 rows> (or 0-length row.names)
> [1] "AB002296"
> [1] V1 V2 V3 V4 V5 V6 V7
> <0 rows> (or 0-length row.names)
> .
>
> What's wrong with my way of using grep?
> Please advice.
>
>
> - Gundala Viswanath
> Jakarta - Indonesia
>


Hi,

Could you give us a small sample of the "source" data, so that your
example is reproducible?
>From looking at your code, it seems as if you copied something wrong.
First you write:
 grep("XM_528056", source$V1)

,but when you print dat2 it seems as if your ID-code ("XM_528056") is
in V2, not V1.


regards,

Gustaf


-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik

__
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] NA's in segmented

2008-10-06 Thread vito muggeo

Dear Tyler,
Yes the problem is with NA..
There are two solutions:

1) You can use lm() + segmented (you fit a gaussian model, so why do you 
use glm()?)


2)If you want to use glm()+ segmented(), use na.omit() to pass your 
dataframe to the data argument of glm, glm(.., data=na.omit())



Also, if you want to constrain the right slope to be zero use "the minus 
variable" (see the relevant recent paper on Rnews)


hope this helps you

vito

###
Example

x<-1:50/50
y<- -2*x+2*pmax(x-.6,0)+rnorm(50)*.1

x[20:22]<-NA
d<-data.frame(xx=x,yy=y)
rm(x,y)

#Use lm() - It works:
o<-lm(yy~xx, data=d, na.action=na.omit)
os<-segmented(o,seg.Z=~xx,psi=.5)

#Use glm() - It works:
o<-glm(yy~xx, data=na.omit(d))
os<-segmented(o,seg.Z=~xx,psi=.5)

#constrain the right slope to zero
d$xxx<- -d$x
o<-glm(yy~1, data=na.omit(d))
os1<-segmented(o,seg.Z=~xxx,psi=-.5)

with(d,plot(xx,yy)
plot(os, add=TRUE)
plot(os1, add=TRUE, col=2, rev.sgn=TRUE)



T.D.Rudolph ha scritto:

I am trying to fit a very simple broken stick model using the package
"segmented" but I have hit a roadblock. 


str(data)

'data.frame':   18 obs. of  2 variables:
 $ Bin   : num  0.25 0.75 1.25 1.75 2.25 2.75 3.25 3.75 4.25 4.75 ...
 $ LnFREQ: num  5.06 4.23 3.50 3.47 2.83 ...
 
I fit the lm easily:

fit.lm<-lm(LnFREQ~Bin, data=id07)


But I keep getting an error message:

fit.seg<-segmented(fit.glm, seg.Z=~Bin, psi=6)
Error in cbind(XREG, U, V) : 
  number of rows of matrices must match (see arg 2)
 
I think the problem is due to NA's in the Bin data, but there doesn't seem

to be an "na.action" for segmented ().  What is the best way to get around
this problem?  I would like to keep all Bin values in the output for
continuity.  Data below
 
Tyler



data

BinLnFREQ
1  0.25 5.0562458
2  0.75 4.2341065
3  1.25 3.4965076
4  1.75 3.4657359
5  2.25 2.8332133
6  2.75 2.9444390
7  3.25 2.4849066
8  3.75 1.3862944
9  4.25 1.7917595
10 4.75 1.3862944
11 5.25 0.6931472
12 5.75 1.0986123
13 6.25 0.000
14 6.75 0.000
15 7.25NA
16 7.75 0.000
17 8.25 0.000
18 8.75NA
 

summary(fit.glm)

Call:
glm(formula = LnFREQ ~ Bin, data = id07, na.action = na.omit)
Deviance Residuals: 
 Min1QMedian3Q   Max  
-0.74139  -0.22999   0.01065   0.21245   0.72684  
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)  4.506460.21088   21.37 4.37e-12 ***

Bin -0.634340.04467  -14.20 1.05e-09 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
(Dispersion parameter for gaussian family taken to be 0.1844898)

Null deviance: 39.7785  on 15  degrees of freedom
Residual deviance:  2.5829  on 14  degrees of freedom
  (2 observations deleted due to missingness)
AIC: 22.227
Number of Fisher Scoring iterations: 2


--

Vito M.R. Muggeo
Dip.to Sc Statist e Matem `Vianelli'
Università di Palermo
viale delle Scienze, edificio 13
90128 Palermo - ITALY
tel: 091 6626240
fax: 091 485726/485612
http://dssm.unipa.it/vmuggeo

__
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 Grep Under Loop

2008-10-06 Thread jim holtman
Seems to work fine for me.  You need to read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
You did not provide 'source', so I created one and it seems to work.
So I have to conclude you have something wrong in your data.

> hm_acc <- c("XM_528056","AB002296")
> source <- data.frame(V1=c("XM_528056","AB002296"), V2=1:2)
> for (i in 1:length(hm_acc)){
+
+hm_acc_id <- as.character(hm_acc[i])
+print(hm_acc_id)
+
+hm_allk <- grep(hm_acc_id,source$V1)
+hm_all <- source[hm_allk,]
+
+print(hm_all)
+ }
[1] "XM_528056"
 V1 V2
1 XM_528056  1
[1] "AB002296"
V1 V2
2 AB002296  2
>


On Mon, Oct 6, 2008 at 7:37 AM, Gundala Viswanath <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> I have no problem with this individual grep command:
>
>> datk <- grep("XM_528056", source$V1)
>> dat2 <- source[datk,]
>> print(dat2)
> V1  V2   V3 V4  V5  V6 V7
> 35995 XM_528056 panTro2 chr8  + 1775569 1896107 Chimpanzee
>
>
> BUT, when I run them under the loop it gives this error:
>
>
>> hm_acc <- c("XM_528056","AB002296")
>> for (i in 1:length(hm_acc)){
> +
> +hm_acc_id <- as.character(hm_acc[i])
> +print(hm_acc_id)
> +
> +hm_allk <- grep(hm_acc_id,source$V1)
> +hm_all <- source[hm_allk,]
> +
> +print(hm_all)
> + }
>
> [1] "XM_528056"
> [1] V1 V2 V3 V4 V5 V6 V7
> <0 rows> (or 0-length row.names)
> [1] "AB002296"
> [1] V1 V2 V3 V4 V5 V6 V7
> <0 rows> (or 0-length row.names)
> .
>
> What's wrong with my way of using grep?
> Please advice.
>
>
> - Gundala Viswanath
> Jakarta - Indonesia
>
> __
> 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?

__
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] color code from csv

2008-10-06 Thread Ivar Herfindal



Paul Hiemstra skrev:

kerfuffle wrote:

hi folks,

this is driving me up the wall.  Apologies for posting twice in the same
week, I'm writing up a thesis.  I wish to color-code some dots in an xy
plot.  I've got a csv file with various elements, one of which is the
color-key (with the header 'color').  If the color-key is decimal (eg.
1,2,3) then I can use
plot (X ~ Y, col=data$color) The problem, however, is that using 
decimal numbers I can only produce 8
colors.  It starts to recyle them after that (so, if possible values 
of my
color column are 1,2,3,4,5,6,7,8,9,10,11, the values 1 and 9 both 
produce
red, 2 and 10 produce black).  However, I knew I could get more 
colors by
using hexadecimal (tested with the legend)  So, I carefully produced 
a csv
file with hexadecimal values instead of decimal ones (eg. elements in 
the
column are #ff, #ff) but if I use col=data$color it doesn't 
work,
the entire plot is white.  If I use these set of hexadecimal values 
in the
legend, it works fine and I get lovely colors. 
I could use pch, but I'm already using symbols for another key.   
Grrr.  What am I missing?
Thanks!   
Could you provide a small code sample that reproduces your problem 
(like stated in the posting guide)? And also include the info from 
sessionInfo().


cheers,
Paul


Hi

In addition to Paul's advice, you could try to convert the color column 
to character in the plot-call. The column is most likely stored as 
factor after the import of the csv-file. So maybe something like this 
would work:

with(data, plot(X ~ Y, col=as.character(color)))

If not, see Paul's advice.

Ivar

__
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] Margin on trellis plot

2008-10-06 Thread Richard . Cotton
> I have a problem when I make a trellis plot - I would like to reduce
> the white margin surrounding the plot.
> 
> I used S some years age, as I remember it was possible to use the 
> "par" and "oma" to control margin size even on a trelllis plot (see 
> the plot below).
> 
> However, it does not seem to work in R.

par is used with base graphics.  Changing the par settings will not 
usually affect grid/lattice graphics.  See ?trellis.par.set and, for 
example, http://www.ats.ucla.edu/stat/Splus/faq/trellis_pars.htm or "R 
Graphics",chapter 4, by Paul Murrell.

In the code below, pick any number less than 1 for the padding values to 
decrease it from the default.

xyplot(conc ~ Time | Subject, 
   data = Theoph,
   aspect="fill", 
   par.settings=list(
  layout.widths=list(left.padding=0, right.padding=0), 
  layout.heights=list(top.padding=0, bottom.padding=0)))

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

__
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 loading package created with package.skeleton

2008-10-06 Thread [EMAIL PROTECTED]

Hi,
i'm trying to build an r-package (Windows Vista, R 2.7.2), so i created
one with the package.skeleton() command.
After that i zipped it and tried to load it in R.

Attaching the package via the Windows R-console menu 'Packages/Install
package(s) from local zip-files'  failed:
/> utils:::menuInstallLocal()
Error in gzfile(file, "r") : cannot open the connection
In addition: Warning messages:
1: In zip.unpack(pkg, tmpDir) : error -1 in extracting from zip file
2: In gzfile(file, "r") :
 cannot open compressed file 'MeinPacket/DESCRIPTION', probable reason
'No such file or directory'/

The library(package) command failed too:
/> library('MyPackage.zip')
Error in library("MyPackage.zip") :
 there is no package called 'MyPackage.zip'/

I checked the current working directory and made sure that the
package-zip was in it, but R couldn't find it anyway.

Does anyone know how to get the package loaded?
Thank you and best regards,
Eli


||

__
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] color code from csv

2008-10-06 Thread Paul Hiemstra

kerfuffle wrote:

hi folks,

this is driving me up the wall.  Apologies for posting twice in the same
week, I'm writing up a thesis.  I wish to color-code some dots in an xy
plot.  I've got a csv file with various elements, one of which is the
color-key (with the header 'color').  If the color-key is decimal (eg.
1,2,3) then I can use
plot (X ~ Y, col=data$color) 
The problem, however, is that using decimal numbers I can only produce 8

colors.  It starts to recyle them after that (so, if possible values of my
color column are 1,2,3,4,5,6,7,8,9,10,11, the values 1 and 9 both produce
red, 2 and 10 produce black).  However, I knew I could get more colors by
using hexadecimal (tested with the legend)  So, I carefully produced a csv
file with hexadecimal values instead of decimal ones (eg. elements in the
column are #ff, #ff) but if I use col=data$color it doesn't work,
the entire plot is white.  If I use these set of hexadecimal values in the
legend, it works fine and I get lovely colors.  

I could use pch, but I'm already using symbols for another key.

Grrr.  What am I missing? 

Thanks! 
  
Could you provide a small code sample that reproduces your problem (like 
stated in the posting guide)? And also include the info from sessionInfo().


cheers,
Paul

--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +31302535773
Fax:+31302531145
http://intamap.geo.uu.nl/~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.


[R] Problem with Grep Under Loop

2008-10-06 Thread Gundala Viswanath
Dear all,

I have no problem with this individual grep command:

> datk <- grep("XM_528056", source$V1)
> dat2 <- source[datk,]
> print(dat2)
 V1  V2   V3 V4  V5  V6 V7
35995 XM_528056 panTro2 chr8  + 1775569 1896107 Chimpanzee


BUT, when I run them under the loop it gives this error:


> hm_acc <- c("XM_528056","AB002296")
> for (i in 1:length(hm_acc)){
+
+hm_acc_id <- as.character(hm_acc[i])
+print(hm_acc_id)
+
+hm_allk <- grep(hm_acc_id,source$V1)
+hm_all <- source[hm_allk,]
+
+print(hm_all)
+ }

[1] "XM_528056"
[1] V1 V2 V3 V4 V5 V6 V7
<0 rows> (or 0-length row.names)
[1] "AB002296"
[1] V1 V2 V3 V4 V5 V6 V7
<0 rows> (or 0-length row.names)
.

What's wrong with my way of using grep?
Please advice.


- Gundala Viswanath
Jakarta - Indonesia

__
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] propensity score adjustment using R

2008-10-06 Thread Marc Flockerzi
the Matching() package by Jasjeet Sekhon does propensity score matching in a 
very user friendly way. (as you said you don't want to reinvent the wheel...)
just feed it with the fitted values from a glm model (fitted$myglmmodel). 
afaik, you may additionally match on some covariates directly.
HTH
marc
_
In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten!

__
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] Margin on trellis plot

2008-10-06 Thread Henrik Agersø

Dear all

I have a problem when I make a trellis plot - I would like to reduce the white 
margin surrounding the plot.

I used S some years age, as I remember it was possible to use the "par" and 
"oma" to control margin size even on a trelllis plot (see the plot below).

However, it does not seem to work in R.

All suggestions will be highly appreciated.

Br Henrik

___

trellis.device(width=5, height=4)
par(oma=c(0,0,0,0))

xyplot(conc ~ Time | Subject, data = Theoph,
aspect="fill")
___




[[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] Bioconductor installation on 64 bit R problem

2008-10-06 Thread Prof Brian Ripley
Bioconductor has its own list, but note that many of us (including the 
Bioconductor test farm) are happliy testing all the Bioconductor packages 
on 64-bit platforms (including Linux and Solaris -- some at least have 
been used on 64-bit Mac OS 10.5).


So please read the posting guide and follow up on the Bioconductor list 
with all the details requested.


On Mon, 6 Oct 2008, Octavio Espinosa wrote:


Hello,

I am attempting to install Bioconductor on 64 bit R. The installation of some 
bioconductor packages fails with the errors below. I would be very grateful for 
any help on how to resolve the issue.

Best regards,

Octavio Espinosa



-


Most of the bioconductor packages won't install, for examples 'Biobase'
errors with:

** building package indices ...
Loading required package: methods
Error in dim(robj) <- c(dX, dY) :
 dims [product 8] do not match the length of object [16]
Calls:  ... list_files_with_type -> .make_file_exts -> switch
-> outer
Execution halted
ERROR: installing package indices failed
** Removing '/usr/local/lib/R/library/Biobase'

The downloaded packages are in
   /tmp/RtmpHGbpND/downloaded_packages
Updating HTML index of packages in '.Library'
Warning message:
In install.packages(pkgs = pkgs, repos = repos, dependencies =
dependencies,  :
 installation of package 'Biobase' had non-zero exit status


It looks like it doesn't work with 64bit stuff (the byte lengths
mismatch)

[[alternative HTML version deleted]]



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



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

__
R-help@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] building packages: "R Help for package foo" vs. "HTML Help"?

2008-10-06 Thread Duncan Murdoch

Uwe Ligges wrote:

Michael Friendly wrote:
  

Uwe Ligges wrote:


Michael Friendly wrote:
  
In building a package, what are the settings in the package files or 
the build commands that

determine whether the compiled HTML help windows have the window title
"R Help for package foo" vs. "HTML Help"?


Michael,

can you give an example for a page with title "HTML Help"? I only 
found the "R Help for package foo" version during a quick inspection 
of a few examples.
  

Sure:
library(vcd); ?mosaic
library(heplots); ?heplot
library(car); ?Anova
library(rgl); ?shade3d   # --- I believe up until just the latest 
version (rgl_0.81.708) I downloaded from R-Forge




I get "R Help for package [foo]" for all of these. I have absolutely no 
idea why it is different on your machine.
  


I see the "HTML Help" message for some pages in CHM help, not in HTML 
help.  I'm not sure what the pattern is that leads to this.


Duncan Murdoch


Best wishes,
Uwe


  

Here's my sessionInfo:

 > sessionInfo()
R version 2.7.2 (2008-08-25)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252


attached base packages:
[1] grid  stats graphics  grDevices utils datasets  methods 
[8] base   
other attached packages:
[1] vcd_1.1-1   colorspace_0.95 MASS_7.2-44 rgl_0.81.708  [5] 
heplots_0.8-0   car_1.2-8


I often have quite a few help files active, and it is much more 
convenient to navigate among

them if the window has an informative title.

If this is simple to test for in the build process, can/should this 
be tested for
(with a warning) or even enforced/automatically generated in the 
scripts?


-Michael





__
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 2.7.2 upgrade in Ubuntu, tcltk does not work any more

2008-10-06 Thread Philippe Grosjean

Hello,

I had no problems running R with tcltk until the recent upgrade to 
R-2.7.2-2gustsy1 (I use Ubuntu 7.10 Gutsy Gibbon). Since the upgrade 
from R-2.7.2-1, I got this error (see hereunder). Obviously, I have now 
a problem with tcltk-related .so files. What should I do? Thanks.


Philippe

[EMAIL PROTECTED]:~$ R

R version 2.7.2 (2008-08-25)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(tcltk)
Loading Tcl/Tk interface ... Error in dyn.load(file, DLLpath = DLLpath, 
...) :

  unable to load shared library '/usr/lib/R/library/tcltk/libs/tcltk.so':
  libtcl8.5.so.0: cannot open shared object file: No such file or directory
Error : .onLoad failed in 'loadNamespace' for 'tcltk'
Error: package/namespace load failed for 'tcltk'
>
> R.version
   _
platform   i486-pc-linux-gnu
arch   i486
os linux-gnu
system i486, linux-gnu
status
major  2
minor  7.2
year   2008
month  08
day25
svn rev46428
language   R
version.string R version 2.7.2 (2008-08-25)
>

__
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 in Q-Q plot

2008-10-06 Thread Dieter Menne
Megh Dal  yahoo.com> writes:

> 
> > library(sn)
> > library(car)
> > dat1 = rst(1000, 0, 1, 0, 2)
> > qq.plot(dat1, "st", 0, 1, 0, 9)
> Error in plot.window(...) : 
>   invalid value specified for graphical parameter "las"

You have set parameter las (the 6th) to 9, and only values 0 and 1 are allowed
as documented. With so many parameters, it's always a good idea to explicitly
name the parameters, if only for self-documentation.

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] Bioconductor installation on 64 bit R problem

2008-10-06 Thread Octavio Espinosa
Hello,

I am attempting to install Bioconductor on 64 bit R. The installation of some 
bioconductor packages fails with the errors below. I would be very grateful for 
any help on how to resolve the issue.

Best regards,

Octavio Espinosa



-


Most of the bioconductor packages won't install, for examples 'Biobase' 
errors with:

** building package indices ...
Loading required package: methods
Error in dim(robj) <- c(dX, dY) :
  dims [product 8] do not match the length of object [16]
Calls:  ... list_files_with_type -> .make_file_exts -> switch 
-> outer
Execution halted
ERROR: installing package indices failed
** Removing '/usr/local/lib/R/library/Biobase'

The downloaded packages are in
/tmp/RtmpHGbpND/downloaded_packages
Updating HTML index of packages in '.Library'
Warning message:
In install.packages(pkgs = pkgs, repos = repos, dependencies = 
dependencies,  :
  installation of package 'Biobase' had non-zero exit status


It looks like it doesn't work with 64bit stuff (the byte lengths 
mismatch) 

[[alternative HTML version deleted]]



[[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] RBGL installation

2008-10-06 Thread Iain Gallagher
Hi 

I'm trying to install the RBGL package. However I am getting the following 
error; can anybody shed some light on what I'm missing?

/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cstdlib:135: 
error: ‘::system’ has not been declared


Thanks.

Iain

> sessionInfo()
R version 2.7.2 (2008-08-25) 
i486-pc-linux-gnu 

locale:
LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C

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

loaded via a namespace (and not attached):
[1] tcltk_2.7.2 tools_2.7.2

[[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] package flexmix: models for ordinal data?

2008-10-06 Thread Klaus Meier
Dear List,

does anyone have experience with fitting finite mixture regression models to 
ordinal/ordered dependent data using Friedrich Leisch's flexmix package?

Best,
Klaus






__
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 in Q-Q plot

2008-10-06 Thread Megh Dal
Hi,

I am trying to draw a Q-Q plot, however got following error.

> library(sn)
> library(car)
> dat1 = rst(1000, 0, 1, 0, 2)
> qq.plot(dat1, "st", 0, 1, 0, 9)
Error in plot.window(...) : 
  invalid value specified for graphical parameter "las"
Can anyone please tell me why this error is coming?

__
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] Tinn-R command line argument to increase memory limits.

2008-10-06 Thread Yihui Xie
You can add the arguments here: Options --> Application --> R --> Path

Regards,
Yihui
--
Yihui Xie <[EMAIL PROTECTED]>
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China



On Mon, Oct 6, 2008 at 3:53 PM,  <[EMAIL PROTECTED]> wrote:
> I searched the FAQ and found that if I set --max-mem-size=512M (or above) on 
> the command line I can increase the. What I was unable to find in the 
> archives was how to pass this command line argument when using Tinn-R. I know 
> I have seen this just recently. Any suggestions?
>
> Thank you.
>
> Kevin
>
> __
> 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] Tinn-R command line argument to increase memory limits.

2008-10-06 Thread rkevinburton
I searched the FAQ and found that if I set --max-mem-size=512M (or above) on 
the command line I can increase the. What I was unable to find in the archives 
was how to pass this command line argument when using Tinn-R. I know I have 
seen this just recently. Any suggestions?

Thank you.

Kevin

__
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] building packages: "R Help for package foo" vs. "HTML Help"?

2008-10-06 Thread Uwe Ligges



Michael Friendly wrote:

Uwe Ligges wrote:



Michael Friendly wrote:
In building a package, what are the settings in the package files or 
the build commands that

determine whether the compiled HTML help windows have the window title
"R Help for package foo" vs. "HTML Help"?


Michael,

can you give an example for a page with title "HTML Help"? I only 
found the "R Help for package foo" version during a quick inspection 
of a few examples.

Sure:
library(vcd); ?mosaic
library(heplots); ?heplot
library(car); ?Anova
library(rgl); ?shade3d   # --- I believe up until just the latest 
version (rgl_0.81.708) I downloaded from R-Forge



I get "R Help for package [foo]" for all of these. I have absolutely no 
idea why it is different on your machine.


Best wishes,
Uwe



Here's my sessionInfo:

 > sessionInfo()
R version 2.7.2 (2008-08-25)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252


attached base packages:
[1] grid  stats graphics  grDevices utils datasets  methods 
[8] base   
other attached packages:
[1] vcd_1.1-1   colorspace_0.95 MASS_7.2-44 rgl_0.81.708  [5] 
heplots_0.8-0   car_1.2-8

I often have quite a few help files active, and it is much more 
convenient to navigate among

them if the window has an informative title.

If this is simple to test for in the build process, can/should this 
be tested for
(with a warning) or even enforced/automatically generated in the 
scripts?


-Michael






__
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 model this? (R-help Digest, Vol 67, Issue 25)

2008-10-06 Thread jose romero
Hello Senne:

I am currently teaching a simulation and modeling course in which we use R for 
most purposes and Sim Py (a python module for discrete event simulation).  I am 
looking for a real-life case such as yours to approach in class- if you wish, i 
would be happy to look into the case you are describing, along with the data, 
to work out in the course.  If you are interested, please reply with more 
information as to what your requirements are.

Regards,

jlrp


--- On Wed, 9/24/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


> Message: 73
> Date: Tue, 23 Sep 2008 17:04:38 -0400
> From: senne <[EMAIL PROTECTED]>
> Subject: [R] how to model this
> To: r-help@r-project.org
> Message-ID:
>   <[EMAIL PROTECTED]>
> Content-Type: text/plain
> 
> Dear list,
> 
> I met with a business case and feel frustrated to model
> it,scenario is like
> this
> 
> 1. logistics department running
> 2. a lot of customers place orders and goods need to be
> send to their site
> (nationwide)
> 3. order received and then choose from a list of truck
> carriers to deliver
> goods,a cheapest one should be selected but might not
> available for the
> limit of order-shipment time,so a more expensive one has to
> be used.
> 
> this logistics department run the process on case-by-case
> basis ,no forecast
> from sale department and no bargain power against carriers.
> I have past 2
> years order history and freight history,on which some
> descriptive statistics
> is done and result is really ugly,expensive carriers were
> used
> extensively.I'm trying to find some ways to benchmark
> or optimize the
> process,but due to my lack of statistics modeling skills(
> I'm from
> accounting background and luckily because I have used R to
> show some
> improvement in past analysis,I'm asked to deal with
> this :(
> really can't find the clue where to start.I'll very
> appreciate if anyone can
> point  me to the right direction(books ,papers, or similar
> situations might
> be examined many times) .
> 
> thanks
> -- 
> [EMAIL PROTECTED]
> 
>   [[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.