Re: [R] Truncated x-axis values

2007-03-23 Thread Jim Lemon
"Urban, Alexander" <[EMAIL PROTECTED]> wrote:
> Hello
>
>I'm new to this group. I looked up the last two
>
>hour in the help file 
>
> and in the archives of this group, but didn't
>
>find anything.
>
>I hope my question is not too dump:
>I'm printing a graph with vertical labels on the
>
>x-axis (necessary due
>
>to many labels). Unfortunately the png truncates
>
>the labels halfway 
>
>through, so that you can only read the last 7
>
>digits of the label.
>
>Snice I'm already asking :-): Is there a
>
>possibility to tell R: If 
>
>there are so many labels that you write them on
>
>top of each other, 
>
>take only e.g. every 2nd...
>
There sure is, Alex. Have a look at staxlab in the plotrix package.

Jim

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


Re: [R] Colored boxes with values in the box

2007-03-23 Thread Jim Lemon
Pappu, Kartik wrote:
> Hi all,
> 
> I have a x, y matrix of numbers (usually ranging from 0 to 40).  I need 
> to group these numbers and assign a color to each group (for example 0 
> to 15 - Blue, 16-30- Yellow, and 31-40- Red).  Then I need to draw a 
> rectangular matrix which contains X x Y boxes and each box has the  
> corresponding value from the input matrix and is also colored according 
> to which group (i.e red, yellow, or blue) that value falls into.
> 
> I have used the color2D.matplot function from the plotrix package, but 
> I cant quite figure out how to group the values to represent red blue 
> and yellow colors.
> 
Hi Kartik,
color2D.matplot isn't designed for this, but with a few tricks, I think 
you can get what you want. Try this:

xmat<-matrix(sample(0:40,100,TRUE),nrow=10)
# trick 1 - calculate values that give you the colors for ranges
color2D.matplot(floor(xmat/15+1),c(1,1,0),c(0,1,0),c(0,0,1))
# trick 2 - Use boxed.labels rather than the inbuild value display
boxed.labels(sort(rep(9.5:0.5,10)),rep(seq(9.5,0.5,by=-1),10),xmat)
# trick 3 - Use color.legend to show the group colors
color.legend(0,-2,3,-1.3,1:3,c("red","yellow","blue"))

You will have to wait until plotrix v2.2 is on CRAN as I am just 
submitting it, and the color.legend function, requested only a few weeks 
ago, is new to that version.

Jim

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


[R] sampling from the unoform distrubuton over a convex hull

2007-03-23 Thread Ranjan Maitra
Dear list,

Does anyone have a suggestion (or better still) code for sampling from the 
uniform distribution over the convex hull of a set of points?

Many thanks and best wishes,
Ranjan

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


[R] how to get current workspace name?

2007-03-23 Thread Aimin Yan
Use getwd(), I can get current directory name.

Now I want to get current workspace name, Does anyone know how to do that?

here is information about my R

 > sessionInfo()
R version 2.4.0 (2006-10-03)
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] "splines"   "methods"   "stats" "graphics"  "grDevices" "utils"
[7] "datasets"  "base"

other attached packages:
 nnetclass survival  mlbench MASSrpart  RWinEdt
"7.2-29" "7.2-29"   "2.30"  "1.1-2" "7.2-29" "3.1-32"  "1.7-5"

Aimin

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


[R] Greenwood variance formula

2007-03-23 Thread Murray Pung
I have specified error = "greenwood" in the survfit function:

summary(survfit(Surv(time, status) ~ 1,error = "greenwood", data=aml))

The output does not appear to give variance, but standard error.
Preferably I  would like variance to be output, but is it okay to
convert std errror to variance, and how can I do this correctly?

Thanks
Murray

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


Re: [R] how to get "lsmeans"?

2007-03-23 Thread Muenchen, Robert A (Bob)
The Exegesis paper gave me a great look at the history of all this. I
had not been aware that S-PLUS had gone that route. There is much to be
said for knowing you might be more successful but sticking to your
perspective instead. And in the long run, that may be the more
successful route anyway. 

Thanks,
Bob

=
Bob Muenchen (pronounced Min'-chen), Manager 
Statistical Consulting Center
U of TN Office of Information Technology
200 Stokely Management Center, Knoxville, TN 37996-0520
Voice: (865) 974-5230 
FAX: (865) 974-4810
Email: [EMAIL PROTECTED]
Web: http://oit.utk.edu/scc, 
News: http://listserv.utk.edu/archives/statnews.html
=

> -Original Message-
> From: Liaw, Andy [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 22, 2007 5:27 PM
> To: Douglas Bates; Muenchen, Robert A (Bob)
> Cc: R-help@stat.math.ethz.ch
> Subject: RE: [R] how to get "lsmeans"?
> 
> From: Douglas Bates
> >
> > On 3/22/07, Muenchen, Robert A (Bob) <[EMAIL PROTECTED]> wrote:
> >
> > > Perhaps I'm stating the obvious, but to increase the use of R in
> > > places where SAS & SPSS dominate, it's important to make
> > getting the
> > > same answers as easy as possible. That includes things like
lsmeans
> > > and type III sums of squares. I've read lots of discussions here
on
> > > sums of squares & I'm not advocating type III use, just
> > looking at it
> > > from a marketing perspective. Too many people look for
> > excuses to not change.
> > > The fewer excuses, the better.
> >
> > You may get strong reactions to such a suggestion.  I
> > recommend reading Bill Venables' famous unpublished paper
> > "Exegeses on linear models" (google for the title - very few
> > people use "Exegeses" and "linear models" in the same
> > sentence - in fact I would not be surprised if Bill was the
> > only one who has ever done so).
> 
> It's on the MASS page:
> http://www.stats.ox.ac.uk/pub/MASS3/Exegeses.pdf
> I believe it's based on a talk Bill gave at a S-PLUS User's
Conference.
> I think it deserves to be required reading for all graduate level
> linear
> models course.
> 
> > You must realize that R is written by experts in statistics
> > and statistical computing who, despite popular opinion, do
> > not believe that everything in SAS and SPSS is worth copying.
> >  Some things done in such packages, which trace their roots
> > back to the days of punched cards and magnetic tape when
> > fitting a single linear model may take several days because
> > your first 5 attempts failed due to syntax errors in the JCL
> > or the SAS code, still reflect the approach of "give me every
> > possible statistic that could be calculated from this model,
> > whether or not it makes sense".  The approach taken in R is
> different.
> >  The underlying assumption is that the useR is thinking about
> > the analysis while doing it.
> >
> > The fact that it is so difficult to explain what lsmeans are
> > and why they would be of interest is an indication of why
> > they aren't implemented in any of the required packages.
> 
> Perhaps I should have made it clear in my original post:  I gave the
> example and code more to show what the mysterious "least squares
means"
> are (which John explained lucidly), than how to replicate what SAS (or
> JMP) outputs.  I do not understand how people can feel comfortable
> reporting things like lsmeans and p-values from type  favorite Roman numeral here> tests when they do not know how such
> things
> arise or, at the very least, what they _really_ mean.  (Given how
> simple
> lsmeans are computed, not knowing how to compute them is pretty much
> the
> same as not knowing what they are.)  One of the dangers of wholesale
> output as SAS or SPSS gives is for the user to simply pick an answer
> and
> run with it, without understanding what that answer is, or if it
> corresponds to the question of interest.
> 
> As to whether to weight the levels of the factors being held constant,
> my suggestion to John would be to offer both choices (unweighted and
> weighted by observed frequencies).  I can see why one would want to
> weight by observed frequencies (if the data are sampled from a
> population), but there are certainly situations (perhaps more often
> than
> not in the cases I've encountered) that the observed frequencies do
not
> come close to approximating what they are in the population.  In such
> cases the unweighted average would make more sense to me.
> 
> Cheers,
> Andy
> 
> 
> > > > -Original Message-
> > > > From: [EMAIL PROTECTED] [mailto:r-help-
> > > > [EMAIL PROTECTED] On Behalf Of John Fox
> > > > Sent: Wednesday, March 21, 2007 8:59 PM
> > > > To: 'Prof Brian Ripley'
> > > > Cc: 'r-help'; 'Chuck Cleland'
> > > > Subject: Re: [R] how to get "lsmeans"?
> > > >
> > > > Dear Brian et al.,
> > > >
> > > > My apologies for chiming in late: It's been a busy day.
> > > >
> > > > First some general comm

Re: [R] Conversion from string to date type

2007-03-23 Thread Andreas Tille
On Fri, 23 Mar 2007, Dirk Eddelbuettel wrote:

> Nit 1: read.csv() is for csv files which tend to have "," as a separator;
> read.table() is more useful here.

Well, that's correct.  read.csv was just a leftover from former
tests and finally it worked also this way - but thanks for the
hint anyway.

>> mydata <- read.table(file="/tmp/mydata.dat", sep="\t", header=TRUE)
>> mydata
>date value1 value2
> 1 01.03.2007 17 42
> 2 02.03.2007  2  3
> 3 03.03.2007 47 11
>> mydata$date <- as.Date(mydata$date, "%d.%m.%Y")   ## [1]

Ahhh, the '$date' thingy did the trick!

> [1] As I mentioned, you need to supply a format unless your data lists as
> (for today) 2007-03-23 which is an ISO format

That's obvious.

> [2] The with() simply makes the indexing easier. Direct use is
> plot(mydata$date, mydata$value1) or also
> plot(mydata[,"date"], mydata[,"value1"]) or also
> plot(mydata[,1], mydata[,2])

Ahh, so many ways to do it right.  You must be really unlucky
if you manage to do it wrong as I did. ;-)

> [3] See the help for all the options on png, as well the numerous examples
> for plot to annotate, give titles, ...
>
> [4] dev.off() is critical to get the 'device' (here a file) closed.

Yea, read this in the docs.  Now I can start fine tuning and start
having fun with R. ;-)

> My pleasure. Happy R-ing,  Dirk

Thanks for the nice kick-start

   Andreas.

-- 
http://fam-tille.de

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


Re: [R] objects of class "matrix" and mode "list"? [Broadcast]

2007-03-23 Thread Liaw, Andy
It may help to (re-)read ?sapply a bit more in detail.  Simplification
is done only if it's "possible", and what "possible" means is defined
there.

A list is a vector whose elements can be different objects, but a vector
nonetheless.  Thus a list can have dimensions.  E.g.,

R> a <- list(1, 1:2, 3, c("abc", "def"))
R> dim(a) <- c(2, 2)
R> a
 [,1]  [,2]   
[1,] 1 3  
[2,] Integer,2 Character,2

That sometimes can be extremely useful (not like the example above!).

Andy 

From: Stephen Tucker
> 
> Hello everyone,
> 
> I cannot seem to find information about objects of class 
> "matrix" and mode
> "list", and how to handle them (apart from flattening the 
> list). I get this
> type of object from using sapply(). Sorry for the long 
> example, but the code
> below illustrates how I get this type of object. Is anyone aware of
> documentation regarding this object?
> 
> Thanks very much,
> 
> Stephen
> 
> = begin example 
> 
> # I am just making up a fake data set
> df <- data.frame(Day=rep(1:3,each=24),Hour=rep(1:24,times=3),
>  Name1=rnorm(24*3),Name2=rnorm(24*3))
> 
> # define a function to get a set of descriptive statistics
> tmp <- function(x) {
>   # this function will accept a data frame
>   # and return a 1-row data frame of
>   # max value, colname of max, min value, and colname of min
>   return(data.frame(maxval=max(apply(x,2,max)),
> maxloc=names(x)[which.max(apply(x,2,max))],
> minval=min(apply(x,2,min)),
> minloc=names(x)[which.min(apply(x,2,min))]))
> }
> 
> # Now applying function to data:
> # (1) split the data table by Day with split()
> # (2) apply the tmp function defined above to each data frame from (1)
> # using lapply()
> # (3) transpose the final matrix and convert it to a data frame
> # with mixed characters and numbers
> # using as.data.frame(), lapply(), and type.convert()
> 
> > final <- 
> as.data.frame(lapply(as.data.frame(t(sapply(split(df[,-c(1:2)],
> +   
> f=df$Day),tmp))),
> +   type.convert,as.is=TRUE))
> Error in type.convert(x, na.strings, as.is, dec) : 
>   the first argument must be of mode character
> 
> I thought sapply() would give me a data frame or matrix, which I would
> transpose into a character matrix, to which I can apply type.convert()
> and get the same matrix as what I would get from these two lines (Fold
> function taken from Gabor's post on R-help a few years ago):
> 
> Fold <- function(f, x, L) for(e in L) x <- f(x, e)
> final2 <- Fold(rbind,vector(),lapply(split(df[,-c(1:2)],f=day),tmp))
> 
> > print(c(class(final2),mode(final2)))
> [1] "data.frame" "list"  
> 
> 
> However, by my original method, sapply() gives me a matrix 
> with mode, "list"
> 
> intermediate1 <- sapply(split(df[,-c(1:2)],f=df$Day),tmp)
> > print(c(class(intermediate1),mode(intermediate1)))
> [1] "matrix" "list"  
> 
> Transposing, still a matrix with mode list, not character:
> 
> intermediate2 <- t(sapply(split(df[,-c(1:2)],f=day),tmp))
> > print(c(class(intermediate2),mode(intermediate2)))
> [1] "matrix" "list"  
> 
> Unclassing gives me the same thing...
> 
> > print(c(class(unclass(intermediate2)),mode(unclass(intermediate2
> [1] "matrix" "list"  
> 
> 
> 
> 
>  
> __
> __
> Be a PS3 game guru.
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 
> 


--
Notice:  This e-mail message, together with any attachments,...{{dropped}}

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


Re: [R] Conversion from string to date type

2007-03-23 Thread Dirk Eddelbuettel

Hi Andreas,

Welcome to r-help :)

On 23 March 2007 at 22:21, Andreas Tille wrote:
| I'm on my very first steps to R and so I hope that I do
| not ask a really stupid questions but I did not found it
| via R-Search, in the FAQ or Google (BTW, the name "R" is
| not a really good seekiong criterion ;-) ).
| 
| I have a data file containing a table that containes
| dates and values like
| 
| date\t value1\t value2, ...
| 01.03.2007\t 17\t 42\t ...
| 02.03.2007\t 2\t 3\t ...
| 03.03.2007\t 47\t 11\t ...
| ...
| 
| I was perfectly able to read this file via
| 
| mydata <- read.csv(file='mydata.dat', sep = '\t', quote='', 
fill=TRUE,header=TRUE )

Nit 1: read.csv() is for csv files which tend to have "," as a separator;
read.table() is more useful here.

| but the date vector is a vector of strings instead of date values.
| I want to convert these strings into date values to be able
| to make graphs where date is the x-axis and value? the y-axis.

It could be worse :)  Often times, folks get confused when variables are
of type 'factor' (see the docs) instead of char. With character you are fine,
and you can do the converson, see help(strptime) or help(as.Date) which I am
using below --- note how you have to tell it the format in the standard C
notation. 

| 
| I would be really happy if someone could enlighten me how to
| do this conversion (and a hint how to do a graph as PNG) would
| be an extra bonus which would shorten my further reading of the
| docs).

Here you go:

> mydata <- read.table(file="/tmp/mydata.dat", sep="\t", header=TRUE)
> mydata
date value1 value2
1 01.03.2007 17 42
2 02.03.2007  2  3
3 03.03.2007 47 11
> mydata$date <- as.Date(mydata$date, "%d.%m.%Y")   ## [1]
> mydata
date value1 value2
1 2007-03-01 17 42
2 2007-03-02  2  3
3 2007-03-03 47 11
> with(mydata, plot(date, value1))  ## [2]
> png("/tmp/mydata.png")## [3]
> with(mydata, plot(date, value1))
> dev.off() ## [4]
null device 
  1 
> 


[1] As I mentioned, you need to supply a format unless your data lists as
(for today) 2007-03-23 which is an ISO format

[2] The with() simply makes the indexing easier. Direct use is
plot(mydata$date, mydata$value1) or also
plot(mydata[,"date"], mydata[,"value1"]) or also
plot(mydata[,1], mydata[,2]) 

[3] See the help for all the options on png, as well the numerous examples
for plot to annotate, give titles, ...

[4] dev.off() is critical to get the 'device' (here a file) closed.

| Kind regards and thanks for your help

My pleasure. Happy R-ing,  Dirk

-- 
Hell, there are no rules here - we're trying to accomplish something. 
  -- Thomas A. Edison

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


Re: [R] Conversion from string to date type

2007-03-23 Thread Gabor Grothendieck
Read the help desk article in R-News 4/1 and see

?as.Date
?strptime (for setting the as.Date format= argument)

Also, you might be interested in the zoo package

library(zoo)
?read.zoo
vignette("zoo")
vignette("zoo-quickref")


On 3/23/07, Andreas Tille <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm on my very first steps to R and so I hope that I do
> not ask a really stupid questions but I did not found it
> via R-Search, in the FAQ or Google (BTW, the name "R" is
> not a really good seekiong criterion ;-) ).
>
> I have a data file containing a table that containes
> dates and values like
>
> date\t value1\t value2, ...
> 01.03.2007\t 17\t 42\t ...
> 02.03.2007\t 2\t 3\t ...
> 03.03.2007\t 47\t 11\t ...
> ...
>
> I was perfectly able to read this file via
>
> mydata <- read.csv(file='mydata.dat', sep = '\t', quote='', 
> fill=TRUE,header=TRUE )
>
> but the date vector is a vector of strings instead of date values.
> I want to convert these strings into date values to be able
> to make graphs where date is the x-axis and value? the y-axis.
>
> I would be really happy if someone could enlighten me how to
> do this conversion (and a hint how to do a graph as PNG) would
> be an extra bonus which would shorten my further reading of the
> docs).
>
> Kind regards and thanks for your help
>
>   Andreas.
>
> --
> http://fam-tille.de
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] Conversion from string to date type

2007-03-23 Thread Andreas Tille
On Fri, 23 Mar 2007, jim holtman wrote:

> Here is how you can convert them to a Date object:
>
>> x <- c('01.03.2007','02.03.2007','03.03.2007')
>> y <- as.Date(x, format="%d.%m.%Y")
>> y

Well, this is what I tried when reading the docs, but

> mydata <- read.csv(file='mydata.dat', sep = '\t', quote='', 
> fill=TRUE,header=TRUE )
> datum <- as.Date(mydata["date"], "%d.%m,%y")
Error in as.Date.default(mydata["date"], "%d.%m,%y") :
 do not know how to convert 'mydata["date"]' to class "Date"

I also tried:

> datum <- strptime(imydata["date"], "%d.%m,%y")
> datum
[1] NA

I guess it is a very simple thing I'm doing wrong and missinterpret
the docs.

Thanks for the quick response

Andreas.

-- 
http://fam-tille.de

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


[R] Optimal matching analysis package

2007-03-23 Thread Julien Barnier
Hi,

I recently heard about application of sequencing algorithms to social
data, which seems very interesting. There seems to be at least two
programs whith whom you can do this kind of analysis : Optimize and
TDA.

http://home.uchicago.edu/~aabbott/om.html

http://steinhaus.stat.ruhr-uni-bochum.de/tda.html

So I wonder if there is a R package which could do the same kind of
thing. I've seen the optmatch package, but it doesn't seem to be
exactly the same kind of method (but, as I am really new in this
fiels, I may mistake completely).

Thanks in advance for any help.

-- 
Julien

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


Re: [R] Conversion from string to date type

2007-03-23 Thread jim holtman
Here is how you can convert them to a Date object:

> x <- c('01.03.2007','02.03.2007','03.03.2007')
> y <- as.Date(x, format="%d.%m.%Y")
> y
[1] "2007-03-01" "2007-03-02" "2007-03-03"
> str(y)
Class 'Date'  num [1:3] 13573 13574 13575
>



On 3/23/07, Andreas Tille <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm on my very first steps to R and so I hope that I do
> not ask a really stupid questions but I did not found it
> via R-Search, in the FAQ or Google (BTW, the name "R" is
> not a really good seekiong criterion ;-) ).
>
> I have a data file containing a table that containes
> dates and values like
>
> date\t value1\t value2, ...
> 01.03.2007\t 17\t 42\t ...
> 02.03.2007\t 2\t 3\t ...
> 03.03.2007\t 47\t 11\t ...
> ...
>
> I was perfectly able to read this file via
>
> mydata <- read.csv(file='mydata.dat', sep = '\t', quote='',
> fill=TRUE,header=TRUE )
>
> but the date vector is a vector of strings instead of date values.
> I want to convert these strings into date values to be able
> to make graphs where date is the x-axis and value? the y-axis.
>
> I would be really happy if someone could enlighten me how to
> do this conversion (and a hint how to do a graph as PNG) would
> be an extra bonus which would shorten my further reading of the
> docs).
>
> Kind regards and thanks for your help
>
>   Andreas.
>
> --
> http://fam-tille.de
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

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


[R] plotting dnorm() issued from mclust models

2007-03-23 Thread Frederic Jean
Dear all

I have a problem in fitting lines() of the normal distributions  
identified with Mclust on a histogram or a mclust1Dplot. Here is some  
sample code to explain :

  set.seed(22)
  foo <- c(rnorm(400, 10, 2), rnorm(500, 17, 4))
  mcl <- Mclust(foo, G=2)
  mcl.sd <- sqrt(mcl$parameters$variance$sigmasq)
  mcl.size <- c(length(mcl$classification[mcl$classification==2]),  
length(mcl$classification[mcl$classification==1]))
  x <- pretty(c(0:44), 100)

   my plot of histogram and lines of normal distributions
   SEEMS OK (or am I wrong ?) using frequencies :
  histA <- hist(foo, breaks =c(0:44), ylim = c(0,100))
  lines(x, dnorm(x, mcl$parameters$mean[1], mcl.sd[1])*mcl.size[1],  
col =2, lw=2)
  lines(x, dnorm(x, mcl$parameters$mean[2], mcl.sd[2])*mcl.size[2],  
col =2, lw=2)

   my plot of histogram and lines of normal distributions
   IS wrong when using prob :
  mclust1Dplot(foo, parameters = mcl$parameters, z = mcl$z, what = "density")
  histA <- hist(foo, breaks =c(0:44), prob = T, add =T)
  lines(x, dnorm(x, mcl$parameters$mean[2], mcl.sd[2]), col =2, lw=2)
  lines(x, dnorm(x, mcl$parameters$mean[1], mcl.sd[1]), col =2, lw=2)

In second plot, the bell shaped curves are obviously too high and it  
seems that I miss something obvious in scaling dnorm()'s in building  
the second plot: I tried different things like scaling dnorm() by the  
proportion of individuals belonging to cluster 1 and 2 respectively,  
but with no success.

Could someone help to point my errors ?
Many thanks in advance

Fred J.

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


[R] Conversion from string to date type

2007-03-23 Thread Andreas Tille
Hi,

I'm on my very first steps to R and so I hope that I do
not ask a really stupid questions but I did not found it
via R-Search, in the FAQ or Google (BTW, the name "R" is
not a really good seekiong criterion ;-) ).

I have a data file containing a table that containes
dates and values like

date\t value1\t value2, ...
01.03.2007\t 17\t 42\t ...
02.03.2007\t 2\t 3\t ...
03.03.2007\t 47\t 11\t ...
...

I was perfectly able to read this file via

mydata <- read.csv(file='mydata.dat', sep = '\t', quote='', 
fill=TRUE,header=TRUE )

but the date vector is a vector of strings instead of date values.
I want to convert these strings into date values to be able
to make graphs where date is the x-axis and value? the y-axis.

I would be really happy if someone could enlighten me how to
do this conversion (and a hint how to do a graph as PNG) would
be an extra bonus which would shorten my further reading of the
docs).

Kind regards and thanks for your help

   Andreas.

-- 
http://fam-tille.de

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


Re: [R] subtotal for same row data

2007-03-23 Thread jim holtman
try this:

> x <- as.data.frame(x)
> x
   C1 C2 C3   F
R1  1  2  2 0.3
R2  2  2  2 0.5
R3  1  2  1 0.2
> do.call('rbind',by(x, list(x$C1, x$C2), function(z){z$F <- sum(z$F);
z[1,]}))
   C1 C2 C3   F
R1  1  2  2 0.5
R2  2  2  2 0.5
>



On 3/23/07, Yuan, Qiaoping (NIH/NIAAA) [E] <[EMAIL PROTECTED]> wrote:
>
> Hi, There,
>
> I would like to subtotal the number in a specified column for all rows
> having the same data for specified columns. The following is the simple
> example:
>
>
> > x=matrix(c(1,2,2,0.3,2,2,2,0.5,1,2,1,0.2),3,4,byrow=T)
> > rownames(x)=c("R1","R2","R3")
> > colnames(x)=c("C1","C2","C3","F")
> > x
> C1 C2 C3 F
> R1 1 2 2 0.3
> R2 2 2 2 0.5
> R3 1 2 1 0.2
>
> I would like to get the subtotal in column "F" based on same row data in
> column "C1" and "C2". The result should be like
>
> C1   C2 SumF
> 1 2 0.5 # This is 0.3 + 0.2 from R1 and R3
> 2 2 0.5
>
> Is there a simple way to do this? Any help will be greatly appreciated.
>
> Qiaoping Yuan
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

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


[R] Space for X and Y axis labels

2007-03-23 Thread Joseph Wakeling
Hello all,

I'm having a bit of a problem with x and y axis labels.  Two things:
first, if I want to create a plot with,

plot.new()
plot.window(.)
axis(1)
axis(2)
lines(...)
points(...)

[etc.]

... where do I introduce the xlab=... and ylab=... commands?  I
attempted this in plot.window() but no labels showed up.

Second, here's a bit of real code...

postscript(file="RPDfig.eps",onefile=FALSE,
 + horizontal=FALSE,paper="special",height=8.3,
 + width=11.7)
matplot(2:length(PRICE),t(NWpd),type="l",xlim=c(0,200),
 +  ylim=c(-0.1,0.1),xaxs="i",yaxs="i",xlab="Time",
 +  ylab=expression(over(x,y)),bty="n")
points(2:length(PRICE),Ppd,col="red")
dev.off()

Here the y label is meant to be x over y (a fraction), but the top part
of the fraction is cut off by the border of the graphic.  How can I fix
this, either by creating extra space for the label or by insisting that
the boundary of the graphic be extended to embrace the whole of the
label?  I've tried setting xpd=TRUE in the matplot command, but I'm not
sure that is the correct option (and it makes no difference).

Many thanks,

-- Joe

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


Re: [R] can't load just saved R object "ReadItem: unknown type 65"

2007-03-23 Thread Mark W Kimpel
Luke, I'll be gone for about 2 weeks but will work on getting you a 
reproducible example when I get back. If this topic comes up with anyone 
else, please copy me on your responses as I may miss it in the 600 
emails I'll have to delete on my return :) Mark

Luke Tierney wrote:
> According to the logs nothing at all has changed in the serialization
> code in a month and nothing of consequence for much longer than that.
> To track this down we will need a complete, reproducible, and
> preferably minimal example.
> 
> Best,
> 
> luke
> 
> On Thu, 22 Mar 2007, Mark W Kimpel wrote:
> 
>> I have run into a problem loading a just saved R object using R-devel. I
>> have been saving and loading this particular type of R object for a long
>> while and never ran into this problem. I save, then immediately reload
>> (to test save) and get "ReadItem: unnknown type 65".
>>
>> This error is reproducible after logout from server and restart of emacs
>> and R.
>>
>> Below is my output and sessionInfo().
>>
>> Thanks,
>> Mark
>>
>> > setwd("~/Genomics/Experiments.Genomic/BB01/acb.shell")
>> > local(save(affy.object.preprocessed, file
>> ="affy.object.preprocessed.R" ))
>> > load("affy.object.preprocessed.R")
>> Error in load("affy.object.preprocessed.R") :
>> ReadItem: unknown type 65, perhaps written by later version of R
>> > sessionInfo()
>> R version 2.5.0 Under development (unstable) (2007-03-11 r40824)
>> powerpc64-unknown-linux-gnu
>>
>> locale:
>> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
>>  
>>
>>
>> attached base packages:
>> [1] "splines"   "stats" "graphics"  "grDevices" "datasets"  "utils"
>> [7] "tools" "methods"   "base"
>>
>> other attached packages:
>>  multtestrat2302cdf affycoretools   annaffyxtable
>>  "1.13.1"  "1.15.0"   "1.7.8"   "1.7.3"   "1.4-3"
>> gcrma   matchprobes   biomaRt RCurl   XML
>>   "2.7.3"   "1.7.4"  "1.9.21"   "0.8-0"   "1.6-0"
>>   GOstats  CategoryMatrix   latticegenefilter
>>  "2.1.13"  "2.1.20"   "0.9975-11" "0.14-16"  "1.13.8"
>>  survival  KEGG  RBGL  annotateGO
>>"2.31" "1.15.12"  "1.11.4"  "1.13.6" "1.15.12"
>> graph limma  affyaffyio   Biobase
>>  "1.13.6"  "2.9.13" "1.13.14"   "1.3.3" "1.13.39"
>>
> 

-- 
Mark W. Kimpel MD
Neuroinformatics
Department of Psychiatry
Indiana University School of Medicine

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


Re: [R] simple bar plot question

2007-03-23 Thread Stephen Tucker
Sorry, that was a bit premature - you probably want other arguments in legend
as well; in particular 'fill' is an argument you'd probably be interested in 
for legends of barplots:

legend(x="topleft",cex=yourCex,fill=yourColors,legend.text=yourText,
   lty=NA,pch=NA,#and so on#)

--- Stephen Tucker <[EMAIL PROTECTED]> wrote:

> I think you can set legend=FALSE in barplot() and add your own legend, in
> which you have a lot more control:
> 
> barplot(#your arguments#,legend=FALSE)
> legend(x="topleft",cex=yourCex)
> 
> etc.
> 
> 
> 
> 
> --- Janet <[EMAIL PROTECTED]> wrote:
> 
> > Literally 60 seconds after I sent my question, I found the cex.names  
> > parameter to barplot.
> > I haven't found a parameter for the size of the text in the legend.
> > 
> > Apologies for clogging inboxes semi-unnecessarily.
> > 
> > Janet
> > 
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> > 
> 
> 
> 
>  
>

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



 

Bored stiff? Loosen up...

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


Re: [R] Completely off topic, but amusing?

2007-03-23 Thread Peter Dalgaard
Bert Gunter wrote:
> Folks:
>
> Thought that many on this list might find this amusing, perhaps even a bit
> relevant. Hope it's OK:
>
> 
> WASHINGTON - The government's estimate of the number of Americans without
> health insurance fell by nearly 2 million Friday, but not because anyone got
> health coverage. 
>   
> The Census Bureau
>   said it has
> been overstating the number of people without health insurance since 1995.
> The bureau blamed the inflated numbers on a **12-year-old computer
> programming error**.[emphasis added -- BG]
> **
>
> So what does "validated software" really mean? (Rhetorical question -- no
> reply sought). 
>
>   
Details of what went wrong are at

http://www.census.gov/hhes/www/hlthins/usernote/usernote3-21rev.html

(executive summary: They imputed coverage for some people who were 
actually covered by another household member's policy).

Looks like a mistake you can make in any programming language...

> Cheers to all,
>
> Bert Gunter
> Genentech Nonclinical Statistics
> South San Francisco, CA 94404
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] distribution graph

2007-03-23 Thread Ted Harding
On 23-Mar-07 16:55:40, Marc Schwartz wrote:
> [...]
> How about something like this:
> 
> 
> DistPlot <- function(x, digits = 1, ...)
> {
>   x <- round(x, digits)
>   
>   Tab <- table(x)
> 
>   Vals <- sapply(Tab, function(x) seq(x) - mean(seq(x)))
> 
>   X.Vals <- unlist(Vals, use.names = FALSE)
>   tmp <- sapply(Vals, length)
>   Y.Vals <- rep(names(tmp), tmp)
> 
>   plot(X.Vals, Y.Vals, ...)
> }
> 
> 
> Vec <- exp(rnorm(200, sd = 0.25) + 2) / 5
> 
> DistPlot(Vec, pch = 19)

Very pretty, Marc -- and magic code!!

Ted.


E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 23-Mar-07   Time: 19:20:04
-- XFMail --

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


Re: [R] simple bar plot question

2007-03-23 Thread Stephen Tucker
I think you can set legend=FALSE in barplot() and add your own legend, in
which you have a lot more control:

barplot(#your arguments#,legend=FALSE)
legend(x="topleft",cex=yourCex)

etc.




--- Janet <[EMAIL PROTECTED]> wrote:

> Literally 60 seconds after I sent my question, I found the cex.names  
> parameter to barplot.
> I haven't found a parameter for the size of the text in the legend.
> 
> Apologies for clogging inboxes semi-unnecessarily.
> 
> Janet
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 



 

Finding fabulous fares is fun.

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


[R] objects of class "matrix" and mode "list"?

2007-03-23 Thread Stephen Tucker
Hello everyone,

I cannot seem to find information about objects of class "matrix" and mode
"list", and how to handle them (apart from flattening the list). I get this
type of object from using sapply(). Sorry for the long example, but the code
below illustrates how I get this type of object. Is anyone aware of
documentation regarding this object?

Thanks very much,

Stephen

= begin example 

# I am just making up a fake data set
df <- data.frame(Day=rep(1:3,each=24),Hour=rep(1:24,times=3),
 Name1=rnorm(24*3),Name2=rnorm(24*3))

# define a function to get a set of descriptive statistics
tmp <- function(x) {
  # this function will accept a data frame
  # and return a 1-row data frame of
  # max value, colname of max, min value, and colname of min
  return(data.frame(maxval=max(apply(x,2,max)),
maxloc=names(x)[which.max(apply(x,2,max))],
minval=min(apply(x,2,min)),
minloc=names(x)[which.min(apply(x,2,min))]))
}

# Now applying function to data:
# (1) split the data table by Day with split()
# (2) apply the tmp function defined above to each data frame from (1)
# using lapply()
# (3) transpose the final matrix and convert it to a data frame
# with mixed characters and numbers
# using as.data.frame(), lapply(), and type.convert()

> final <- as.data.frame(lapply(as.data.frame(t(sapply(split(df[,-c(1:2)],
+   
f=df$Day),tmp))),
+   type.convert,as.is=TRUE))
Error in type.convert(x, na.strings, as.is, dec) : 
the first argument must be of mode character

I thought sapply() would give me a data frame or matrix, which I would
transpose into a character matrix, to which I can apply type.convert()
and get the same matrix as what I would get from these two lines (Fold
function taken from Gabor's post on R-help a few years ago):

Fold <- function(f, x, L) for(e in L) x <- f(x, e)
final2 <- Fold(rbind,vector(),lapply(split(df[,-c(1:2)],f=day),tmp))

> print(c(class(final2),mode(final2)))
[1] "data.frame" "list"  


However, by my original method, sapply() gives me a matrix with mode, "list"

intermediate1 <- sapply(split(df[,-c(1:2)],f=df$Day),tmp)
> print(c(class(intermediate1),mode(intermediate1)))
[1] "matrix" "list"  

Transposing, still a matrix with mode list, not character:

intermediate2 <- t(sapply(split(df[,-c(1:2)],f=day),tmp))
> print(c(class(intermediate2),mode(intermediate2)))
[1] "matrix" "list"  

Unclassing gives me the same thing...

> print(c(class(unclass(intermediate2)),mode(unclass(intermediate2
[1] "matrix" "list"  




 

Be a PS3 game guru.

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


Re: [R] memory, speed, and assigning results into new v. existing variable

2007-03-23 Thread David L. Van Brunt, Ph.D.
Yes, at the end... but I'm getting memory allocation errors and outright
crashes DURING the operation when assigning into the same variable... still
waiting for the alternative to survive or not...


On 3/23/07, Bert Gunter <[EMAIL PROTECTED]> wrote:
>
> Actually... there can be more than one "working copy".
>
> Clearly, at the end, when you assign back to the same object, you use less
> memory.
>
> Cheers,
> Bert Gunter
> Genentech Nonclinical Statistics
> South San Francisco, CA 94404
> 650-467-7374
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of David L. Van Brunt,
> Ph.D.
> Sent: Friday, March 23, 2007 11:15 AM
> To: R-Help List
> Subject: [R] memory, speed,and assigning results into new v. existing
> variable
>
> I have a very large data frame, and I'm doing a conversion of all columns
> into factors. Takes a while (thanks to folks here though, for making
> faster!), but am wondering about optimization from a memory perspective...
>
> Internally, am I better off assigning into a new data frame, or doing one
> of
> these:
>
> dataframe<-someoperation(dataframe)
>
> It would seem that re-assigning into the same data frame *might* be more
> efficient in that I don't have to double the memory with 2 objects, but
> then
> again.. there'd have to be a "working copy" in memory until the operation
> was complete, right?
>
> Just curious about the inner workings of R.
>
> --
> ---
> David L. Van Brunt, Ph.D.
> mailto:[EMAIL PROTECTED]
>
> "If Tyranny and Oppression come to this land, it will be in the guise of
> fighting a foreign enemy."
> --James Madison
>
> [[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>


-- 
---
David L. Van Brunt, Ph.D.
mailto:[EMAIL PROTECTED]

"If Tyranny and Oppression come to this land, it will be in the guise of
fighting a foreign enemy."
--James Madison

[[alternative HTML version deleted]]

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


[R] memory, speed, and assigning results into new v. existing variable

2007-03-23 Thread David L. Van Brunt, Ph.D.
I have a very large data frame, and I'm doing a conversion of all columns
into factors. Takes a while (thanks to folks here though, for making
faster!), but am wondering about optimization from a memory perspective...

Internally, am I better off assigning into a new data frame, or doing one of
these:

dataframe<-someoperation(dataframe)

It would seem that re-assigning into the same data frame *might* be more
efficient in that I don't have to double the memory with 2 objects, but then
again.. there'd have to be a "working copy" in memory until the operation
was complete, right?

Just curious about the inner workings of R.

-- 
---
David L. Van Brunt, Ph.D.
mailto:[EMAIL PROTECTED]

"If Tyranny and Oppression come to this land, it will be in the guise of
fighting a foreign enemy."
--James Madison

[[alternative HTML version deleted]]

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


[R] Completely off topic, but amusing?

2007-03-23 Thread Bert Gunter
Folks:

Thought that many on this list might find this amusing, perhaps even a bit
relevant. Hope it's OK:


WASHINGTON - The government's estimate of the number of Americans without
health insurance fell by nearly 2 million Friday, but not because anyone got
health coverage. 

The Census Bureau
  said it has
been overstating the number of people without health insurance since 1995.
The bureau blamed the inflated numbers on a **12-year-old computer
programming error**.[emphasis added -- BG]
**

So what does "validated software" really mean? (Rhetorical question -- no
reply sought). 

Cheers to all,

Bert Gunter
Genentech Nonclinical Statistics
South San Francisco, CA 94404

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


[R] Rweb - calculating mean for an excel table opened in Rweb

2007-03-23 Thread Natalie O'Toole
Hi,

Would anyone happen to know the steps and code for calculating mean on one 
column in a multicolumn exel spreadsheet. I would like to do this 
calculation on a file opened from my computer into Rweb using the Rweb 
open file interface?

Any help would be greatly appreciated!

Thank-you,

Nat
[EMAIL PROTECTED]

403-440-6794

 
This communication is intended for the use of the recipient to which it is 
addressed, and may
contain confidential, personal, and or privileged information. Please contact 
the sender
immediately if you are not the intended recipient of this communication, and do 
not copy,
distribute, or take action relying on it. Any communication received in error, 
or subsequent
reply, should be deleted or destroyed.
[[alternative HTML version deleted]]

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


Re: [R] creating R packs for all

2007-03-23 Thread Prof Brian Ripley
On Fri, 23 Mar 2007, Erin Hodgess wrote:

> Dear R People:
>
> I am in the process of creating an R package via Windows.
>
> If I would decide to submit in to CRAN, what would I need to
> do in order to make it run for the Linux or Mac People, please?

If it passes R CMD check on Windows it should work anywhere.  About the 
only thing that is fussier on Unix than Windows is the use of the correct 
line endings for C etc files.  (OTOH, Windows adds restrictions that 'R 
CMD check' checks for Unix users.)

Quite a high proportion of CRAN packages were prepared on Windows, as can 
be seen from the executable text files, Windows not having a concept of an 
'executable file'.

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

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


Re: [R] Subset

2007-03-23 Thread Petr Klasterecky
You want to obtain a subset of your data, so what about to use subset()...??
You didn't even consider doing some basic search for the solution as the 
posting guide asks you...

Petr

Sergio Della Franca napsal(a):
> Dear R-Helpers,
> 
> I have this dataset:
> 
>YEARPRODUCTS cluster
> 1  10  2
> 2  42  3
> 3  25  2
> 4  42  3
> 5  40  3
> 6  45  1
> 7  44  1
> 8  47  1
> 9  42  1
> 
> 
> I want to create a subset (when cluster=1),
> 
> YEARPRODUCTS cluster
> 6  45  1
> 7  44  1
> 8  47  1
> 9  42  1
> 
> 
> How can i perform this?
> 
> 
> Thank you in advance.
> 
> 
> Sergio Della Franca
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic

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


Re: [R] using "\t" in mtext

2007-03-23 Thread Marc Schwartz
On Fri, 2007-03-23 at 18:29 +0100, Thomas Kaliwe wrote:
> Hi,
>  
> Using tab spaces in mtext e.g.
>  
> > mtext("\t")
>  
> little squares are plotted. Is there a way to use "\t" without getting
> squares displayed?
>  
> Thanks
>  
> Thomas

See this post:

  http://tolstoy.newcastle.edu.au/R/e2/help/06/11/4211.html

You could set up a vector of spaces of the effective tab length that you
wish:

  TAB <- paste(rep(" ", 8), collapse = "")

but bear in mind that unless you are using a monospace font in the
graph, it won't work for text alignment.

If you need text alignment (ie. columns, etc.) consider using the
textplot() function in the gplots package, which I reference in the post
above.

Also reviewing this thread:

  http://tolstoy.newcastle.edu.au/R/help/02b/0346.html

and using:

  RSiteSearch("text alignment plot")

might bring up other posts with alternate approaches.

HTH,

Marc Schwartz

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


[R] p-values for GLMMs

2007-03-23 Thread Cristina Gomes
Hi there,
I have a question about the GLMM that I'm doing, that a statistician 
friend suggested I should have for my analysis. I would like to know if 
there's any way of obtaining a p value and R square for the full model 
(and not each variable separately) as to asses whether this model is 
somewhat appropriate or not. Can one do this for a GLMM in the lme4 
package?
The other thing I wanted to know if there's a way to obtain residuals 
for a GLMM in the lme4 package. I would like to see the effect of the 
significant variables by plotting the residuals of the model without the 
variable of interest against the variable of interest, but I haven't 
found a way of obtaining residuals.
I hope somebody can help me with this.
Thanks a lot,
Cheers,
Cristina.

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


[R] [R-pkgs] RTisean 3.0-7 released

2007-03-23 Thread Antonio, Fabio Di Narzo
Dear R users,
I've just uploaded to CRAN a new version of RTisean, the TISEAN-to-R interface.
This is now compatible with the recent, new 3.0.1 release of TISEAN [1].
This new TISEAN version is explicitely GPL-ed, and has some more
routines handling multivariate time series.

Bests,
Antonio, Fabio Di Narzo.

[1] http://idmc.blogspot.com/2007/03/tisean-300-is-out.html

___
R-packages mailing list
R-packages@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-packages

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


[R] test ANOVA/ANCOVA

2007-03-23 Thread sebastien boutry
Hello everybody,


I search a test for compare the k means but I have one quantitative variable 
and two groups date, traitement. And I suppose my samples are dependant with 
the date.
What the statistical test would I use?
Thank you.

my data:

dateEU  DW
wk1 EU1 5,324547829
wk1 EU1 7,321253265
wk1 EU1 4,431712065
wk1 EU2 8,230322407
wk1 EU2 8,546873269
wk1 EU2 5,657332069
wk1 EU3 3,165508618
wk1 EU3 4,431712065
wk1 EU3 1,899305171
wk2 EU1 2,163097556
wk2 EU1 17,61379438
wk2 EU1 15,82754309
wk2 EU2 16,46064481
wk2 EU2 19,30960257
wk2 EU2 13,92823792
wk2 EU3 6,014466374
wk2 EU3 7,280669822
wk2 EU3 5,064813789
wk4 EU1 11,03179753
wk4 EU1 29,75578101
wk4 EU1 22,71252433
wk4 EU2 27,85647584
wk4 EU2 36,71989997
wk4 EU2 20,11680727
wk4 EU3 13,59661321
wk4 EU3 13,2951362
wk4 EU3 14,56133964
wk6 EU1 30,73875474
wk6 EU1 33,27842393
wk6 EU1 35,27512937
wk6 EU2 31,2817185
wk6 EU2 41,53147307
wk6 EU2 35,57093758
wk6 EU3 8,652390223
wk6 EU3 18,6359174
wk6 EU3 15,30807501

_
Avec Windows Live OneCare éliminez tous les virus de votre PC !

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


[R] R at the Language Log

2007-03-23 Thread davidr
I was pleasantly surprised in my visit to the Language Log to see R
used:

 

"These days, the most straightforward way to answer a question like this
is to do a Monte Carlo simulation. This is easy to do, e.g. in the (free
software) statistics language R  :"

 

http://itre.cis.upenn.edu/~myl/languagelog/archives/004328.html#more

 

Pay a visit.

 

David L. Reiner

Rho Trading Securities, LLC

Chicago  IL  60605

312-362-4963

 


[[alternative HTML version deleted]]

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


Re: [R] plotting symbol

2007-03-23 Thread Chuck Cleland
Peter Dalgaard wrote:
> Chuck Cleland wrote:
>> Federico Calboli wrote:
>>  
>>> Hi All,
>>>
>>> can I have a plot where the symbol for the dots is smaller than pch 
>>> =20 but bigger than pch = '.'?
>>> 
>>
>>   Have you considered using the cex argument to reduce the size of
>> pch=20?
>>
>> X <- rnorm(20)
>>
>> par(mfrow=c(2,2))
>> plot(X, pch=20, cex=1.0)
>> plot(X, pch=20, cex=0.6)
>> plot(X, pch=20, cex=1.5)
>> plot(X, pch=".")
>>
>>   
> Notice though, that it depends on the device. On X11 (presumably Windows
> too) at "normal" resolutions, you really have only one sice which is
> less than the default. Try e.g.
> 
> plot(1:10, rep(0,10), pch=20,cex=seq(1,.1,,10))

Peter:
  Thanks for making that point, which certainly did not occur to me.  I
see the same thing with the windows device with pointsize at the default
of 12 (win.graph too).  With pointsize=15 I can get two sizes smaller
than the default.  And on the pdf device I get many sizes less than the
default.

>>> Best,
>>>
>>> Fede
>>>
>>> -- 
>>> Federico C. F. Calboli
>>> Department of Epidemiology and Public Health
>>> Imperial College, St. Mary's Campus
>>> Norfolk Place, London W2 1PG
>>>
>>> Tel +44 (0)20 75941602   Fax +44 (0)20 75943193
>>>
>>> f.calboli [.a.t] imperial.ac.uk
>>> f.calboli [.a.t] gmail.com
>>>
>>> __
>>> R-help@stat.math.ethz.ch mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code. 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

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


[R] creating R packs for all

2007-03-23 Thread Erin Hodgess
Dear R People:

I am in the process of creating an R package via Windows.

If I would decide to submit in to CRAN, what would I need to
do in order to make it run for the Linux or Mac People, 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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Subset

2007-03-23 Thread Uwe Ligges
See ?subset !!!
And please do read the psoting guide.

Uwe Ligges


Sergio Della Franca wrote:
> Dear R-Helpers,
> 
> I have this dataset:
> 
>YEARPRODUCTS cluster
> 1  10  2
> 2  42  3
> 3  25  2
> 4  42  3
> 5  40  3
> 6  45  1
> 7  44  1
> 8  47  1
> 9  42  1
> 
> 
> I want to create a subset (when cluster=1),
> 
> YEARPRODUCTS cluster
> 6  45  1
> 7  44  1
> 8  47  1
> 9  42  1
> 
> 
> How can i perform this?
> 
> 
> Thank you in advance.
> 
> 
> Sergio Della Franca
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Subset

2007-03-23 Thread Mark Wardle
Sergio Della Franca wrote:
> Dear R-Helpers,
> 
> I have this dataset:
> 
>YEARPRODUCTS cluster
> 1  10  2
> 2  42  3
> 3  25  2
> 4  42  3
> 5  40  3
> 6  45  1
> 7  44  1
> 8  47  1
> 9  42  1
> 
> 
> I want to create a subset (when cluster=1),
> 
> YEARPRODUCTS cluster
> 6  45  1
> 7  44  1
> 8  47  1
> 9  42  1
> 
> 
> How can i perform this?
> 
> 

You've answered your own question!

?subset


e.g., subset(my.data, cluster==1)

You should also notice that many R functions support a subset=
parameter, which is very useful!

Mark

-- 
Dr. Mark Wardle
Specialist registrar, Neurology
Cardiff, UK

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


[R] using "\t" in mtext

2007-03-23 Thread Thomas Kaliwe
Hi,
 
Using tab spaces in mtext e.g.
 
> mtext("\t")
 
little squares are plotted. Is there a way to use "\t" without getting
squares displayed?
 
Thanks
 
Thomas

[[alternative HTML version deleted]]

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


Re: [R] plotting symbol

2007-03-23 Thread Peter Dalgaard
Chuck Cleland wrote:
> Federico Calboli wrote:
>   
>> Hi All,
>>
>> can I have a plot where the symbol for the dots is smaller than pch  
>> =20 but bigger than pch = '.'?
>> 
>
>   Have you considered using the cex argument to reduce the size of pch=20?
>
> X <- rnorm(20)
>
> par(mfrow=c(2,2))
> plot(X, pch=20, cex=1.0)
> plot(X, pch=20, cex=0.6)
> plot(X, pch=20, cex=1.5)
> plot(X, pch=".")
>
>   
Notice though, that it depends on the device. On X11 (presumably Windows 
too) at "normal" resolutions, you really have only one sice which is 
less than the default. Try e.g.

plot(1:10, rep(0,10), pch=20,cex=seq(1,.1,,10))


>> Best,
>>
>> Fede
>>
>> --
>> Federico C. F. Calboli
>> Department of Epidemiology and Public Health
>> Imperial College, St. Mary's Campus
>> Norfolk Place, London W2 1PG
>>
>> Tel +44 (0)20 75941602   Fax +44 (0)20 75943193
>>
>> f.calboli [.a.t] imperial.ac.uk
>> f.calboli [.a.t] gmail.com
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code. 
>> 
>
>

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


[R] course on Analysis of Repeated Measurements by Ronald Geskus

2007-03-23 Thread Dick Verkerk

   Analysis of Repeated Measurements
   By Dr. Ronald Geskus
   April 27, 2007
   Amsterdam, The Netherlands

   http://www.can.nl/events/details.php?id=31

   This course is aimed at everyone who is working with data that contain
   repeated measurements on persons or otherwise related data and who wants
   to analyse such data in a proper way.

   In many situations one may have data that show some form of dependence.
   Longitudinal data occur when some outcome variable is measured on
   experimental units at several points in time, often with the aim to study
   development over time. Dependence also occurs when data have been
   collected within units, like the performance score of students within
   different schools. For the analysis, special statistical methods are
   required that take account of the correlation of observations within the
   same unit. For normally distributed variables, the mixed-effects model is
   the standard tool for analysis. In S-PLUS and R, the NLME library
   introduced the "groupedData" class, which will be used as the basic
   structure for the analysis of linear models with repeated measurements
   (linear mixed effects). Together with the extensive possibilities for
   graphical exploration in S-PLUS and R, a flexible tool for the analysis of
   longitudinal data and the evaluation of the model fits are available.
   Programs for the analysis of discrete and non-normally distributed
   variables will also be covered briefly. Emphasis of the course is on the
   practical application of models for longitudinal data. Participants will
   be made familiar with the possibilities offered by S-PLUS and R through
   computer exercises.


   you will learn how to
   * plot individual patterns of repeated measurements in a flexible way
   * perform analyses for repeated measurements and show results graphically
   * evaluate model fit, numerically as well as graphically


   Experience with the analysis of repeated measurements is not assumed.
   Knowledge of R or S-PLUS at the level of the introductory course is advised.


   Location:  Amsterdam
   Date:  April 27
   Time:  10:00h.-17:00h.
   Price   :  EURO 395,- excl. VAT, Includes lunch and course materials

   Register:
   - phone : +31-(0)20-560-8400
   - Email : [EMAIL PROTECTED]
   - Web   : http://www.can.nl/events/details.php?id=31

   There is a maximum of 12 participants.

   You may register by replying to this email and provide us with the
   following information.

   Name   :  M / F
   Title  :
   Department :
   Institute  :
   Address:
   City   :
   Zip:
   Telephone  :
   Fax:
   Email  :

   Please let us know if you have any questions.

   Please feel free to send this message on to your colleagues and friends
   for whom it might be interesting!!

   Kind regards,
   Dick Verkerk
   CANdiensten


   _

   Dick Verkerk, managing director
   CANdiensten, Nieuwpoortkade 23-25, NL-1055 RX Amsterdam
   tel: +31 20 5608410 fax: +31 20 5608448 [EMAIL PROTECTED]
   _
   Your Partner in Mathematics and Statistics!

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


[R] Course on Survival Analysis in Amsterdam

2007-03-23 Thread Dick Verkerk

Survival Analysis
By Dr. Ronald Geskus
May 24-25, 2007
Amsterdam, The Netherlands

http://www.can.nl/events/details.php?id=30


This course is aimed at everyone who wants to analyze data in which
the time to the occurrence of some event, and its dependence on
covariates, is of interest.

Survival analysis consists of a collection of techniques for the
analysis of time-to-event data. Part of the relevant time window
may be unobserved. In the most frequently encountered situation,
there is one event of interest, and the event time is either
observed exactly or right censored. Programs for the analysis of
right censored data have become readily available.
Emphasis of the course is on the practical application of models
for survival data. Participants will be made familiar with the
possibilities offered through computer exercises.


You will learn how to:
• perform survival analyses and present the results graphically
• analyze the influence of covariates on the event time distribution
• model linear- as well as nonlinear effects of covariates
• evaluate model fit via residuals
• analyze interval censored data
• perform competing risks analyses
• analyze correlated event data

Experience with survival analysis is not assumed. Knowledge of R or
S-PLUS at the level of the introductory course is advised.

Location: Amsterdam
Date : December 15-16
Time : 10:00h.-16:30h.
Price : EURO 790,- excl. VAT, Includes lunch and course materials

Register:
- phone : +31-(0)20-560-8400
- Email : [EMAIL PROTECTED]
- Web : http://www.can.nl/events/details.php?id=30

There is a maximum of 12 participants.

You may register by replying to this email and provide us with the
following information.

Name : M / F
Title :
Department :
Institute :
Address :
City :
Zip :
Telephone :
Fax :
Email :

Please let us know if you have any questions.

Please feel free to send this message on to your colleagues and friends
for whom it might be interesting!!

Kind regards,
Dick Verkerk
CANdiensten


_

Dick Verkerk, managing director
CANdiensten, Nieuwpoortkade 23-25, NL-1055 RX Amsterdam
tel: +31 20 5608410 fax: +31 20 5608448 [EMAIL PROTECTED]
_
Your Partner in Mathematics and Statistics!

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


Re: [R] generating lognormal variables with given correlation

2007-03-23 Thread Francisco J. Zagmutt
This reference may be relevant for you: Connover, W.J., Iman, R.L. A 
distribution-free approach to inducing rank correlation among input 
variables. Technometric, 3, 311-334, 1982.

Also, you may want to look at a more modern approach implemented in the 
copula package:
install.packages("copula")
library(help="copula")

I hope this helps,

Francisco,


Karl Ove Hufthammer wrote:
> Mollet, Fabian:
> 
>> I would like these (lognormal distributed) parameters to be correlated,
>> that is, I would like to have pairwise samples of 2 parameters with a
>> given correlation coefficient.
>>  
>> I have seen that a covariance matrix can be fixed when generating random
>> variables from a multivariate normal distribution e.g. by the function
>> mvrnorm.
>>  
>> Is there a function to do the same for a multivariate lognormal
>> distribution?
> 
> I don't know about any, but you should be aware that not all values of the 
> correlation is possible with lognormal distributions. For example, if both 
> variables have a standard lognormal distribution, they can't have correlation 
> less than 1/e = -0.37. As the variance of the two distributions increase, the 
> absolute value of the maximum and minimum correlation possible decrease (to 
> zero).
> 
> Using the normal product-moment correlation as a measure of dependence rarely 
> makes much sense unless the association between the variables is linear.
>

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


Re: [R] distribution graph

2007-03-23 Thread Marc Schwartz
On Fri, 2007-03-23 at 14:22 +, [EMAIL PROTECTED] wrote:
> [Apologies -- there were errors in the code I posted previously.
>  A corrected version is below]
> 
> On 23-Mar-07 11:06:49, Plessen, Christian von wrote:
> > 
> > I am looking for a way to produce a "distribution graph" as in the
> > example: 
> > 
> > (http://cecsweb.dartmouth.edu/release1.1/datatools/dgraph.php?year=2003&;
> > geotype=STD_HRR&event=A01_DIS&eventtype=UTIL
> > 
> > Anybody who can help?
> > 
> 
> The following (which anyway needs refinement, and can very
> probably be done better) provides a basis (illustrated using
> a sample from a log-normal distribution):
> 
> 
> X<-exp(rnorm(200,sd=0.25)+2)/5
> 
> H<-hist(X,breaks=20)
> C<-H$counts
> Y<-H$mids
> C1<-C/2
> 
> C0<-(-(C1[1]-1/2)):(C1[1]-1/2); n0<-length(C0)
> plot(C0,rep(Y[1],n0),xlim=c(-max(C)/2,max(C)/2),ylim=c(min(Y),max(Y)))
> 
> for(i in (2:length(Y))){
>   if(C[i]==0) next
>   C0 <- (-(C1[i] - 1/2)):(C1[i] - 1/2); n0<-length(C0)
>   points(C0,rep(Y[i],n0))
> }
> 
> 
> Hoping this helps!
> Ted.


How about something like this:


DistPlot <- function(x, digits = 1, ...)
{
  x <- round(x, digits)
  
  Tab <- table(x)

  Vals <- sapply(Tab, function(x) seq(x) - mean(seq(x)))

  X.Vals <- unlist(Vals, use.names = FALSE)
  tmp <- sapply(Vals, length)
  Y.Vals <- rep(names(tmp), tmp)

  plot(X.Vals, Y.Vals, ...)
}


Vec <- exp(rnorm(200, sd = 0.25) + 2) / 5

DistPlot(Vec, pch = 19)



HTH,

Marc Schwartz

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


Re: [R] R and clinical studies

2007-03-23 Thread Cody_Hamilton

Thanks for the tip.  I will look forward to trying this package out soon!

Regards, -Cody



   
 Hans-Peter
 <[EMAIL PROTECTED] 
 m> To 
   "[EMAIL PROTECTED]" 
 03/23/2007 09:31  <[EMAIL PROTECTED]> 
 AM cc 
   
   Subject 
   Re: [R] R and clinical studies  
   
   
   
   
   
   




Hi,

2007/3/20, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:

> and (2) SAS seems to play nicer with MS products (e.g. PROC IMPORT seemed
> to read in messy Excel spreadsheets better than importData in Splus).

(to pick one small detail from your post)

You can use my xlsReadWrite package which will (on windows) read and
write Excel data (-> see CRAN, a new version is pending). While there
is a pro version also, in lot of circumstances the free version is
perfectly fine.


--
Regards,
Hans-Peter

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


Re: [R] Updating a worksheet in Excel file using RODBC

2007-03-23 Thread Hans-Peter
Hi,

2007/3/23, Moshe Olshansky <[EMAIL PROTECTED]>:
> Hello!
>
>I have no problem reading Excel files (each worksheet in the file is
a >"table" which can be read - at least in my case).
>What I would like to do is to read such a table, change it (just the
>contents, not the format) and write it back, and this I can not do.
I am >getting the following error messages (3 slightly different
attempts):

> [snip]

As another option (if you work with Windows) you can check my
"xlsReadWrite" package (-> CRAN).

It should work very well in your case (it's not suited if you want to
use SQL (join) statements, but for plain data reading/writing it is
nice).

For both versions (free/pro) updates are pending. They should be
released by end of next week (but no guarantees).

-- 
Regards,
Hans-Peter

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


[R] simple bar plot question

2007-03-23 Thread Janet
Literally 60 seconds after I sent my question, I found the cex.names  
parameter to barplot.
I haven't found a parameter for the size of the text in the legend.

Apologies for clogging inboxes semi-unnecessarily.

Janet

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


Re: [R] Get "home" directory and simple I/O

2007-03-23 Thread Peter Dalgaard
Andris Jankevics wrote:
> If you want get a username of user currently running R on Linux,you can use a 
> system command and read enviroment variables:
>
> paste("/home/",system ("whoami",intern=TRUE),sep="")
>
>   
This would be more to the point (and safer), I think.

 > Sys.getenv("HOME")
HOME
"/home/bs/pd"


> Andris Jankevics
>
> On Piektdiena, 23. Marts 2007 14:30, Alberto Monteiro wrote:
>   
>> Is there any generic function that gets the "home" directory? This
>> should return /home/ in Linux and
>> x:/Documents and Settings/ (or whatever) in Windows XP.
>>
>> Another (unrelated) question: what is the _simplest_ way to
>> read and write R variables to/from files such that they are
>> stored in a human-readable but R-like form? For example, if
>> (say), x is a vector defined as x <- c(1, 2, 3), can I write
>> (and read) x as a file with just one line, namely: c(1, 2, 3) ?
>>
>> Alberto Monteiro
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html and provide commented, minimal,
>> self-contained, reproducible code.
>> 
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] plotting symbol

2007-03-23 Thread Chuck Cleland
Federico Calboli wrote:
> Hi All,
> 
> can I have a plot where the symbol for the dots is smaller than pch  
> =20 but bigger than pch = '.'?

  Have you considered using the cex argument to reduce the size of pch=20?

X <- rnorm(20)

par(mfrow=c(2,2))
plot(X, pch=20, cex=1.0)
plot(X, pch=20, cex=0.6)
plot(X, pch=20, cex=1.5)
plot(X, pch=".")

> Best,
> 
> Fede
> 
> --
> Federico C. F. Calboli
> Department of Epidemiology and Public Health
> Imperial College, St. Mary's Campus
> Norfolk Place, London W2 1PG
> 
> Tel +44 (0)20 75941602   Fax +44 (0)20 75943193
> 
> f.calboli [.a.t] imperial.ac.uk
> f.calboli [.a.t] gmail.com
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code. 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

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


[R] Subset

2007-03-23 Thread Sergio Della Franca
Dear R-Helpers,

I have this dataset:

   YEARPRODUCTS cluster
1  10  2
2  42  3
3  25  2
4  42  3
5  40  3
6  45  1
7  44  1
8  47  1
9  42  1


I want to create a subset (when cluster=1),

YEARPRODUCTS cluster
6  45  1
7  44  1
8  47  1
9  42  1


How can i perform this?


Thank you in advance.


Sergio Della Franca

[[alternative HTML version deleted]]

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


[R] Simple bar plot question

2007-03-23 Thread Janet
Dear all,

This is a simple question, but as far as I can tell, it's not in MASS  
or the R help archives or par man pages.

Are there any cex.* parameters which allow me to set the text size of  
the labels for the axes and the size of the legend?

I want to plot the following table in which the "Definitely not",  
etc. are large.  cex.lab lets me change the size of the xlab text,  
but I don't care whether xlab is large.  I also want the "Child  
hasn't had oral sex", etc. in the legend to be large.

 > par.prob.oralsex
Definitely notProbably not 
Yes,  
probablyYes, definitely
child hasn't had oral sex   0.60.2   0.1  0.1
child has had oral sex  0.50.3  0.1 0.1


barplot(par.prob.oralsex, beside=T, ylab="Proportion parents", ylim=c 
(0,1), legend.text=T, horiz=F, col=c("red", "blue"), space=c(0,4),  
xlab="Parent response", cex.axis=1.3, cex.lab=1.3, cex.main=1.3,  
cex.sub=1.3)

Thanks,

Janet

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


[R] plotting symbol

2007-03-23 Thread Federico Calboli
Hi All,

can I have a plot where the symbol for the dots is smaller than pch  
=20 but bigger than pch = '.'?

Best,

Fede

--
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

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


[R] Simple bar plot question

2007-03-23 Thread Janet

Dear all,

This is a simple question, but as far as I can tell, it's not in MASS  
or the R help archives or par man pages.

Are there any cex.* parameters which allow me to set the text size of  
the labels for the axes?

I want to plot the following table in which the "Definitely not",  
etc. are large.  cex.lab lets me change the size of the xlab text,  
but I don't care whether xlab is large.

 > par.prob.oralsex
Definitely notProbably not 
Yes,  
probablyYes, definitely
child hasn't had oral sex   0.60.2   0.1  0.1
child has had oral sex  0.50.3  0.1 0.1


barplot(par.prob.oralsex, beside=T, ylab="Proportion parents", ylim=c 
(0,1), legend.text=T, horiz=F, col=c("red", "blue"), space=c(0,4),  
xlab="Parent response", cex.axis=1.3, cex.lab=1.3, cex.main=1.3,  
cex.sub=1.3)

Thanks,

Janet

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


[R] subtotal for same row data

2007-03-23 Thread Yuan, Qiaoping \(NIH/NIAAA\) [E]
Hi, There,

I would like to subtotal the number in a specified column for all rows having 
the same data for specified columns. The following is the simple example:


> x=matrix(c(1,2,2,0.3,2,2,2,0.5,1,2,1,0.2),3,4,byrow=T)
> rownames(x)=c("R1","R2","R3")
> colnames(x)=c("C1","C2","C3","F")
> x
   C1 C2 C3   F
R1  1  2  2 0.3
R2  2  2  2 0.5
R3  1  2  1 0.2

I would like to get the subtotal in column "F" based on same row data in column 
"C1" and "C2". The result should be like

C1   C2 SumF
1    2    0.5  # This is 0.3 + 0.2 from R1 and R3
2    2    0.5

Is there a simple way to do this? Any help will be greatly appreciated.

Qiaoping Yuan

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


Re: [R] Effect display of proportional odds model

2007-03-23 Thread Jan Wijffels
Great! That was all I needed!

Best regards,
Jan

Jan Wijffels
University Center for Statistics 
W. de Croylaan 54
3001 Heverlee
Belgium
tel: +32 (0)16 322784
fax: +32 (0)16 322831
http://www.kuleuven.be/ucs

-Original Message-
From: John Fox [mailto:[EMAIL PROTECTED] 
Sent: vrijdag 23 maart 2007 16:43
To: 'Jan Wijffels'
Cc: r-help@stat.math.ethz.ch; 'Jeff Miller'
Subject: RE: [R] Effect display of proportional odds model

Dear Jan,

I've placed a copy of the published version of the paper at
, along with the R code for computing effects and their standard
errors and R code for the graphs in the paper. As you'll see, the
functions
provided do not construct graphs automatically, as those in the effects
package do for linear and generalized linear models. Eventually, I'd
like to
incorporate this material in the effects package.

Regards,
 John


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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Jan Wijffels
> Sent: Friday, March 23, 2007 7:36 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Effect display of proportional odds model
> 
> Dear useRs,
> I very much like the effect display of the proportional odds 
> model on page 29 (Figure 8) of the following paper by John Fox:
> http://socserv.mcmaster.ca/jfox/Papers/logit-effect-displays.pdf
> It really gives a very concise overview of the model. I would 
> like to use it to illustrate the proportional odds mixed 
> models we fit here for a project on Diabetes but I can't seem 
> to reproduce the plot. Does anyone have code for the plot? 
> Maybe John Fox himself? I would appreciate it very much.
> Thanks,
> Jan
>  
> Jan Wijffels
> University Center for Statistics
> W. de Croylaan 54
> 3001 Heverlee
> Belgium
> tel: +32 (0)16 322784
> fax: +32 (0)16 322831
>   http://www.kuleuven.be/ucs
>  
> 
> 
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

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


[R] subtotal for same row data

2007-03-23 Thread Yuan, Qiaoping \(NIH/NIAAA\) [E]
Hi, There,

 

I would like to subtotal the number in a specified column for all rows
having the same data for specified columns. The following is the simple
example:

 

 

> x=matrix(c(1,2,2,0.3,2,2,2,0.5,1,2,1,0.2),3,4,byrow=T)

> rownames(x)=c("R1","R2","R3")

> colnames(x)=c("C1","C2","C3","F")

> x

   C1 C2 C3   F

R1  1  2  2 0.3

R2  2  2  2 0.5

R3  1  2  1 0.2

 

I would like to get the subtotal in column "F" based on same row data in
column "C1" and "C2". The result should be like

 

C1 C2 SumF

120.5  # This is 0.3 + 0.2 from R1 and R3

220.5

 

Is there a simple way to do this? Any help will be greatly appreciated.

 

Qiaoping Yuan

 


[[alternative HTML version deleted]]

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


Re: [R] Effect display of proportional odds model

2007-03-23 Thread John Fox
Dear Jan,

I've placed a copy of the published version of the paper at
, along with the R code for computing effects and their standard
errors and R code for the graphs in the paper. As you'll see, the functions
provided do not construct graphs automatically, as those in the effects
package do for linear and generalized linear models. Eventually, I'd like to
incorporate this material in the effects package.

Regards,
 John


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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Jan Wijffels
> Sent: Friday, March 23, 2007 7:36 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Effect display of proportional odds model
> 
> Dear useRs,
> I very much like the effect display of the proportional odds 
> model on page 29 (Figure 8) of the following paper by John Fox:
> http://socserv.mcmaster.ca/jfox/Papers/logit-effect-displays.pdf
> It really gives a very concise overview of the model. I would 
> like to use it to illustrate the proportional odds mixed 
> models we fit here for a project on Diabetes but I can't seem 
> to reproduce the plot. Does anyone have code for the plot? 
> Maybe John Fox himself? I would appreciate it very much.
> Thanks,
> Jan
>  
> Jan Wijffels
> University Center for Statistics
> W. de Croylaan 54
> 3001 Heverlee
> Belgium
> tel: +32 (0)16 322784
> fax: +32 (0)16 322831
>   http://www.kuleuven.be/ucs
>  
> 
> 
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


[R] Logistic Regression

2007-03-23 Thread Sergio Della Franca
Dear R-Helpers,

I want to perform a logistic regression on my dataset (y).

I used the following code:

logistic<-glm(formula="interest_variable"~.,family = binomial(link = logit),
data = y)


This run correctly.
Then i want to develop the logistic regression with three different method:
-forward
-backward
-stepwise

I used these procedure:
forward<-step(logistica,direction="forward")
backward<-step(logistica,direction="backward")
stepwise<-step(logistica,direction="both")

Even these run correctly, but i obtained the same results with the three
different procedures.

Then I tought i made some mistakes.

My question is:

Is correct what i did?
Is correct that three different methods return the same results?

If i made some mistakes, what is the correct method to correctly perform the
three different logistics regression?


Thank you in advance.


Sergio Della Franca.

[[alternative HTML version deleted]]

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


Re: [R] Get "home" directory and simple I/O

2007-03-23 Thread Alberto Monteiro
Prof Brian Ripley wrote:
>
> But the request was for a *generic* solution.  On Windows there
> might not be anything corresponding to a home directory
> (and the rw-FAQ discusses the concept and how R resolves this).
> 
> The best answer I know of is path.expand("~").
> 
Thanks, this is the only solution that works for Windows XP,
and it will probably work for Linux.

Also, in Windows, there are variables homedrive and homepath,
that I could combine to form the path (probably this is what
path.expand does :-))

Sys.getenv("homepath")
Sys.getenv("homedrive")

Alberto Monteiro

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


Re: [R] Get "home" directory and simple I/O

2007-03-23 Thread Gabor Grothendieck
path.expand("~") also seems to work on Windows XP.

On 3/23/07, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
> But the request was for a *generic* solution.  On Windows there
> might not be anything corresponding to a home directory (and the rw-FAQ
> discusses the concept and how R resolves this).
>
> The best answer I know of is path.expand("~").
>
> On Fri, 23 Mar 2007, Henrik Andersson wrote:
>
> > Sys.getenv("HOME") works in Linux at least
>
> But not all Unix shells have it set, and a user can unset or reset it.  To
> be perverse:
>
> gannet% unsetenv HOME
> gannet% R --slave
> Sys.getenv("HOME")
> HOME
>   ""
> path.expand("~")
> [1] "/data/gannet/ripley"
> q()
>
> (If you set HOME to something other than your home directory it will be
> honoured.)
>
> >
> > - Henrik
> >
> > Andris Jankevics wrote:
> >> If you want get a username of user currently running R on Linux,you can 
> >> use a
> >> system command and read enviroment variables:
> >>
> >> paste("/home/",system ("whoami",intern=TRUE),sep="")
>
> And my home directory is not '/home/ripley' on any of the Linux boxes I
> use (even though it exists on some of them), e.g. on my compute server
>
> > path.expand("~")
> [1] "/data/gannet/ripley"
>
> and on our main cluster
>
> > path.expand("~")
> [1] "/home/markov/ripley"
>
>
> >> Andris Jankevics
> >>
> >> On Piektdiena, 23. Marts 2007 14:30, Alberto Monteiro wrote:
> >>
> >>> Is there any generic function that gets the "home" directory? This
> >>> should return /home/ in Linux and
> >>> x:/Documents and Settings/ (or whatever) in Windows XP.
>
> [...]
>
> --
> Brian D. Ripley,  [EMAIL PROTECTED]
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel:  +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UKFax:  +44 1865 272595
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] Get "home" directory and simple I/O

2007-03-23 Thread Gabor Grothendieck
On 3/23/07, Liaw, Andy <[EMAIL PROTECTED]> wrote:
> From: Gabor Grothendieck
> >
> > See:
> >
> > ?R.home
>
> That's not what Alberto wanted:  It gives the location of the R
> installation, not where user's home directory is.  AFAIK Windows does
> not set the HOME environment variable by default.

ok.  Try this, at least on Windows XP:

paste(Sys.getenv(c("HOMEDRIVE", "HOMEPATH")), collapse = "")

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


[R] simulate from a multivariate lognormal distribution with fixed covariance/correlation structure

2007-03-23 Thread Mollet, Fabian
Dear R users
 
I use simulated data to evaluate a model by sampling the parameters in
my model from lognormal distributions.
 
I would like these (lognormal distributed) parameters to be correlated,
that is, I would like to have pairwise samples of 2 parameters with a
given correlation coefficient.
 
I have seen that a covariance matrix can be fixed when generating random
variables from a multivariate normal distribution e.g. by the function
mvrnorm.
 
Is there a function to do the same (as illustrated below from a
multivariate normal) from a multivariate lognormal distribution?
 
Thank you!
 
Fabian
 
 

library(MASS)
corab<-0.8
a.mu<-2; a.sd<-1
b.mu<-1; b.sd<-0.5
sigma<-matrix(c(a.sd^2,corab*a.sd*b.sd,corab*a.sd*b.sd,b.sd^2),nrow=2,nc
ol=2,byrow=T)
mvn<-mvrnorm(n = 1000, mu=c(a.mu,b.mu), Sigma=sigma, tol = 1e-6,
empirical = TRUE)
avar<-mvn[,1]
bvar<-mvn[,2]
cor(avar,bvar)

[[alternative HTML version deleted]]

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


Re: [R] Get "home" directory and simple I/O

2007-03-23 Thread Prof Brian Ripley
But the request was for a *generic* solution.  On Windows there
might not be anything corresponding to a home directory (and the rw-FAQ 
discusses the concept and how R resolves this).

The best answer I know of is path.expand("~").

On Fri, 23 Mar 2007, Henrik Andersson wrote:

> Sys.getenv("HOME") works in Linux at least

But not all Unix shells have it set, and a user can unset or reset it.  To 
be perverse:

gannet% unsetenv HOME
gannet% R --slave
Sys.getenv("HOME")
HOME
   ""
path.expand("~")
[1] "/data/gannet/ripley"
q()

(If you set HOME to something other than your home directory it will be 
honoured.)

>
> - Henrik
>
> Andris Jankevics wrote:
>> If you want get a username of user currently running R on Linux,you can use a
>> system command and read enviroment variables:
>>
>> paste("/home/",system ("whoami",intern=TRUE),sep="")

And my home directory is not '/home/ripley' on any of the Linux boxes I 
use (even though it exists on some of them), e.g. on my compute server

> path.expand("~")
[1] "/data/gannet/ripley"

and on our main cluster

> path.expand("~")
[1] "/home/markov/ripley"


>> Andris Jankevics
>>
>> On Piektdiena, 23. Marts 2007 14:30, Alberto Monteiro wrote:
>>
>>> Is there any generic function that gets the "home" directory? This
>>> should return /home/ in Linux and
>>> x:/Documents and Settings/ (or whatever) in Windows XP.

[...]

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

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


Re: [R] generating lognormal variables with given correlation

2007-03-23 Thread Karl Ove Hufthammer
Mollet, Fabian:

> I would like these (lognormal distributed) parameters to be correlated,
> that is, I would like to have pairwise samples of 2 parameters with a
> given correlation coefficient.
>  
> I have seen that a covariance matrix can be fixed when generating random
> variables from a multivariate normal distribution e.g. by the function
> mvrnorm.
>  
> Is there a function to do the same for a multivariate lognormal
> distribution?

I don't know about any, but you should be aware that not all values of the 
correlation is possible with lognormal distributions. For example, if both 
variables have a standard lognormal distribution, they can't have correlation 
less than 1/e = -0.37. As the variance of the two distributions increase, the 
absolute value of the maximum and minimum correlation possible decrease (to 
zero).

Using the normal product-moment correlation as a measure of dependence rarely 
makes much sense unless the association between the variables is linear.

-- 
Karl Ove Hufthammer

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


[R] generating lognormal variables with given correlation

2007-03-23 Thread Mollet, Fabian
Dear R users
 
I use simulated data to evaluate a model by sampling the parameters in
my model from lognormal distributions.
 
I would like these (lognormal distributed) parameters to be correlated,
that is, I would like to have pairwise samples of 2 parameters with a
given correlation coefficient.
 
I have seen that a covariance matrix can be fixed when generating random
variables from a multivariate normal distribution e.g. by the function
mvrnorm.
 
Is there a function to do the same for a multivariate lognormal
distribution?
 
Thank you!
 
Fabian

[[alternative HTML version deleted]]

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


Re: [R] Get "home" directory and simple I/O

2007-03-23 Thread Liaw, Andy
From: Gabor Grothendieck
> 
> See:
> 
> ?R.home

That's not what Alberto wanted:  It gives the location of the R
installation, not where user's home directory is.  AFAIK Windows does
not set the HOME environment variable by default.

> ?dput
> 
> On 3/23/07, Alberto Monteiro <[EMAIL PROTECTED]> wrote:
> > Is there any generic function that gets the "home" directory? This 
> > should return /home/ in Linux and x:/Documents and 
> > Settings/ (or whatever) in Windows XP.
> >
> > Another (unrelated) question: what is the _simplest_ way to 
> read and 
> > write R variables to/from files such that they are stored in a 
> > human-readable but R-like form? For example, if (say), x is 
> a vector 
> > defined as x <- c(1, 2, 3), can I write (and read) x as a file with 
> > just one line, namely: c(1, 2, 3) ?
> >
> > Alberto Monteiro
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide 
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 
> 


--
Notice:  This e-mail message, together with any attachments,...{{dropped}}

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


Re: [R] Get "home" directory and simple I/O

2007-03-23 Thread Gabor Grothendieck
See:

?R.home
?dput

On 3/23/07, Alberto Monteiro <[EMAIL PROTECTED]> wrote:
> Is there any generic function that gets the "home" directory? This
> should return /home/ in Linux and
> x:/Documents and Settings/ (or whatever) in Windows XP.
>
> Another (unrelated) question: what is the _simplest_ way to
> read and write R variables to/from files such that they are
> stored in a human-readable but R-like form? For example, if
> (say), x is a vector defined as x <- c(1, 2, 3), can I write
> (and read) x as a file with just one line, namely: c(1, 2, 3) ?
>
> Alberto Monteiro
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] Effect display of proportional odds model

2007-03-23 Thread Jeff Miller
I REALLY found this paper to be helpful. Will you please let the list know
once you have made the update?


Thank you,

Jeff Miller
University of Florida 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of John Fox
Sent: Friday, March 23, 2007 9:07 AM
To: 'Jan Wijffels'
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Effect display of proportional odds model

Dear Jan,

First, I inadvertently removed material on these displays from my web site
when the paper was published in Sociological Methodology 2006. I'll update
and repost the material some time in the next couple of days, including a
copy of the published paper (with a link on my home page). 

Second, the appendix to the paper and the originally posted examples didn't
include the code for Figure 8 (which is Figure 10 in the published version
of the paper). I'll add that.

Regards,
 John


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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Jan Wijffels
> Sent: Friday, March 23, 2007 7:36 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Effect display of proportional odds model
> 
> Dear useRs,
> I very much like the effect display of the proportional odds model on 
> page 29 (Figure 8) of the following paper by John Fox:
> http://socserv.mcmaster.ca/jfox/Papers/logit-effect-displays.pdf
> It really gives a very concise overview of the model. I would like to 
> use it to illustrate the proportional odds mixed models we fit here 
> for a project on Diabetes but I can't seem to reproduce the plot. Does 
> anyone have code for the plot?
> Maybe John Fox himself? I would appreciate it very much.
> Thanks,
> Jan
>  
> Jan Wijffels
> University Center for Statistics
> W. de Croylaan 54
> 3001 Heverlee
> Belgium
> tel: +32 (0)16 322784
> fax: +32 (0)16 322831
>   http://www.kuleuven.be/ucs
>  
> 
> 
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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

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


Re: [R] Change Axis Size

2007-03-23 Thread John Kane
I think that technically the answer is no.  What you
need to do is set the size of the appropriate axis
with the first plot command ( xlim = or ylim = 

Have a look at ?plot.default
--- [EMAIL PROTECTED] wrote:

> Sorry if this is an obvious question but I have not
> been able to find the
> answer.
> I wish to plot 3 lines on the same plot. However,
> whichever one I plot
> first, the axis does not have a big enough range for
> the other two to be
> shown in the plot (they get cut off at the top and
> the bottom). Is there a
> way to change the range of the y-axis when adding a
> new line to the plot?
> 
> Thank you,
> 
> Alex
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
>

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


Re: [R] Get "home" directory and simple I/O

2007-03-23 Thread jim holtman
On 3/23/07, Alberto Monteiro <[EMAIL PROTECTED]> wrote:
>
> Is there any generic function that gets the "home" directory? This
> should return /home/ in Linux and
> x:/Documents and Settings/ (or whatever) in Windows XP.
>
> Another (unrelated) question: what is the _simplest_ way to
> read and write R variables to/from files such that they are
> stored in a human-readable but R-like form? For example, if
> (say), x is a vector defined as x <- c(1, 2, 3), can I write
> (and read) x as a file with just one line, namely: c(1, 2, 3) ?


?dput

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



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

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

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


Re: [R] Effect display of proportional odds model

2007-03-23 Thread John Fox
Dear Jan,

First, I inadvertently removed material on these displays from my web site
when the paper was published in Sociological Methodology 2006. I'll update
and repost the material some time in the next couple of days, including a
copy of the published paper (with a link on my home page). 

Second, the appendix to the paper and the originally posted examples didn't
include the code for Figure 8 (which is Figure 10 in the published version
of the paper). I'll add that.

Regards,
 John


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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Jan Wijffels
> Sent: Friday, March 23, 2007 7:36 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Effect display of proportional odds model
> 
> Dear useRs,
> I very much like the effect display of the proportional odds 
> model on page 29 (Figure 8) of the following paper by John Fox:
> http://socserv.mcmaster.ca/jfox/Papers/logit-effect-displays.pdf
> It really gives a very concise overview of the model. I would 
> like to use it to illustrate the proportional odds mixed 
> models we fit here for a project on Diabetes but I can't seem 
> to reproduce the plot. Does anyone have code for the plot? 
> Maybe John Fox himself? I would appreciate it very much.
> Thanks,
> Jan
>  
> Jan Wijffels
> University Center for Statistics
> W. de Croylaan 54
> 3001 Heverlee
> Belgium
> tel: +32 (0)16 322784
> fax: +32 (0)16 322831
>   http://www.kuleuven.be/ucs
>  
> 
> 
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Get "home" directory and simple I/O

2007-03-23 Thread Henrik Andersson
Sys.getenv("HOME") works in Linux at least

- Henrik

Andris Jankevics wrote:
> If you want get a username of user currently running R on Linux,you can use a 
> system command and read enviroment variables:
>
> paste("/home/",system ("whoami",intern=TRUE),sep="")
>
>
> Andris Jankevics
>
> On Piektdiena, 23. Marts 2007 14:30, Alberto Monteiro wrote:
>   
>> Is there any generic function that gets the "home" directory? This
>> should return /home/ in Linux and
>> x:/Documents and Settings/ (or whatever) in Windows XP.
>>
>> Another (unrelated) question: what is the _simplest_ way to
>> read and write R variables to/from files such that they are
>> stored in a human-readable but R-like form? For example, if
>> (say), x is a vector defined as x <- c(1, 2, 3), can I write
>> (and read) x as a file with just one line, namely: c(1, 2, 3) ?
>>
>> Alberto Monteiro
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html and provide commented, minimal,
>> self-contained, reproducible code.
>> 
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>   


-- 
Henrik Andersson

Danish Meteorological Institute
Lyngbyvej 100
2100 Copenhagen Ø
Denmark
Tel: +45 39157215 
Email: [EMAIL PROTECTED]

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


Re: [R] Change Axis Size

2007-03-23 Thread Gavin Simpson
On Fri, 2007-03-23 at 12:40 +, [EMAIL PROTECTED] wrote:
> Sorry if this is an obvious question but I have not been able to find the
> answer.
> I wish to plot 3 lines on the same plot. However, whichever one I plot
> first, the axis does not have a big enough range for the other two to be
> shown in the plot (they get cut off at the top and the bottom). Is there a
> way to change the range of the y-axis when adding a new line to the plot?
> 
> Thank you,
> 
> Alex

Use the ylim parameter in plot():

x <- 1:100
y1 <- sort(runif(100))
y2 <- y1 * 1.2
y3 <- y2 * rnorm(100)
plot(x, y1, type = "n", ylim = range(y1, y2, y3))
lines(x, y1, col = "red")
lines(x, y2, col = "blue")
lines(x, y3, col = "green")

An alternative is matplot:

matplot(x, cbind(y1,y2,y3), col = c("red", "blue", "green"), 
type = "l", lty = "solid")

or 

matplot(x, cbind(y1,y2,y3), type = "n")
matlines(x, cbind(y1,y2,y3), col = c("red", "blue", "green"), 
 lty = "solid")

HTH

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

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


Re: [R] distribution graph

2007-03-23 Thread Ted Harding
On 23-Mar-07 11:06:49, Plessen, Christian von wrote:
> 
> I am looking for a way to produce a "distribution graph" as in the
> example: 
> 
> (http://cecsweb.dartmouth.edu/release1.1/datatools/dgraph.php?year=2003&;
> geotype=STD_HRR&event=A01_DIS&eventtype=UTIL
> 
> Anybody who can help?
> 
> Christian von Plessen
> Department of Pulmonary Medicine
> Haukeland university hospital 
> Bergen
> Norway

The following (which anyway needs refinement, and can very
probably be done better) provides a basis (illustrated using
a sample from a log-normal distribution):


X<-exp(rnorm(200,sd=0.25)+2)/5

H<-hist(X,breaks=20)
C<-H$counts
Y<-H$mids
C1<-C/2

C0<-(-C1[1]-1/2):(C[1]-1/2); n0<-length(C0)
plot(C0,rep(Y[1],n0),xlim=c(-max(C)/2,max(C)/2),ylim=c(min(Y),max(Y)))

for(i in (2:length(Y))){
  C0<-(-C1[i]-1/2):(C1[i]-1/2); n0<-length(C0)
  points(C0,rep(Y[i],n0))
}


Hoping this helps!
Ted.


E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 23-Mar-07   Time: 13:04:51
-- XFMail --

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


Re: [R] can't load just saved R object "ReadItem: unknown type 65"

2007-03-23 Thread Luke Tierney
According to the logs nothing at all has changed in the serialization
code in a month and nothing of consequence for much longer than that.
To track this down we will need a complete, reproducible, and
preferably minimal example.

Best,

luke

On Thu, 22 Mar 2007, Mark W Kimpel wrote:

> I have run into a problem loading a just saved R object using R-devel. I
> have been saving and loading this particular type of R object for a long
> while and never ran into this problem. I save, then immediately reload
> (to test save) and get "ReadItem: unnknown type 65".
>
> This error is reproducible after logout from server and restart of emacs
> and R.
>
> Below is my output and sessionInfo().
>
> Thanks,
> Mark
>
> > setwd("~/Genomics/Experiments.Genomic/BB01/acb.shell")
> > local(save(affy.object.preprocessed, file
> ="affy.object.preprocessed.R" ))
> > load("affy.object.preprocessed.R")
> Error in load("affy.object.preprocessed.R") :
>   ReadItem: unknown type 65, perhaps written by later version of R
> > sessionInfo()
> R version 2.5.0 Under development (unstable) (2007-03-11 r40824)
> powerpc64-unknown-linux-gnu
>
> locale:
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] "splines"   "stats" "graphics"  "grDevices" "datasets"  "utils"
> [7] "tools" "methods"   "base"
>
> other attached packages:
>  multtestrat2302cdf affycoretools   annaffyxtable
>  "1.13.1"  "1.15.0"   "1.7.8"   "1.7.3"   "1.4-3"
> gcrma   matchprobes   biomaRt RCurl   XML
>   "2.7.3"   "1.7.4"  "1.9.21"   "0.8-0"   "1.6-0"
>   GOstats  CategoryMatrix   latticegenefilter
>  "2.1.13"  "2.1.20"   "0.9975-11" "0.14-16"  "1.13.8"
>  survival  KEGG  RBGL  annotateGO
>"2.31" "1.15.12"  "1.11.4"  "1.13.6" "1.15.12"
> graph limma  affyaffyio   Biobase
>  "1.13.6"  "2.9.13" "1.13.14"   "1.3.3" "1.13.39"
>

-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
Actuarial Science
241 Schaeffer Hall  email:  [EMAIL PROTECTED]
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu

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


Re: [R] Cohen's Kappa

2007-03-23 Thread Jonathan Baron
See also section 6.4 of
http://www.psych.upenn.edu/~baron/rpsych/rpsych.html

which also points to a few packages that have kappa code in them.
-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron

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


Re: [R] Get "home" directory and simple I/O

2007-03-23 Thread Andris Jankevics
If you want get a username of user currently running R on Linux,you can use a 
system command and read enviroment variables:

paste("/home/",system ("whoami",intern=TRUE),sep="")


Andris Jankevics

On Piektdiena, 23. Marts 2007 14:30, Alberto Monteiro wrote:
> Is there any generic function that gets the "home" directory? This
> should return /home/ in Linux and
> x:/Documents and Settings/ (or whatever) in Windows XP.
>
> Another (unrelated) question: what is the _simplest_ way to
> read and write R variables to/from files such that they are
> stored in a human-readable but R-like form? For example, if
> (say), x is a vector defined as x <- c(1, 2, 3), can I write
> (and read) x as a file with just one line, namely: c(1, 2, 3) ?
>
> Alberto Monteiro
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html and provide commented, minimal,
> self-contained, reproducible code.

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


Re: [R] Change Axis Size

2007-03-23 Thread ONKELINX, Thierry
You need to sed the ylim parameter in the plot function to the range
that you need.

Cheers,

Thierry



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Reseach 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 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

 

> -Oorspronkelijk bericht-
> Van: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] Namens [EMAIL PROTECTED]
> Verzonden: vrijdag 23 maart 2007 13:41
> Aan: r-help@stat.math.ethz.ch
> Onderwerp: [R] Change Axis Size
> 
> Sorry if this is an obvious question but I have not been able 
> to find the answer.
> I wish to plot 3 lines on the same plot. However, whichever 
> one I plot first, the axis does not have a big enough range 
> for the other two to be shown in the plot (they get cut off 
> at the top and the bottom). Is there a way to change the 
> range of the y-axis when adding a new line to the plot?
> 
> Thank you,
> 
> Alex
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] Effect display of proportional odds model

2007-03-23 Thread Ernst Hansen
Gabor Grothendieck writes:
 > Looks like there is code in the appendix.

The appendix even has a URL where the code is available, namely 

  http://socserv.mcmaster.ca/jfox/Papers/polytomous-effect-displays.html



 > On 3/23/07, Jan Wijffels <[EMAIL PROTECTED]> wrote:
 > > Dear useRs,
 > > I very much like the effect display of the proportional odds model on
 > > page 29 (Figure 8) of the following paper by John Fox:
 > > http://socserv.mcmaster.ca/jfox/Papers/logit-effect-displays.pdf


Ernst Hansen
Department of Mathematics
University of Copenhagen

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


Re: [R] Binary information convert into hexadecimal

2007-03-23 Thread Alberto Monteiro
Corinna Schmitt wrote:
> 
> Given is binary information and should be translated into integer and
> afterwards into hexadecimal:
> 
>   0  0
>
If you have a _string_ of 0s and 1s, and you want to convert
it to an integer, I think the best way should be:

(1) convert to a vector of 0s and 1s
(2) convert to integer
(3) an integer to hex conversion is trivial (sprinf("%x", n))

(1): 
  as.integer(unlist(strsplit("0100101", NULL))) 
will do the job: 
strsplit breaks the string, unlist transforms the resulting list
into a vector of (length-one) strings, and as.integer converts
the strings into integers (0 or 1).

(2): 
  x <- c(1, 1, 0, 1, 0)
  n <- sum(x * 2^seq(length(x)-1, 0, -1))

x is the vector of 0s and 1s from (1) above. 
length(x) is its length. 
seq(length(x) - 1, 0, -1) will be the vector of integers
(in this case) 4, 3, 2, 1, 0. 
2^seq(length(x)-1, 0, -1) will be the powers of two 16, 8, 4, 2, 1.
x * 2^... will form the terms of the polynomial
sum will compute 2^(n-1) x[0] + 2^(n-2) x[1] + ... + 2 * x[n-1] + x[n]

Alberto Monteiro

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


Re: [R] distribution graph

2007-03-23 Thread Michael Kubovy
?violinplot (You need to install the UsingR package first.)

On Mar 23, 2007, at 4:06 AM, Plessen, Christian von wrote:

> I am looking for a way to produce a "distribution graph" as in the  
> example:
>
> (http://cecsweb.dartmouth.edu/release1.1/datatools/dgraph.php? 
> year=2003&geotype=STD_HRR&event=A01_DIS&eventtype=UTIL
>
> Anybody who can help?

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


[R] Change Axis Size

2007-03-23 Thread webb
Sorry if this is an obvious question but I have not been able to find the
answer.
I wish to plot 3 lines on the same plot. However, whichever one I plot
first, the axis does not have a big enough range for the other two to be
shown in the plot (they get cut off at the top and the bottom). Is there a
way to change the range of the y-axis when adding a new line to the plot?

Thank you,

Alex

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


[R] Get "home" directory and simple I/O

2007-03-23 Thread Alberto Monteiro
Is there any generic function that gets the "home" directory? This
should return /home/ in Linux and 
x:/Documents and Settings/ (or whatever) in Windows XP.

Another (unrelated) question: what is the _simplest_ way to
read and write R variables to/from files such that they are
stored in a human-readable but R-like form? For example, if 
(say), x is a vector defined as x <- c(1, 2, 3), can I write 
(and read) x as a file with just one line, namely: c(1, 2, 3) ?

Alberto Monteiro

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


[R] dimension reduction and multinomial responses

2007-03-23 Thread Laurent Valdes
Hi,

I'm trying to fit a pls model with a multinomial response.

Do you have some ideas on the right package ?

Laurent

-- 
We are drowning in information, but starved for knowledge.
«Germain» @

[[alternative HTML version deleted]]

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


[R] Binary information convert into hexadecimal

2007-03-23 Thread Schmitt, Corinna

Hallo,

I just started with programming with R. I have the following problem:

Given is binary information and should be translated into integer and
afterwards into hexadecimal:

  0  0
0001  1  1
0010  2  2
0011  3  3
0100  4  4
0101  5  5
0110  6  6
0111  7  7
1000  8  8 
1001  9  9
1010 10  A
1011 11  B
1100 12  C
1101 13  D
1110 14  E
 15  F


I found a similar function for translating an integer vector into
characters and back to integer (z=0:9; digits=as.character(z);
d=as.integer(digits)).
My idea was to make a kind of case-task as I know from RUBY. But there
should exits an easier way.

Can anyone help me?

Corinna

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


Re: [R] Effect display of proportional odds model

2007-03-23 Thread Gabor Grothendieck
Looks like there is code in the appendix.

On 3/23/07, Jan Wijffels <[EMAIL PROTECTED]> wrote:
> Dear useRs,
> I very much like the effect display of the proportional odds model on
> page 29 (Figure 8) of the following paper by John Fox:
> http://socserv.mcmaster.ca/jfox/Papers/logit-effect-displays.pdf
> It really gives a very concise overview of the model. I would like to
> use it to illustrate the proportional odds mixed models we fit here for
> a project on Diabetes but I can't seem to reproduce the plot. Does
> anyone have code for the plot? Maybe John Fox himself? I would
> appreciate it very much.
> Thanks,
> Jan
>
> Jan Wijffels
> University Center for Statistics
> W. de Croylaan 54
> 3001 Heverlee
> Belgium
> tel: +32 (0)16 322784
> fax: +32 (0)16 322831
>   http://www.kuleuven.be/ucs
>
>
>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>
>
>[[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


[R] sort argument in mosaicplot

2007-03-23 Thread Jean lobry
Dear R-help,

I do not understand how to use the "sort" argument in mosaicplot().
 From the documentation sort is a "vector ordering of the variables,
containing a permutation of the integers 1:length(dim(x)) (the default)."

x <- matrix(1:4,2,2)
mosaicplot(x)
# This one is OK
mosaicplot(x, sort = 1:length(dim(x)) )
# Not OK, I have the following error message:
Erreur dans mosaicplot.default(x, sort = 1:length(dim(x))) :
 objet "label" non trouv?

which means that the object "label" was not found in mosaicplot.default().

How can I change the ordering of variables in mosaicplot() ?

Best,

>  sessionInfo()
R version 2.4.1 (2006-12-18)
i386-apple-darwin8.8.1

locale:
C

attached base packages:
[1] "stats" "graphics"  "grDevices" "utils" "datasets"  "methods"
[7] "base"
-- 
Jean R. Lobry([EMAIL PROTECTED])
Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON I,
43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX, FRANCE
allo  : +33 472 43 27 56 fax: +33 472 43 13 88
http://pbil.univ-lyon1.fr/members/lobry/

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


Re: [R] Truncated x-axis values

2007-03-23 Thread John Kane
Also think aboutpar( cex.axis = something small)

Depending on what you're doing you might want to
consider usin horizontal=TRUE  and reduce the plot
size a bit to accomomodate the label lengths.

I don't know the packages well enough to be sure but I
suspect that lattice or ggplot may handle this problem
by allowing an angled label

--- Stephen Tucker <[EMAIL PROTECTED]> wrote:

> You can try playing around with oma, omi, mai, mar,
> etc. in par():
> 
> myMai <- par("mai")
> myMai[1] <- max(nchar(y))*par("cin")[1]
> par(mfrow=c(2, 1),mai=myMai,oma=rep(0,4),las = 2)
> # your plot
> 
> --- "Urban, Alexander" <[EMAIL PROTECTED]> wrote:
> 
> > John
> > Thanks for your reply and sorry for not beein
> specific enough
> > Try this piece of code (it's an abstraction of my
> application...)
> > 
> > par(las = 2)
> > par(mfrow=c(2, 1))
> > x =  c(1,2,3,4,5,6,7,8)
> > y = c("abcdccefghijk", "bcssdefghijkl",
> "abddessfghijk",
> >
>
"bddessfghijkl","abcdssedghijk","bcdedghijkl","assbcdefghidk","bcdedssgh
> > ijkl")
> > 
> > boxplot(x~y)
> > boxplot(x~y) 
> > 
> > In the lower chart the labels are truncated...(not
> totally visible)
> > Is this clearer now?
> > 
> > Thanks
> > Alex
> > 
> > -Original Message-
> > From: John Kane [mailto:[EMAIL PROTECTED] 
> > Sent: Thursday, March 22, 2007 19:19
> > To: Urban, Alexander; r-help@stat.math.ethz.ch
> > Subject: Re: [R] Truncated x-axis values
> > 
> > You really have not told us much about what you're
> actually doing.  A
> > simple self-contained example of what you're
> trying to do might let
> > someone help. 
> > 
> > Have you read the posting guide?
> > 
> > --- "Urban, Alexander" <[EMAIL PROTECTED]> wrote:
> > 
> > > Hello
> > > 
> > > I'm new to this group. I looked up the last two
> hour in the help file 
> > > and in the archives of this group, but didn't
> find anything.
> > > I hope my question is not too dump:
> > > I'm printing a graph with vertical labels on the
> x-axis (necessary due
> > 
> > > to many labels). Unfortunately the png truncates
> the labels halfway 
> > > through, so that you can only read the last 7
> digits of the label.
> > > Snice I'm already asking :-): Is there a
> possibility to tell R: If 
> > > there are so many labels that you write them on
> top of each other, 
> > > take only e.g. every 2nd...
> > > 
> > > Sorry for bothering and thanks
> > > Alex
> > > 
> > > __
> > > R-help@stat.math.ethz.ch mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide
> > > http://www.R-project.org/posting-guide.html
> > > and provide commented, minimal, self-contained,
> reproducible code.
> > > 
> > 
> > 
> > __
> > Do You Yahoo!?

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

> Looking for earth-friendly autos? 
> Browse Top Cars by "Green Rating" at Yahoo! Autos'
> Green Center.
> http://autos.yahoo.com/green_center/
>

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


Re: [R] Creating new directory/folder from R script on run time.

2007-03-23 Thread Henrique Dallazuanna
Perhaps you can try:

?dir.create

dir.create('C:\tt')

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

On 23/03/07, d. sarthi maheshwari <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Please correct me if this request does not belong to this discussion
> forum.
>
> Kindly suggest me if there is a way to create a new folder from R on
> runtime?
>
> for e.g.
> >From one of my R script I want to store the PDF result file in a
> perticular
> folder let say c:\tt
>
> for that initially i am creating "tt" folder manually and using the
> following command:
>
> fname <- paste("C:/tt/result", strptime(Sys.time(),"%Y-%m-%d"),
> ".pdf", sep="")
> pdf(file = fname,width = 13, height = 6)
> ---
> ---
> blah
> blah
> ---
> ---
> dev.off()
>
> Can I, in any manner, create the "tt" folder from R script itself on
> runtime?
>
> --
> Thanks and Regards
> Sarthi M.
>
> [[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


[R] Creating new directory/folder from R script on run time.

2007-03-23 Thread d. sarthi maheshwari
Hi,

Please correct me if this request does not belong to this discussion forum.

Kindly suggest me if there is a way to create a new folder from R on
runtime?

for e.g.
>From one of my R script I want to store the PDF result file in a perticular
folder let say c:\tt

for that initially i am creating "tt" folder manually and using the
following command:

fname <- paste("C:/tt/result", strptime(Sys.time(),"%Y-%m-%d"),
".pdf", sep="")
pdf(file = fname,width = 13, height = 6)
---
---
blah
blah
---
---
dev.off()

Can I, in any manner, create the "tt" folder from R script itself on
runtime?

-- 
Thanks and Regards
Sarthi M.

[[alternative HTML version deleted]]

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


Re: [R] Cohen's Kappa

2007-03-23 Thread Christian Schulz
...many thanks  for all the answers  and clarity!!!
regards, christian

> Hi,
>
> Chance is not .5 in your data, it's a function of the expected values 
> for presence and absence:
>
>   
>> (((7792*10855)/11974) + ((4182*1119)/11974))/11974
>> 
> [1] 0.6225686
>
>   
>> (.6862368-.6225686)/(1-.6225686)
>> 
> [1] 0.1686881
>
> Scot
>
>
> On Thu, 22 Mar 2007, Christian Schulz wrote:
>
>   
>> Hi,
>>
>> im little bit confused about Cohen's Kappa and i should  be look into the
>> Kappa function code. Is the easy formula really wrong?
>>
>> kappa=agreement-chance/(1-chance)
>>
>> many thanks
>> christian
>>
>> ###
>> true-negativ:7445
>> false-positive:3410
>> false-negativ:347
>> true-positiv:772
>>
>> classification-aggrement:68,6%
>> kappa=agreement-chance/(1-chance) = (0.686-0.5)/0.5=0.372
>>
>> .with function from library(vcd)
>> Kappa(matrix(c(7445,3410,347,772),nrow=2))
>>   value ASE
>> Unweighted 0.1686882 0.011235188
>> Weighted   0.1686882 0.007979293
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>> 
>
>
> --
>Scot W. McNary  email: smcnaryatcharmdotnet
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

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


[R] distribution graph

2007-03-23 Thread Plessen, Christian von

I am looking for a way to produce a "distribution graph" as in the example: 

(http://cecsweb.dartmouth.edu/release1.1/datatools/dgraph.php?year=2003&geotype=STD_HRR&event=A01_DIS&eventtype=UTIL

Anybody who can help?

Christian von Plessen
Department of Pulmonary Medicine
Haukeland university hospital 
Bergen
Norway

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


[R] Effect display of proportional odds model

2007-03-23 Thread Jan Wijffels
Dear useRs,
I very much like the effect display of the proportional odds model on
page 29 (Figure 8) of the following paper by John Fox:
http://socserv.mcmaster.ca/jfox/Papers/logit-effect-displays.pdf 
It really gives a very concise overview of the model. I would like to
use it to illustrate the proportional odds mixed models we fit here for
a project on Diabetes but I can't seem to reproduce the plot. Does
anyone have code for the plot? Maybe John Fox himself? I would
appreciate it very much.
Thanks,
Jan
 
Jan Wijffels
University Center for Statistics 
W. de Croylaan 54
3001 Heverlee
Belgium
tel: +32 (0)16 322784
fax: +32 (0)16 322831
  http://www.kuleuven.be/ucs
 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm


[[alternative HTML version deleted]]

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


Re: [R] concatenate 2 data.frames

2007-03-23 Thread John Kane
?rbind
 rbind(df1, df2)

This is a very basic question.  You probably would
save a lot of time if you read some of the
documentation on the CRAN site (not the home R page). 
Click on "Contributed"  on the left side of the screen
and have a look at some of the documentation there. 
There are some excellent materials there.  

I'd recommend perhaps looking at “Simple R” by John
Verzani and “A Guide for the Unwilling S User”  by
Patrick Burns.  R and S are basically equivalent for
this purpose.

Good luck and don't forget to read the posting guide.

--- João Fadista <[EMAIL PROTECTED]> wrote:

> Dear all,
>  
> I would like to know how can I concatenate 2
> data.frames into a single one. Both data frames have
> the same number of columns and the same class type
> in each correspondent column. So what I want is to
> have a new data.frame where I have first the values
> from one data.frame and then the values from a
> second data.frame would came after in this new
> data.frame.
>  
> Thanks in advance.
>  
> 
> Med venlig hilsen / Regards
> 
> João Fadista
> Ph.d. studerende / Ph.d. student
> 
> 
>   
>AARHUS UNIVERSITET / UNIVERSITY OF AARHUS  
> Det Jordbrugsvidenskabelige Fakultet / Faculty of
> Agricultural Sciences 
> Forskningscenter Foulum / Research Centre Foulum  
> Genetik og Bioteknologi / Dept. of Genetics and
> Biotechnology 
> Blichers Allé 20, P.O. BOX 50 
> DK-8830 Tjele 
>   
> Tel:   +45 8999 1900  
> Direct:+45 8999 1900  
> Mobile:+45
> E-mail:[EMAIL PROTECTED]
> 
> Web:   www.agrsci.dk   
> 
> 
> Tilmeld dig DJF's nyhedsbrev / Subscribe Faculty of
> Agricultural Sciences Newsletter
>  . 
> 
> Denne email kan indeholde fortrolig information.
> Enhver brug eller offentliggørelse af denne email
> uden skriftlig tilladelse fra DJF er ikke tilladt.
> Hvis De ikke er den tiltænkte adressat, bedes De
> venligst straks underrette DJF samt slette emailen.
> 
> This email may contain information that is
> confidential. Any use or publication of this email
> without written permission from Faculty of
> Agricultural Sciences is not allowed. If you are not
> the intended recipient, please notify Faculty of
> Agricultural Sciences immediately and delete this
> email.
> 
>  
> 
>   [[alternative HTML version deleted]]
> 
> > __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
>

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


Re: [R] Fitting a line to a qqplot's points?

2007-03-23 Thread ian white
See also ?shapiro.test which is effectively based on this correlation
coefficient.


On Fri, 2007-03-23 at 00:13 -0400, Paul Lynch wrote:
> I've made some normal plots of my data using qqplot, and now
> I would like to fit a line to the points on the plot and
> check the correlation coefficient to have a more objective measure
> of how straight the line is.  Is there a simple way of doing that?
> (I'm still pretty new to R.)
> 
> Thanks,
>--Paul
> 


School of Biological Sciences, University of Edinburgh

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


Re: [R] Updating a worksheet in Excel file using RODBC

2007-03-23 Thread Prof Brian Ripley
On Fri, 23 Mar 2007, Prof Brian Ripley wrote:

> The problem is that way the ODBC driver exposes table names is not valid
> SQL, and nor is the way quoting has to be used.  You can get around this
> via direct SQL sent by sqlQuery.  In addition, by default the Excel ODBC
> driver gives you read-only access to worksheets.
>
> Searching the list archives, would help, for example this answer:
>
> https://stat.ethz.ch/pipermail/r-help/2007-March/127851.html
>
> Making a wrapper interface in RODBC is on my TODO list, but not anywhere
> near the top.

You seem not to have tried the simplest possible option.  The following 
works for me (beware of wrapped lines from mailers)

chan <- odbcDriverConnect("DRIVER=Microsoft Excel Driver 
(*.xls);DBQ=C:\\bdr\\hills.xls; ReadOnly=False")
sqlSave(chan, USArrests, "tests", fast=TRUE) # or FALSE

In your example you have a different problem: your field names are invalid 
in SQL (and as R data frame names).


> On Fri, 23 Mar 2007, Moshe Olshansky wrote:
>
>> Hello!
>>
>> I have no problem reading Excel files (each worksheet in the file is a 
>> "table" which can be read - at least in my case).
>>
>> What I would like to do is to read such a table, change it (just the 
>> contents, not the format) and write it back, and this I can not do.  I 
>> am getting the following error messages (3 slightly different 
>> attempts):
>>
>>> sqlSave(con, x, tablename = "Chimaera20_3years$", append = FALSE,
>> + rownames = FALSE, colnames = TRUE,
>> + verbose = TRUE, oldstyle = FALSE,safer=FALSE)
>> Query: CREATE TABLE Chimaera20_3years$  (Date varchar(255), 000Tax 
>> varchar(255), 1500Tax varchar(255), 3000Tax varchar(255), 4650Tax 
>> varchar(255))
>> Error in sqlSave(con, x, tablename = "Chimaera20_3years$", append = FALSE,  :
>>[RODBC] ERROR: Could not SQLExecDirect
>> 37000 -3551 [Microsoft][ODBC Excel Driver] Syntax error in CREATE TABLE 
>> statement.
>>
>>> sqlSave(con, x, tablename = "[Chimaera20_3years$]", append = FALSE,
>> + rownames = FALSE, colnames = TRUE,
>> + verbose = TRUE, oldstyle = FALSE,safer=FALSE)
>> Query: CREATE TABLE [Chimaera20_3years$]  (Date varchar(255), 000Tax 
>> varchar(255), 1500Tax varchar(255), 3000Tax varchar(255), 4650Tax 
>> varchar(255))
>> Error in sqlSave(con, x, tablename = "[Chimaera20_3years$]", append = FALSE, 
>>  :
>>[RODBC] ERROR: Could not SQLExecDirect
>> 37000 -3553 [Microsoft][ODBC Excel Driver] Syntax error in field definition.
>>
>>> sqlSave(con, x, tablename = "[Chimaera20_3years]", append = FALSE,
>> + rownames = FALSE, colnames = TRUE,
>> + verbose = TRUE, oldstyle = FALSE,safer=FALSE)
>> Query: CREATE TABLE [Chimaera20_3years]  (Date varchar(255), 000Tax 
>> varchar(255), 1500Tax varchar(255), 3000Tax varchar(255), 4650Tax 
>> varchar(255))
>> Error in sqlSave(con, x, tablename = "[Chimaera20_3years]", append = FALSE,  
>> :
>>[RODBC] ERROR: Could not SQLExecDirect
>> 37000 -3553 [Microsoft][ODBC Excel Driver] Syntax error in field definition.
>>
>> Am I doing it wrong way or is there a problem with the Excel driver?
>>
>> Thank you in advance,
>>
>> Moshe Olshansky
>> Chimaera Capital Group
>>
>>
>> Moshe Olshansky
>>
>> Chimaera Capital Limited
>> Level 4 / 349 Collins Street
>> Melbourne, Victoria 3000
>> Phone: +613 8614 8400
>> Fax: +613 8614 8410
>> Email: [EMAIL PROTECTED]
>>
>> Disclaimer: This message is intended only for the personal and confidential 
>> use of the designated recipient(s) named above. If you are not the intended 
>> recipient of this message you are hereby notified that any review, 
>> dissemination, distribution or copying of this message is strictly 
>> prohibited. This communication is for information purposes only and should 
>> not be regarded as an offer to sell or as a solicitation of an offer to buy 
>> any financial product, an official confirmation of any transaction, or as an 
>> official statement of Chimaera Capital Limited. E-mail transmissions cannot 
>> be guaranteed to be secure or error-free. Therefore, we do not represent 
>> that this information is complete or accurate and it should not be relied 
>> upon as such. All information is subject to change without notice.
>>
>>
>>
>>  [[alternative HTML version deleted]]
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> 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@stat.math.ethz.ch mailing list
https://stat.e

[R] Translating actxserver server commands to rcom

2007-03-23 Thread W Eryk Wolski
Dear R and R com user

I have the following matlab which acesses a com server, code which I
am trying to translate to R using the Rcom package:


clear all;
clear analysis;
analysis = actxserver('EDAL.MSAnalysis');
analysis.Open('E:\work\ChromPeakFinderdata\DatafromKlaus\E112L-cad13-PI-24h_pos_1-C,3_01_2562.d');
specCol = analysis.MSSpectrumCollection;
count = specCol.get('Count');


This is how far I got...

rm(analysis)
analysis <- comCreateObject("EDAL.MSAnalysis")
comGetObjectInfo(analysis)
comInvoke(analysis,"open","E:\work\ChromPeakFinderdata\DatafromKlaus\E112L-cad13-PI-24h_pos_1-C,3_01_2562.d")
specCol <- analysis$"MSSpectrumCollection"
> specCol
function (...)
comInvoke(handle, ..FUN, ...)

> comInvoke(specCol,"get","Count")
NULL


Seems to be the wrong track ... What would be the equivalent of
analysis.Open('E:\work\ChromPeakFinderdata\DatafromKlaus\E112L-cad13-PI-24h_pos_1-C,3_01_2562.d');
specCol = analysis.MSSpectrumCollection;
or  of count = specCol.get('Count');
in Rcom?


Help is highly appreciated...

best wishes

Eryk

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


Re: [R] concatenate 2 data.frames

2007-03-23 Thread Gavin Simpson
On Fri, 2007-03-23 at 08:51 +0100, João Fadista wrote:
> Dear all,
>  
> I would like to know how can I concatenate 2 data.frames into a single
> one. Both data frames have the same number of columns and the same
> class type in each correspondent column. So what I want is to have a
> new data.frame where I have first the values from one data.frame and
> then the values from a second data.frame would came after in this new
> data.frame.
>  
> Thanks in advance.

By "after", do you mean columns for dataframe1 then columns of
dataframe2, or do you mean you want to append dataframe2 onto the bottom
of dataframe1?

The first is:
dat1 <- data.frame(var1 = rnorm(10), var2 = rnorm(10), 
   var3 = gl(2, 5, labels = c("red", "blue")))
dat2 <- data.frame(var4 = rnorm(10), var5 = rnorm(10), 
   var6 = gl(2, 5, labels = c("red", "blue")))
combined <- data.frame(dat1, dat2)
combined
  var1var2 var3var4var5 var6
1  -1.61397560 -0.40296928  red  1.48380888  1.35501273  red
2   1.01901681 -0.27616320  red -1.00234243 -0.79328309  red
3  -0.88272375 -0.42375566  red -1.31503261 -0.04570735  red
4   1.37368014 -0.63154987  red -1.40635604  1.50906371  red
5   0.66810230 -0.43453383  red  0.30449564 -0.24893343  red
6  -0.06403118 -1.59095216 blue  0.41945472  0.09143192 blue
7   0.02208197  1.70299530 blue -1.64188953 -0.30545702 blue
8  -1.13057000 -0.67610437 blue -1.15801044  1.17682587 blue
9  -2.32315433 -0.07500192 blue  0.03576081 -1.14670543 blue
10 -0.64734307  0.74789423 blue -0.57466841 -1.69753353 blue

You could also use cbind().

The second could be:
## need to  provide the same variables names for matching columns
names(dat2) <- c("var1", "var2", "var3")
rbind(dat1, dat2)

  var1var2 var3
1  -1.61397560 -0.40296928  red
2   1.01901681 -0.27616320  red
3  -0.88272375 -0.42375566  red
4   1.37368014 -0.63154987  red
5   0.66810230 -0.43453383  red
6  -0.06403118 -1.59095216 blue
7   0.02208197  1.70299530 blue
8  -1.13057000 -0.67610437 blue
9  -2.32315433 -0.07500192 blue
10 -0.64734307  0.74789423 blue
11  1.48380888  1.35501273  red
12 -1.00234243 -0.79328309  red
13 -1.31503261 -0.04570735  red
14 -1.40635604  1.50906371  red
15  0.30449564 -0.24893343  red
16  0.41945472  0.09143192 blue
17 -1.64188953 -0.30545702 blue
18 -1.15801044  1.17682587 blue
19  0.03576081 -1.14670543 blue
20 -0.57466841 -1.69753353 blue

HTH

G

>  
> 
> Med venlig hilsen / Regards
> 
> Joo Fadista
> Ph.d. studerende / Ph.d. student
> 
> 
>   
>AARHUS UNIVERSITET / UNIVERSITY OF AARHUS  
> Det Jordbrugsvidenskabelige Fakultet / Faculty of Agricultural Sciences   
> Forskningscenter Foulum / Research Centre Foulum  
> Genetik og Bioteknologi / Dept. of Genetics and Biotechnology 
> Blichers All 20, P.O. BOX 50  
> DK-8830 Tjele 
>   
> Tel:   +45 8999 1900  
> Direct:+45 8999 1900  
> Mobile:+45
> E-mail:[EMAIL PROTECTED]    
> Web:   www.agrsci.dk   
> 
> 
> Tilmeld dig DJF's nyhedsbrev / Subscribe Faculty of Agricultural Sciences 
> Newsletter  . 
> 
> Denne email kan indeholde fortrolig information. Enhver brug eller 
> offentliggrelse af denne email uden skriftlig tilladelse fra DJF er ikke 
> tilladt. Hvis De ikke er den tiltnkte adressat, bedes De venligst straks 
> underrette DJF samt slette emailen.
> 
> This email may contain information that is confidential. Any use or 
> publication of this email without written permission from Faculty of 
> Agricultural Sciences is not allowed. If you are not the intended recipient, 
> please notify Faculty of Agricultural Sciences immediately and delete this 
> email.
> 
>  
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [t] +44 (0)20 7679 0522
ECRC  [f] +44 (0)20 7679 0565
UCL Department of Geography
Pearson Building  [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street
London, UK[w] http://www.ucl.ac.uk/~ucfagls/
WC1E 6BT  [w] http://www.freshwaters.org.uk/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [R] non-linear curve fitting

2007-03-23 Thread Hufkens Koen
I'll give you the equation of the reference I based my thinking upon.

this the link:  http://users.pandora.be/requested/images/equation.png

It's a sigmoid error function, but I thought I simplified things by picking a 
less complex form, although I think It won't matter that much.

Anyway, as Ted suggested, this equation has the terms reparameterised into the 
form -(bx+c) as well. In my reference they probably tested for the b=0 scenario 
because they had an F-statistic. But to be honest I wouldn't know how to start 
implementing this? It seems a little more complicated then the ordinary stuff I 
normally do.

Koen


> -Original Message-
> From: ecatchpole [mailto:[EMAIL PROTECTED] 
> Sent: donderdag 22 maart 2007 23:25
> To: Douglas Bates
> Cc: Hufkens Koen; r-help@stat.math.ethz.ch; Philippe Grosjean
> Subject: Re: [R] non-linear curve fitting
> 
> Douglas Bates wrote on 03/23/2007 06:16 AM:
> > On 3/22/07, Hufkens Koen <[EMAIL PROTECTED]> wrote:
> >   
> >> Is there a means of getting an F-statistic (p-value) out 
> of all of this.
> >> 
> >
> >   
> >> Because least-square criterion / r-square only tell me how 
> good the fit is and not necessarily how solid this fit is. An 
> F-statistic (p-value) would be nice...
> >> 
> >
> > What would the F-statistic be?  For a linear model with an 
> intercept 
> > the F-statistic represents a comparison of the model that 
> you have fit 
> > to the trivial model (intercept only).  It is important that the 
> > models being compared are nested - otherwise the F statistic is of 
> > questionable validity.
> >
> > For the logistic growth model you described (which is not quite the 
> > one fit by SSlogis - that model has one more parameter, a 
> scale factor 
> > on the response) the response always goes to zero as x -> 
> -\Infty and 
> > to one as x -> \Infty.  The trivial model is not nested within this 
> > model for finite parameter values so I'm not sure what hypotheses 
> > would be tested by an F-statistic.
> >   
> 
> If the original curve is reparameterised as f(x) = 
> 1/(1+exp(-(a+b*x))), then you can test whether b=0.  Is this any help?
> 
> Ted.
> >   
> >> Regards,
> >> Koen
> >>
> >>
> >> 
> >>> -Original Message-
> >>> From: Philippe Grosjean [mailto:[EMAIL PROTECTED]
> >>> Sent: donderdag 22 maart 2007 14:02
> >>> To: Hufkens Koen; r-help@stat.math.ethz.ch
> >>> Subject: Re: [R] non-linear curve fitting
> >>>
> >>> Hello,
> >>>
> >>> If a least-square criterion is fine for you, you should 
> use nls(). 
> >>> For the logistic curve, you have a convenient self-starting model 
> >>> available:
> >>> SSlogis(). Look at:
> >>>
> >>> ?nls
> >>> ?SSlogis
> >>>
> >>> Best,
> >>>
> >>> Philippe Grosjean
> >>>
> >>> ..<°}))><
> >>>   ) ) ) ) )
> >>> ( ( ( ( (Prof. Philippe Grosjean
> >>>   ) ) ) ) )
> >>> ( ( ( ( (Numerical Ecology of Aquatic Systems
> >>>   ) ) ) ) )   Mons-Hainaut University, Belgium
> >>> ( ( ( ( (
> >>> ..
> >>>
> >>> Hufkens Koen wrote:
> >>>   
>  Hi list,
> 
>  I have a little curve fitting problem.
> 
>  I would like to fit a sigmoid curve to my data using the
>  
> >>> following equation:
> >>>   
>  f(x) = 1/(1 + exp(-(x-c)*b)) (or any other form for that matter)
> 
>  Where x is the distance/location within the dataframe, c is
>  
> >>> the shift of the curve across the dataframe and b is the 
> steepness 
> >>> of the curve.
> >>>   
>  I've been playing with glm() and glm.fit() but without any luck.
> 
>  for example the most simple example
> 
>  x = -10:10
>  y = 1/(1 + exp(-x))
>  glm(y ~ x, family=binomial(link="logit"))
> 
>  I get a warning:
>  non-integer #successes in a binomial glm! in: eval(expr, envir,
>  enclos)
> 
>  and some erratic results
> 
>  This is the most simple test to see if I could fit a curve
>  
> >>> to this perfect data so since this didn't work out, 
> bringing in the 
> >>> extra parameters is a whole other ballgame so could 
> someone give me 
> >>> a clue?
> >>>   
>  Kind regards,
>  Koen
> 
> 
>  
> >
> 
> 
> --
>  Dr E.A. Catchpole
>  Visiting Fellow
>  Univ of New South Wales at ADFA, Canberra, Australia
> _   and University of Kent, Canterbury, England
>'v'  - www.pems.adfa.edu.au/~ecatchpole  
>   /   \ - fax: +61 2 6268 8786   
>m m- ph:  +61 2 6268 8895 
> 
> 
> 
> 
> 
> 
> 
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.16/729 - Release 
> Date: 21/03/2007 7:52
>  
> 

--

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting g

Re: [R] landscape pdf

2007-03-23 Thread Prof Brian Ripley
PDF does not have orientation: just set the width > height in pdf() to get 
a 'landscape' plot.

The 'horizontal' option in postscript() was originally (in S/S-PLUS) 
designed for sending plots direct to a printer: pdf() does not have that 
option either.

On Fri, 23 Mar 2007, Sebastian Weber wrote:

> How can I plot a landscape letter-format plot? With postscript, I just
> use the horizontal option and I get what I want, but it seems that the
> pdf lacks this option. Well, I could do a ps2pdf conversion of the
> generated ps-file. But is there a way to directly produce landscape
> pdf-plots with R?


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

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


  1   2   >