[R] Odp: Creating a data.frame

2008-02-17 Thread Petr PIKAL
Hi

[EMAIL PROTECTED] napsal dne 13.02.2008 23:17:32:

> OK...newbie question here.
> Either I'm reading the docs wrong, or I'm totally confused.
> 
> Given the following:
> 
> x<-c("aaa","bbb","ccc")
> y<-rep(0,3)
> z<-rep(0,3)
> 
> is.character(x)
> [1] TRUE
> 
> is.numeric(y)
> [1] TRUE
> 
> Now...I want to create a data frame, but keep the data types.
> In reading the docs, I assume you do it this way:
> 
> d<-data.frame(cbind(x=I(x),y=y,z=z)

cbind creates a matrix which has to have all values the same type, in your 
case character.

d<-data.frame(x=x,y=y,z=z)

will do what you want. Try to find out differences among various types of 
objects, its pros and cons from some intro documents.

Regards

Petr

> 
> But, when I do str(d), I get the following:
> 
> 'data.frame':   3 obs. of  3 variables:
>   $ x: Factor w/ 3 levels "aaa","bbb","ccc": 1 2 3
>   $ y: Factor w/ 1 level "0": 1 1 1
>   $ z: Factor w/ 1 level "0": 1 1 1
> 
> I thought the I() prevents character from becoming factors, right?
> Secondly, how do I force y and z in the data frame to become numeric?
> 
> Thanks in advance
> Joe
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


[R] fitted.values from zeroinfl (pscl package)

2008-02-17 Thread Sarah J Thomas
Hello all:

I have a question regarding the fitted.values returned from the 
zeroinfl() function. The values seem to be nearly identical to those 
fitted.values returned by the ordinary glm(). Why is this, shouldn't 
they be more "zero-inflated"?

I construct a zero-inflated series of counts, called Y, like so:

b= as.vector(c(1.5, -2))
g= as.vector(c(-3, 1))
x <- runif(100) # x is the covariate
X <- cbind(1,x)

p <- exp(X%*%g)/(1+exp(X%*%g))
m <- exp(X%*%b)   # log-link for the mean process
  # of the Poisson
Y <- rep(0, 100)

u <- runif(100)
for(i in 1:100) {
if( u[i] < p[i] ) { Y[i] = 0 }
else { Y[i] <- rpois(1, m[i]) }
}

# now let's compare the fitted.values from zeroinfl()
# and from glm()

z1 <- glm(Y ~ x, family=poisson)
z2 <- zeroinfl(Y ~ x|x) #poisson is the default

z1$fitted.values[1:20]
#1.3254209 0.7458029 2.0300505 1.1292954 1.4512862 #0.6513798 1.8980126 
0.6558228 1.5302057
#0.6993626 2.6875736 0.7586985 2.0622238 2.1009979 #1.4254607 1.8130159 
3.6603137 2.1330030
#2.9409379 3.3203350

z2$fitted.values[1:20]
#1.3587457 0.7254296 2.0730982 1.1497492 1.4902778 #0.6178648 1.9429778 
0.6229478 1.5717923
#0.6726527 2.7010395 0.7400369 2.1045779 2.1424025 #1.4634459 1.8583877 
3.5830697 2.1735319
#2.9354839 3.2800839


You can see that they are almost identical... and the fitted.values from 
zeroinfl don't seem to be zero-inflated at all! What is going on?

Ultimately I want these fitted.values for a goodness of fit type of test 
to see if the zeroinfl model is needed or not for a given data series. 
With these fitted.values as they are, I am rejecting assumption of a 
zero-inflated model even when the data really are zero-inflated.

many thanks,
Sarah Thomas

-- 
Sarah J. Thomas
Research Assistant, Department of Statistics
Rice University, Houston, TX

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 make a vector/list/array of POSIXlt object?

2008-02-17 Thread Gabor Grothendieck
If the problem is that you have a vector of dates, a vector of times
and a vector of data and you want to create a data frame with one
POSIXct column and one column of data then try this:

dd <- c("01/22/2008", "02/13/2008")
tt <- c("01:01:00", "23:01:12")
dat <- 1:2

data.frame(dt = strptime(paste(dd, tt), "%m/%d/%Y %H:%M:%S"), dat)

# if you don't need subsecond data or time zones you could use chron

library(chron)
data.frame(dt = chron(dd, tt), dat)

If this is intended to be a time series you might want to look at the zoo
package.  It has three vignettes that give more info.


On Feb 17, 2008 11:54 PM, Bo Zhou <[EMAIL PROTECTED]> wrote:
> Hi Gabor,
>
> I'm using this code but it doesn't work for me
>
> > strptime2<-function (date,time) as.POSIXct(strptime(paste(date,time),
> "%m/%d/%Y %H:%M:%S"))
> > dt=mapply(strptime2, "01/01/2008", "00:00:00", SIMPLIFY=FALSE,
> USE.NAMES=FALSE)
> > df=data.frame(X1=dt,X2=1)
> > dt
> [[1]]
> [1] "2008-01-01 Eastern Standard Time"
>
> > df
>   structure.1199163600..class...c..POSIXtPOSIXcttzone.. X2
> 12008-01-01  1
>
> Here df looks very wrong to me.
>
> So I tested this code:
>
> > df2=data.frame(X1=as.POSIXct(Sys.time()),X2=1)
> > df2
>X1 X2
> 1 2008-02-17 23:43:08  1
> > class(df2$X1)
> [1] "POSIXt"  "POSIXct"
>
> Ah this worked as I expected.
>
> So some tweaking here - SIMPLIFY is set TRUE now:
>
> > strptime2<-function (date,time) as.POSIXct(strptime(paste(date,time),
> "%m/%d/%Y %H:%M:%S"))
> > dt=mapply(strptime2, "01/01/2008", "00:00:00", SIMPLIFY=TRUE,
> USE.NAMES=FALSE)
> > df=data.frame(X1=dt,X2=1)
> > df
>   X1 X2
> 1 1199163600  1
> > class(df$X1)
> [1] "numeric"
>
> Hmm... it worked, but not in a way I wanted. The class info is missing.
>
> So how to get the result like this below? I do need that mapply +
> strptime(paste), cos my CSV file is formatted in that way!
>
> > df2
>X1 X2
> 1 2008-02-17 23:43:08  1
> > class(df2$X1)
> [1] "POSIXt"  "POSIXct"
>
>
> Any insight?
>
> Cheers,
>
> Bo
>
>
>
> > Date: Sun, 17 Feb 2008 15:53:28 -0500
> > From: [EMAIL PROTECTED]
> > To: [EMAIL PROTECTED]
> > Subject: Re: [R] How to make a vector/list/array of POSIXlt object?
> > CC: r-help@r-project.org
>
>
> >
> > Normally one uses POSIXct rather than POSIXlt for storage. See R News 4/1
> for
> > more info on date and time classes.
> >
> > On Feb 17, 2008 3:45 PM, Bo Zhou <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi Guys,
> > >
> > > I'm cooking up my time series code. I want a data frame with first
> column as timestamp in POSIXlt format.
> > >
> > > I hit on this the problem of how to create an array/list/vector of
> POSIXlt objects. Code is as follows
> > >
> > >
> > >
> > > > dtt=array(dim = 2)
> > > > t=as.POSIXlt( strptime("07/12/07 13:20:01", "%m/%d/%Y
> %H:%M:%S",tz="GMT"))
> > > > dtt
> > > [1] NA NA
> > > > t
> > > [1] "0007-07-12 13:20:01 GMT"
> > > > dtt[1]=t
> > > Warning message:
> > > In dtt[1] = t :
> > > number of items to replace is not a multiple of replacement length
> > > > class(dtt)
> > > [1] "list"
> > > > class(t)
> > > [1] "POSIXt" "POSIXlt"
> > > > unclass(t)
> > > $sec
> > > [1] 1
> > >
> > > $min
> > > [1] 20
> > >
> > > $hour
> > > [1] 13
> > >
> > > $mday
> > > [1] 12
> > >
> > > $mon
> > > [1] 6
> > >
> > > $year
> > > [1] -1893
> > >
> > > $wday
> > > [1] 4
> > >
> > > $yday
> > > [1] 192
> > >
> > > $isdst
> > > [1] 0
> > >
> > > attr(,"tzone")
> > > [1] "GMT"
> > >
> > >
> > >
> > > Seems like POSIXlt is matrix in this case.
> > >
> > > Any suggestions?
> > >
> > > Cheers,
> > >
> > > B
> > > _
> > > [[elided Hotmail spam]]
> > >
> > > [[alternative HTML version deleted]]
> > >
> > > __
> > > R-help@r-project.org mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.
> > >
>
> 
> Need to know the score, the latest news, or you need your Hotmail(R)-get your
> "fix". Check it out.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 make a vector/list/array of POSIXlt object?

2008-02-17 Thread Bo Zhou

Hi Gabor,

I'm using this code but it doesn't work for me

> strptime2<-function (date,time) as.POSIXct(strptime(paste(date,time), 
> "%m/%d/%Y %H:%M:%S"))
> dt=mapply(strptime2, "01/01/2008", "00:00:00", SIMPLIFY=FALSE, 
> USE.NAMES=FALSE)
> df=data.frame(X1=dt,X2=1)
> dt
[[1]]
[1] "2008-01-01 Eastern Standard Time"

> df
  structure.1199163600..class...c..POSIXtPOSIXcttzone.. X2
12008-01-01  1

Here df looks very wrong to me.

So I tested this code:

> df2=data.frame(X1=as.POSIXct(Sys.time()),X2=1)
> df2
   X1 X2
1 2008-02-17 23:43:08  1
> class(df2$X1)
[1] "POSIXt"  "POSIXct"

Ah this worked as I expected.

So some tweaking here - SIMPLIFY is set TRUE now:

> strptime2<-function (date,time) as.POSIXct(strptime(paste(date,time), 
> "%m/%d/%Y %H:%M:%S"))
> dt=mapply(strptime2, "01/01/2008", "00:00:00", SIMPLIFY=TRUE, USE.NAMES=FALSE)
> df=data.frame(X1=dt,X2=1)
> df
  X1 X2
1 1199163600  1
> class(df$X1)
[1] "numeric"

Hmm... it worked, but not in a way I wanted. The class info is missing.

So how to get the result like this below? I do need that mapply + 
strptime(paste), cos my CSV file is formatted in that way!

> df2

   X1 X2

1 2008-02-17 23:43:08  1

> class(df2$X1)

[1] "POSIXt"  "POSIXct"


Any insight?

Cheers,

Bo



> Date: Sun, 17 Feb 2008 15:53:28 -0500
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: Re: [R] How to make a vector/list/array of POSIXlt object?
> CC: r-help@r-project.org
> 
> Normally one uses POSIXct rather than POSIXlt for storage.  See R News 4/1 for
> more info on date and time classes.
> 
> On Feb 17, 2008 3:45 PM, Bo Zhou <[EMAIL PROTECTED]> wrote:
> >
> > Hi Guys,
> >
> > I'm cooking up my time series code. I want a data frame with first column 
> > as timestamp in POSIXlt format.
> >
> > I hit on this the problem of how to create an array/list/vector of POSIXlt 
> > objects. Code is as follows
> >
> >
> >
> > > dtt=array(dim = 2)
> > > t=as.POSIXlt( strptime("07/12/07 13:20:01", "%m/%d/%Y %H:%M:%S",tz="GMT"))
> > > dtt
> > [1] NA NA
> > > t
> > [1] "0007-07-12 13:20:01 GMT"
> > > dtt[1]=t
> > Warning message:
> > In dtt[1] = t :
> >  number of items to replace is not a multiple of replacement length
> > > class(dtt)
> > [1] "list"
> > > class(t)
> > [1] "POSIXt"  "POSIXlt"
> > > unclass(t)
> > $sec
> > [1] 1
> >
> > $min
> > [1] 20
> >
> > $hour
> > [1] 13
> >
> > $mday
> > [1] 12
> >
> > $mon
> > [1] 6
> >
> > $year
> > [1] -1893
> >
> > $wday
> > [1] 4
> >
> > $yday
> > [1] 192
> >
> > $isdst
> > [1] 0
> >
> > attr(,"tzone")
> > [1] "GMT"
> >
> >
> >
> > Seems like POSIXlt is matrix in this case.
> >
> > Any suggestions?
> >
> > Cheers,
> >
> > B
> > _
> > [[elided Hotmail spam]]
> >
> >[[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >

_
Need to know the score, the latest news, or you need your Hotmail®-get your 
"fix".

[[alternative HTML version deleted]]

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


Re: [R] Custom Plot - means, SD & 5th-95th% (Plotmeans or Boxplot)

2008-02-17 Thread Gabor Grothendieck
Using builtin dataset stackloss try this:

f <- function(x) replace(quantile(x, c(5, 25, 50, 75, 95)/100), 3, mean(x))
bxp(list(stats = sapply(stackloss, f), n = stackloss, names = names(stackloss)))

and see ?bxp and ?boxplot

On Feb 17, 2008 9:17 PM, Stropharia <[EMAIL PROTECTED]> wrote:
>
> Any help with this problem would be greatly appreciated:
>
> I need to produce a custom plot i haven't come across in R. Basically, I
> want to show means, 1st standard deviation and 5th and 95th percentiles
> visually, using something resembling a boxplot. Is it possible to completely
> customize a boxplot so that it shows means as the bar (instead of, not as
> well as medians), standard deviations at the hinges (instead of IQR) and 5th
> & 95th percentiles at the brackets? The plotmeans function (ggplots) allows
> means to be plotted, but it seems only with confidence intervals, not 5th
> and 95th percentiles, and also without hinges (for standard deviations).
> I've searched the forums and various books and have drawn a blank on this.
> Thanks.
>
> Steve
>
> 
> Steve Worthington
> Ph.D. Candidate
> New York Consortium
> in Evolutionary Primatology
> --
> View this message in context: 
> http://www.nabble.com/Custom-Plot---means%2C-SD---5th-95th--%28Plotmeans-or-Boxplot%29--tp15537706p15537706.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] Custom Plot - means, SD & 5th-95th% (Plotmeans or Boxplot)

2008-02-17 Thread David Winsemius
[EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]: 

> It's fairly simple to set up something like this for ggplot2:
> 
> install.packages("ggplot2")
> library(ggplot2)
> 
> library(ggplot2)
> 
> q5 <- function(data) {
>  q <- function(p) unname(quantile(data$y, p))
>  data.frame(min = q(0.05), max = q(0.95))
> }
> 
> ggplot(diamonds, aes(x = cut, y = price)) +
> stat_summary(fun="mean_sdl", geom="crossbar", mult=1) +
> stat_summary(fun="q5", geom="linerange")

On WXP with R2.6.1, and version 0.5.7 of ggplot2, ggplott threw an 
error whose second line stated that:
'variable "stat_q5" of mode "function" was not found'

So I defined stat_q5 with the same function code as q5 above and the 
plot appeared.

I have a follow on ggplot2 question for which I have not found the 
correct terms for a successful search: how does one change the 
background fill for the plots? I really would like something other than 
grey backgrounds and they seem to be the default.

-- 
David Winsemius

 
> 
> (see Hmisc::smean.sdl for more details on the first summary
> function). 
> 
> Although from this example you can see that that choice of summary
> statistics probably isn't the best.  You can read more about
> stat_summary (and ggplot2 in general) at
> http://had.co.nz/ggplot2/stat_summary.html.
> 
> Hadley
> 
> On 2/17/08, Stropharia <[EMAIL PROTECTED]> wrote:
>>
>> Any help with this problem would be greatly appreciated:
>>
>> I need to produce a custom plot i haven't come across in R.
>> Basically, I want to show means, 1st standard deviation and 5th and
>> 95th percentiles visually, using something resembling a boxplot. Is
>> it possible to completely customize a boxplot so that it shows
>> means as the bar (instead of, not as well as medians), standard
>> deviations at the hinges (instead of IQR) and 5th & 95th
>> percentiles at the brackets? The plotmeans function (ggplots)
>> allows means to be plotted, but it seems only with confidence
>> intervals, not 5th and 95th percentiles, and also without hinges
>> (for standard deviations). I've searched the forums and various
>> books and have drawn a blank on this. Thanks.
>>
>> Steve
>>
>> 
>> Steve Worthington
>> Ph.D. Candidate
>> New York Consortium
>> in Evolutionary Primatology
>> --
>> View this message in context:
>> http://www.nabble.com/Custom-Plot---means%2C-SD---5th-95th--%28Plotm
>> eans-or-Boxplot%29--tp15537706p15537706.html Sent from the R help
>> mailing list archive at Nabble.com. 
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html and provide commented,
>> minimal, self-contained, reproducible code. 
>>
> 
>

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


Re: [R] Custom Plot - means, SD & 5th-95th% (Plotmeans or Boxplot)

2008-02-17 Thread h . wickham
It's fairly simple to set up something like this for ggplot2:

install.packages("ggplot2")
library(ggplot2)

library(ggplot2)

q5 <- function(data) {
 q <- function(p) unname(quantile(data$y, p))
 data.frame(min = q(0.05), max = q(0.95))
}

ggplot(diamonds, aes(x = cut, y = price)) +
stat_summary(fun="mean_sdl", geom="crossbar", mult=1) +
stat_summary(fun="q5", geom="linerange")

(see Hmisc::smean.sdl for more details on the first summary function).

Although from this example you can see that that choice of summary
statistics probably isn't the best.  You can read more about
stat_summary (and ggplot2 in general) at
http://had.co.nz/ggplot2/stat_summary.html.

Hadley

On 2/17/08, Stropharia <[EMAIL PROTECTED]> wrote:
>
> Any help with this problem would be greatly appreciated:
>
> I need to produce a custom plot i haven't come across in R. Basically, I
> want to show means, 1st standard deviation and 5th and 95th percentiles
> visually, using something resembling a boxplot. Is it possible to completely
> customize a boxplot so that it shows means as the bar (instead of, not as
> well as medians), standard deviations at the hinges (instead of IQR) and 5th
> & 95th percentiles at the brackets? The plotmeans function (ggplots) allows
> means to be plotted, but it seems only with confidence intervals, not 5th
> and 95th percentiles, and also without hinges (for standard deviations).
> I've searched the forums and various books and have drawn a blank on this.
> Thanks.
>
> Steve
>
> 
> Steve Worthington
> Ph.D. Candidate
> New York Consortium
> in Evolutionary Primatology
> --
> View this message in context:
> http://www.nabble.com/Custom-Plot---means%2C-SD---5th-95th--%28Plotmeans-or-Boxplot%29--tp15537706p15537706.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


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

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


[R] Custom Plot - means, SD & 5th-95th% (Plotmeans or Boxplot)?

2008-02-17 Thread Stropharia

Any help with this problem would be greatly appreciated:

I need to produce a custom plot i haven't come across in R. Basically, I
want to show means, 1st standard deviation and 5th and 95th percentiles
visually, using something resembling a boxplot. Is it possible to completely
customize a boxplot so that it shows means as the bar (instead of, not as
well as medians), standard deviations at the hinges (instead of IQR) and 5th
& 95th percentiles at the brackets? The plotmeans function (ggplots) allows
means to be plotted, but it seems only with confidence intervals, not 5th
and 95th percentiles, and also without hinges (for standard deviations).
I've searched the forums and various books and have drawn a blank on this.
Thanks.

Steve


Steve Worthington
Ph.D. Candidate
New York Consortium
in Evolutionary Primatology
-- 
View this message in context: 
http://www.nabble.com/Custom-Plot---means%2C-SD---5th-95th--%28Plotmeans-or-Boxplot%29--tp15537706p15537706.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] compiling 2.6.2 using icc

2008-02-17 Thread Denham Robert

Just in case others make my mistake, the problem was that I had a .R
directory in my home directory, which had a Makevars file in it with
CC=gcc.  I don't remember why I had this, but it was being read for
package building and throwing everything out.

Robert


 

-Original Message-
From: Denham Robert 
Sent: Thursday, 14 February 2008 2:06 PM
To: r-help@r-project.org
Cc: 'Prof Brian Ripley'
Subject: RE: [R] compiling 2.6.2 using icc

I thought the problem was that I had tried to use a --with-blas argument
as an option to the configure script like:
 --with-blas="-L/opt/freeware/atlas/atlas-3.7.37/lib/ -lf77blas
-lpthread -latlas" since I had built R with gcc like this in the past.
But it still doesn't seem to compile the packages.  Here is the approach
I have taken, on a freshly untarred directory:

edit site.config so that it contains:

CC=icc
CFLAGS="-g -O3 -wd188 -ip"
F77=ifort
FFLAGS="-g -O3"
ICC_LIBS=/opt/intel/cce/10.1.012/lib
IFC_LIBS=/opt/intel/fce/10.1.012/lib/
LDFLAGS="-L$ICC_LIBS -L$IFC_LIBS -L/usr/lib64"
CXX=icpc
CXXFLAGS="-g -O3"
FC=ifort
FCFLAGS="-g -O3 -mp"

Run configure like:
./configure --prefix=/opt/freeware/R/R-2.6.2/ 

This results in:

R is now configured for x86_64-unknown-linux-gnu

  Source directory:  .
  Installation directory:/opt/freeware/R/R-2.6.2/

  C compiler:icc -c99 -mp -g -O3 -wd188 -ip
  Fortran 77 compiler:   ifort -mp -g -O3

  C++ compiler:  icpc -mp -g -O3
  Fortran 90/95 compiler:ifort -g -O3 -mp
  Obj-C compiler:gcc -g -O2

  Interfaces supported:  X11, tcltk
  External libraries:readline
  Additional capabilities:   PNG, JPEG, iconv, MBCS, NLS
  Options enabled:   shared BLAS, R profiling, Java

  Recommended packages:  yes


Then make, which works until it gets to building the recommended package
MASS:

begin installing recommended package VR
* Installing *source* package 'MASS' ...
** libs
make[3]: Entering directory `/tmp/R.INSTALL.r19401/VR/MASS/src'
gcc -I/opt/freewaresrc/R/R-2.6.2/include
-I/opt/freewaresrc/R/R-2.6.2/include  -I/usr/local/include  -mp  -fpic
-g -O3 -wd188 -ip -c lqs.c -o lqs.o
gcc: unrecognized option '-wd188'
cc1: error: unrecognized command line option "-ip"
cc1: error: unrecognized command line option "-mp"
make[3]: *** [lqs.o] Error 1
make[3]: Leaving directory `/tmp/R.INSTALL.r19401/VR/MASS/src'
ERROR: compilation failed for package 'MASS'
** Removing '/opt/freewaresrc/R/R-2.6.2/library/MASS'
** Removing '/opt/freewaresrc/R/R-2.6.2/library/class'
** Removing '/opt/freewaresrc/R/R-2.6.2/library/nnet'
** Removing '/opt/freewaresrc/R/R-2.6.2/library/spatial'
make[2]: *** [VR.ts] Error 1
make[2]: Leaving directory
`/opt/freewaresrc/R/R-2.6.2/src/library/Recommended'
make[1]: *** [recommended-packages] Error 2
make[1]: Leaving directory
`/opt/freewaresrc/R/R-2.6.2/src/library/Recommended'
make: *** [stamp-recommended] Error 2


etc/Makeconf has:
# etc/Makeconf.  Generated from Makeconf.in by configure.
#
# ${R_HOME}/etc/Makeconf

include $(R_SHARE_DIR)/make/vars.mk

AR = ar
BLAS_LIBS = -L$(R_HOME)/lib$(R_ARCH) -lRblas C_VISIBILITY = CC = icc
-c99 CFLAGS = -g -O3 -wd188 -ip CPICFLAGS = -fpic CPPFLAGS =
-I/usr/local/include CXX = icpc CXXCPP = icpc -E CXXFLAGS = -g -O3
CXXPICFLAGS = -fpic DYLIB_EXT = .so DYLIB_LD = icc -c99 DYLIB_LDFLAGS =
-shared DYLIB_LINK = $(DYLIB_LD) $(DYLIB_LDFLAGS) $(LDFLAGS) ECHO_C =
ECHO_N = -n ECHO_T =
F77 = ifort
F77_VISIBILITY =
FC = ifort
FCFLAGS = -g -O3 -mp
FFLAGS = -g -O3
FLIBS =  -lifport -lifcore -limf -lsvml -lm -lipgo -lirc -lgcc_s -lirc_s
-ldl FCPICFLAGS = -fpic FPICFLAGS = -fpic 

The only reference to gcc I could find was OBJC = gcc

Could this be a problem?  I tried changing this to icc -c99 but this
made no difference.


Since it seems to work for other users, I assume there is something in
my setup that is preventing it from working, though I am not sure where
to look.  PATH and other environment variables look okay.  Any
suggestions would be welcome.

Thanks
Robert




-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 13 February 2008 4:59 PM
To: Denham Robert
Cc: r-help@r-project.org
Subject: Re: [R] compiling 2.6.2 using icc

It's working for other users of icc.  Check what CC is set to in
etc/Makeconf, and if it is not 'icc -c99', reset it.

On Wed, 13 Feb 2008, Denham Robert wrote:

> I am having trouble compiling R-2.6.2 on suse linux x86_64 using the 
> intel compiler.  I read section C.2.1 Intel compilers in the R 
> Installation and Administration manual, and put
>
> CC=icc
> CFLAGS="-g -O3 -wd188 -ip"
> F77=ifort
> FFLAGS="-g -O3"
> ICC_LIBS=/opt/intel/cce/10.1.012/lib
> IFC_LIBS=/opt/intel/fce/10.1.012/lib/
> LDFLAGS="-L$ICC_LIBS -L$IFC_LIBS -L/usr/lib64"
> CXX=icpc
> CXXFLAGS="-g -O3"
> FC=ifort
> FCFLAGS="-g -O3 -mp"
>
> in my config.site.  Everything seems to compile alright, up until 
> making the recommended package MASS.  The output below shows 

[R] ASA Southern California Chapter Applied Statistics Workshop

2008-02-17 Thread Madeline Bauer
The Southern California Chapter of the American Statistical 
Association invites you to attend the 27th annual Applied Statistics 
Workshop on Friday March 28, 2008 in The Pointe at the Pyramid at 
California State University, Long Beach.  The topic is "The Vital 
Importance of Adjusting for Patient Risk:  Risk Adjustment in Health 
Services Research" by Professor Arlene Ash of Boston University. For 
more information, go to www.sc-asa.org. Early registration deadline 
is March 11, 2008.

Madeline Bauer, Ph.D.University of Southern California
Keck School of Medicine (Infectious Diseases)


[[alternative HTML version deleted]]

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


[R] difference between lme and lmer in df calculation

2008-02-17 Thread Jarrett Byrnes
Hello all.  I'm currently working with mixed models, and have noticed  
a curious difference between the nlme and lmer packages.  While I  
realize that model selection with mixed models is a tricky issue, the  
two packages currently produce different AIC scores for the same  
model, but they systematically differ by 2.  In looking at the logLik  
values for each method, I find that they indeed differ by 1.  So, the  
following code:

utils::data(npk, package="MASS")

library(lme4)
a<-lmer(yield ~ 1+(1|block), data=npk)
logLik(a)

library(nlme)
b<-lme(yield ~ 1, random=~1|block, data=npk)
logLik(b)

produces a df of 2 for a, and a df of 3 for b.  I'm guessing that lmer  
is not accounting for the level-1 variance.  Is this the case, and, if  
so, will this be fixed?

I see that this issue was brought up sometime back.  Is there a reason  
it has not been addressed?
https://stat.ethz.ch/pipermail/r-help/2006-March/102520.html

Incidentally, I'm also curious what folk think about the approach to  
using the conditional AIC value as posted here
https://stat.ethz.ch/pipermail/r-help/2008-February/154389.html

Thanks!

-Jarrett

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Weird SEs with effect()

2008-02-17 Thread John Fox
Dear Gustaf,

> -Original Message-
> From: Gustaf Granath [mailto:[EMAIL PROTECTED]
> Sent: February-17-08 4:18 PM
> To: John Fox
> Cc: 'Prof Brian Ripley'; r-help@r-project.org
> Subject: RE: [R] Weird SEs with effect()
> 
> Dear John and Brian,
> Thank you for your help. I get the feeling that it is something
> fundamental that I do not understand here. Furthermore, a day of
> reading did not really help so maybe we have reached a dead end here.
> Nevertheless, here comes one last try.
> 
> I thought that the values produced by effect() were logs (e.g. in
> $fit). And then they were transformed (antilogged) with summary(). Was
> I wrong?

I'm sorry that you're continuing to have problems with this.

Yes, there is a point that you don't understand: The SEs are on the scale of
the log-counts, but you can't get correct SEs on the scale of the counts by
exponentiating the SEs on the scale of the log-counts. What summary(), etc.,
do (and you can do) to produce confidence intervals on the count scale is
first to compute the intervals on the log-count scale and then to transform
the end-points.

I'm afraid that I can't make the point more clearly than that.

I hope this helps,
 John

> 
> What I want:
> I am trying to make a barplot with adjusted means with SEs (error
> bars), with the y axis labeled on the response scale.
> 
> #One of my GLM models (inf.level & def.level=factors, initial.size =
> covariate) #used as an example.
> #I was not able to make a reproducible example though. Sorry.
> 
> model <-
> glm(tot.fruit~initial.size+inf.level+def.level,family=quasipoisson)
> summary(model)
> Coefficients:
>  Estimate Std. Error t value Pr(>|t|)
> (Intercept)1.9368528  0.1057948  18.308  < 2e-16 ***
> initial.size   0.0015245  0.0001134  13.443  < 2e-16 ***
> inf.level50   -0.3142688  0.0908063  -3.461 0.000612 ***
> def.level12.5 -0.2329221  0.1236992  -1.883 0.060620 .
> def.level25   -0.1722354  0.1181993  -1.457 0.146062
> def.level50   -0.3543826  0.1212906  -2.922 0.003731 **
> 
> (Dispersion parameter for quasipoisson family taken to be 6.431139)
>  Null deviance: 2951.5  on 322  degrees of freedom
> Residual deviance: 1917.2  on 317  degrees of freedom
> 
> library(effects)
> def <- effect("def.level",model,se=TRUE)
> summary(def)
> $effect
> def.level
>  0  12.52550
> 11.145382  8.829541  9.381970  7.819672
> $lower
> def.level
> 0 12.5   25   50
> 9.495220 7.334297 7.867209 6.467627
> $upper
> def.level
> 0 12.5   25   50
> 13.08232 10.62962 11.18838  9.45436
> #Confidence intervals makes sense and are in line with the glm model
> result. Now #lets look at the standard errors. Btw, why aren't they
> given with summary?
> def$se
> 324325326327
> 0.08144281 0.09430438 0.08949864 0.09648573
> # As you can see, the SEs are very very very small.
> #In a graph it would look weird in combination with the glm result.
> #I thought that these values were logs. Thats why I used exp() which
> seems to be wrong.
> 
> Regards,
> 
> Gustaf
> 
> 
> > Quoting John Fox <[EMAIL PROTECTED]>:
> > Dear Brian and Gustaf,
> >
> > I too have a bit of trouble following what Gustaf is doing, but I
> think that
> > Brian's interpretation -- that Gustaf is trying to transform the
> standard
> > errors via the inverse link rather than transforming the ends of the
> > confidence intervals -- is probably correct. If this is the case,
> then what
> > Gustaf has done doesn't make sense.
> >
> > It is possible to get standard errors on the scale of the response
> (using,
> > e.g., the delta method), but it's probably better to work on the
> scale of
> > the linear predictor anyway. This is what the summary, print, and
> plot
> > methods in the effects package do (as is documented in the help files
> for
> > the package -- see the transformation argument under ?effect and the
> type
> > argument under ?summary.eff).
> >
> > Regards,
> >  John
> >
> > 
> > John Fox, Professor
> > Department of Sociology
> > McMaster University
> > Hamilton, Ontario, Canada L8S 4M4
> > 905-525-9140x23604
> > http://socserv.mcmaster.ca/jfox
> >
> >
> >> -Original Message-
> >> From: Prof Brian Ripley [mailto:[EMAIL PROTECTED]
> >> Sent: February-17-08 6:42 AM
> >> To: Gustaf Granath
> >> Cc: John Fox; r-help@r-project.org
> >> Subject: Re: [R] Weird SEs with effect()
> >>
> >> On Sun, 17 Feb 2008, Gustaf Granath wrote:
> >>
> >> > Hi John,
> >> >
> >> > In fact I am still a little bit confused because I had read the
> >> > ?effect help and the archives.
> >> >
> >> > ?effect says that the confidence intervals are on the linear
> >> predictor
> >> > scale as well. Using exp() on the untransformed confidence
> intervals
> >> > gives me the same values as summary(eff). My confidence intervals
> >> > seems to be correct and reflects the results from my glm models.
> >> >
> >> > But when I us

Re: [R] extracting elements by using logical values

2008-02-17 Thread Henrique Dallazuanna
Try this:

overlapped<-function(x,y)
{
z<-rbind(x,y)
overlap <- vector()
 for(i in 1:nrow(z)){   
overlap<-c(overlap, (z[i,1]<=z[,2]&z[i,2]>=z[,1])[-i])
}
 return(z[overlap,])
}

On 17/02/2008, mohamed nur anisah <[EMAIL PROTECTED]> wrote:
> dear lists,
>
>   My question is quite simple but i'm a new user in R and it's seem tough to
> me. How am i going to recall back my values??ok..it could be easy if i
> ilustrate my problem with the simple example. say that,
>x
> [1] 1 2
> y
> [1] 2 3
>
>   and my logical output from my function are (Below is my function):
>
>   overlapped(x,y)
> [1] TRUE
> [1] TRUE
>
>   suppose i want my output to be:
>   [1] 1 2
> [1] 2 3
>
>
>   overlapped<-function(x,y){
> z<-rbind(x,y)
>  for(i in 1:nrow(z)){
>   overlap<-(z[i,1]<=z[,2]&z[i,2]>=z[,1])[-i]
>if(any(overlap)) print(TRUE)
>else print(FALSE)
>   }
>}
>
>   Thanks in advance!!
>
>   cheers,
>   Anisah
>
>
>
>
>
> -
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


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

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


Re: [R] ggplot2: bug in geom_ribbon + log scale!?

2008-02-17 Thread Martin Rittner
'works nicely with loging the values. Thank you very much!

Keep on the great work, the more I use ggplot2, the more I love it!

Greetings, Martin


[EMAIL PROTECTED] wrote:
> Yes, that's a bug in the current version (fixed in the development
> version) - the problem is that the min and max aesthetics aren't being
> correctly scaled.  You can fix it by explicitly logging those values,
> or I can send you the development version off list if you remind me of
> your OS.
>
> Hadley
>
> On 2/17/08, Martin Rittner <[EMAIL PROTECTED]> wrote:
>   
>> Hi everyone, Hadley,
>>
>> it seems there's a bug in geom_ribbon() when using it in a log-scaled plot:
>>
>> d<-data.frame(x=c(1:20),y1=rnorm(20)+3,y2=rnorm(20)+5)
>> p<-ggplot()
>> p<-p+geom_ribbon(data=d,aes(x=d[["x"]],min=d[["y1"]],max=d[["y2"]]))
>> p<-p+geom_line(data=d,aes(x=d[["x"]],y=d[["y1"]]),colour="blue")
>> p<-p+geom_line(data=d,aes(x=d[["x"]],y=d[["y2"]]),colour="red")
>> p2+scale_y_continuous()
>>
>> ...gives the plot I want, only with my actual data, I'd need it in
>> log-scale:
>>
>> p2+scale_y_log10()
>>
>> shifts the ribbon far above the actual data (factor 1000, if I see it
>> right, but I haven't tested it with different data to check on that...).
>>
>> I'm using the latest version of ggplot2 (0.5.7).
>>
>> Has anyone any suggestions for a workaround/patch?
>>
>> Many Thanks, Martin
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>> 
>
>
>

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


[R] extracting elements by using logical values

2008-02-17 Thread mohamed nur anisah
dear lists,
   
  My question is quite simple but i'm a new user in R and it's seem tough to 
me. How am i going to recall back my values??ok..it could be easy if i 
ilustrate my problem with the simple example. say that,
   x   
[1] 1 2
y
[1] 2 3
   
  and my logical output from my function are (Below is my function):
   
  overlapped(x,y)
[1] TRUE
[1] TRUE

  suppose i want my output to be:
  [1] 1 2
[1] 2 3
   
   
  overlapped<-function(x,y){
z<-rbind(x,y)
 for(i in 1:nrow(z)){
  overlap<-(z[i,1]<=z[,2]&z[i,2]>=z[,1])[-i]
   if(any(overlap)) print(TRUE)
   else print(FALSE)
  }
   }

  Thanks in advance!!
   
  cheers,
  Anisah
  
 
   

   
-

[[alternative HTML version deleted]]

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


Re: [R] Weird SEs with effect()

2008-02-17 Thread Gustaf Granath
Dear John and Brian,
Thank you for your help. I get the feeling that it is something  
fundamental that I do not understand here. Furthermore, a day of  
reading did not really help so maybe we have reached a dead end here.  
Nevertheless, here comes one last try.

I thought that the values produced by effect() were logs (e.g. in  
$fit). And then they were transformed (antilogged) with summary(). Was  
I wrong?

What I want:
I am trying to make a barplot with adjusted means with SEs (error  
bars), with the y axis labeled on the response scale.

#One of my GLM models (inf.level & def.level=factors, initial.size =  
covariate) #used as an example.
#I was not able to make a reproducible example though. Sorry.

model <- glm(tot.fruit~initial.size+inf.level+def.level,family=quasipoisson)
summary(model)
Coefficients:
 Estimate Std. Error t value Pr(>|t|)
(Intercept)1.9368528  0.1057948  18.308  < 2e-16 ***
initial.size   0.0015245  0.0001134  13.443  < 2e-16 ***
inf.level50   -0.3142688  0.0908063  -3.461 0.000612 ***
def.level12.5 -0.2329221  0.1236992  -1.883 0.060620 .
def.level25   -0.1722354  0.1181993  -1.457 0.146062
def.level50   -0.3543826  0.1212906  -2.922 0.003731 **

(Dispersion parameter for quasipoisson family taken to be 6.431139)
 Null deviance: 2951.5  on 322  degrees of freedom
Residual deviance: 1917.2  on 317  degrees of freedom

library(effects)
def <- effect("def.level",model,se=TRUE)
summary(def)
$effect
def.level
 0  12.52550
11.145382  8.829541  9.381970  7.819672
$lower
def.level
0 12.5   25   50
9.495220 7.334297 7.867209 6.467627
$upper
def.level
0 12.5   25   50
13.08232 10.62962 11.18838  9.45436
#Confidence intervals makes sense and are in line with the glm model  
result. Now #lets look at the standard errors. Btw, why aren't they  
given with summary?
def$se
324325326327
0.08144281 0.09430438 0.08949864 0.09648573
# As you can see, the SEs are very very very small.
#In a graph it would look weird in combination with the glm result.
#I thought that these values were logs. Thats why I used exp() which  
seems to be wrong.

Regards,

Gustaf


> Quoting John Fox <[EMAIL PROTECTED]>:
> Dear Brian and Gustaf,
>
> I too have a bit of trouble following what Gustaf is doing, but I think that
> Brian's interpretation -- that Gustaf is trying to transform the standard
> errors via the inverse link rather than transforming the ends of the
> confidence intervals -- is probably correct. If this is the case, then what
> Gustaf has done doesn't make sense.
>
> It is possible to get standard errors on the scale of the response (using,
> e.g., the delta method), but it's probably better to work on the scale of
> the linear predictor anyway. This is what the summary, print, and plot
> methods in the effects package do (as is documented in the help files for
> the package -- see the transformation argument under ?effect and the type
> argument under ?summary.eff).
>
> Regards,
>  John
>
> 
> John Fox, Professor
> Department of Sociology
> McMaster University
> Hamilton, Ontario, Canada L8S 4M4
> 905-525-9140x23604
> http://socserv.mcmaster.ca/jfox
>
>
>> -Original Message-
>> From: Prof Brian Ripley [mailto:[EMAIL PROTECTED]
>> Sent: February-17-08 6:42 AM
>> To: Gustaf Granath
>> Cc: John Fox; r-help@r-project.org
>> Subject: Re: [R] Weird SEs with effect()
>>
>> On Sun, 17 Feb 2008, Gustaf Granath wrote:
>>
>> > Hi John,
>> >
>> > In fact I am still a little bit confused because I had read the
>> > ?effect help and the archives.
>> >
>> > ?effect says that the confidence intervals are on the linear
>> predictor
>> > scale as well. Using exp() on the untransformed confidence intervals
>> > gives me the same values as summary(eff). My confidence intervals
>> > seems to be correct and reflects the results from my glm models.
>> >
>> > But when I use exp() to get the correct SEs on the response scale I
>> > get SEs that sometimes do not make sense at all. Interestingly I have
>>
>> What exactly are you doing here?  I suspect you are not using the
>> correct
>> formula to transform the SEs (you do not just exponeniate them), but
>> without the reproducible example asked for we cannot tell.
>>
>> > found a trend. For my model with adjusted means ~ 0.5-1.5 I get huge
>> > SEs (SEs > 1, but my glm model shows significant differences between
>> > level 1 = 0.55 and level 2 = 1.15). Models with means around 10-20 my
>> > SEs are fine with exp(). Models with means around 75-125 my SEs get
>> > way too small with exp().
>> >
>> > Something is not right here (or maybe they are but I don not
>> > understand it) so I think my best option will be to use the
>> confidence
>> > intervals instead of SEs in my plot.
>>
>> If you want confidence intervals, you are better off computing those on
>> a
>> reasonable scale and transforming then.  Or using a p

Re: [R] How to make a vector/list/array of POSIXlt object?

2008-02-17 Thread Gabor Grothendieck
Normally one uses POSIXct rather than POSIXlt for storage.  See R News 4/1 for
more info on date and time classes.

On Feb 17, 2008 3:45 PM, Bo Zhou <[EMAIL PROTECTED]> wrote:
>
> Hi Guys,
>
> I'm cooking up my time series code. I want a data frame with first column as 
> timestamp in POSIXlt format.
>
> I hit on this the problem of how to create an array/list/vector of POSIXlt 
> objects. Code is as follows
>
>
>
> > dtt=array(dim = 2)
> > t=as.POSIXlt( strptime("07/12/07 13:20:01", "%m/%d/%Y %H:%M:%S",tz="GMT"))
> > dtt
> [1] NA NA
> > t
> [1] "0007-07-12 13:20:01 GMT"
> > dtt[1]=t
> Warning message:
> In dtt[1] = t :
>  number of items to replace is not a multiple of replacement length
> > class(dtt)
> [1] "list"
> > class(t)
> [1] "POSIXt"  "POSIXlt"
> > unclass(t)
> $sec
> [1] 1
>
> $min
> [1] 20
>
> $hour
> [1] 13
>
> $mday
> [1] 12
>
> $mon
> [1] 6
>
> $year
> [1] -1893
>
> $wday
> [1] 4
>
> $yday
> [1] 192
>
> $isdst
> [1] 0
>
> attr(,"tzone")
> [1] "GMT"
>
>
>
> Seems like POSIXlt is matrix in this case.
>
> Any suggestions?
>
> Cheers,
>
> B
> _
> [[elided Hotmail spam]]
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


[R] How to make a vector/list/array of POSIXlt object?

2008-02-17 Thread Bo Zhou

Hi Guys,

I'm cooking up my time series code. I want a data frame with first column as 
timestamp in POSIXlt format.

I hit on this the problem of how to create an array/list/vector of POSIXlt 
objects. Code is as follows



> dtt=array(dim = 2)
> t=as.POSIXlt( strptime("07/12/07 13:20:01", "%m/%d/%Y %H:%M:%S",tz="GMT"))
> dtt
[1] NA NA
> t
[1] "0007-07-12 13:20:01 GMT"
> dtt[1]=t
Warning message:
In dtt[1] = t :
  number of items to replace is not a multiple of replacement length
> class(dtt)
[1] "list"
> class(t)
[1] "POSIXt"  "POSIXlt"
> unclass(t)
$sec
[1] 1

$min
[1] 20

$hour
[1] 13

$mday
[1] 12

$mon
[1] 6

$year
[1] -1893

$wday
[1] 4

$yday
[1] 192

$isdst
[1] 0

attr(,"tzone")
[1] "GMT"



Seems like POSIXlt is matrix in this case. 

Any suggestions?

Cheers,

B
_
[[elided Hotmail spam]]

[[alternative HTML version deleted]]

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


[R] How to create an array/list/vector of POSIXlt objects?

2008-02-17 Thread bo
Hi Guys,

I'm cooking up my own time series code. I'm creating a data frame with
first column as timestamp in POSIXlt format.

I'm hit on problems like this

> dtt=array(dim = 2)
> t=as.POSIXlt( strptime("07/12/07 13:20:01", "%m/%d/%Y %H:%M:%S",tz="GMT"))
> dtt
[1] NA NA
> t
[1] "0007-07-12 13:20:01 GMT"
> dtt[1]=t
Warning message:
In dtt[1] = t :
  number of items to replace is not a multiple of replacement length
> class(dtt)
[1] "list"
> class(t)
[1] "POSIXt"  "POSIXlt"
> unclass(t)
$sec
[1] 1

$min
[1] 20

$hour
[1] 13

$mday
[1] 12

$mon
[1] 6

$year
[1] -1893

$wday
[1] 4

$yday
[1] 192

$isdst
[1] 0

attr(,"tzone")
[1] "GMT"


Seems like POSIXlt is a matrix so that it can not be embedded into an
element of the array?

Any suggestions?

Cheers,

Bo

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


[R] ggplot2: bug in geom_ribbon + log scale!?

2008-02-17 Thread Martin Rittner
Hi everyone, Hadley,

it seems there's a bug in geom_ribbon() when using it in a log-scaled plot:

d<-data.frame(x=c(1:20),y1=rnorm(20)+3,y2=rnorm(20)+5)
p<-ggplot()
p<-p+geom_ribbon(data=d,aes(x=d[["x"]],min=d[["y1"]],max=d[["y2"]]))
p<-p+geom_line(data=d,aes(x=d[["x"]],y=d[["y1"]]),colour="blue")
p<-p+geom_line(data=d,aes(x=d[["x"]],y=d[["y2"]]),colour="red")
p2+scale_y_continuous()

...gives the plot I want, only with my actual data, I'd need it in 
log-scale:

p2+scale_y_log10()

shifts the ribbon far above the actual data (factor 1000, if I see it 
right, but I haven't tested it with different data to check on that...).

I'm using the latest version of ggplot2 (0.5.7).

Has anyone any suggestions for a workaround/patch?

Many Thanks, Martin

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


Re: [R] random location in polygons sp spsample splancs csr

2008-02-17 Thread Patrick Giraudoux
Thanks for those detailed explanation and the time taken to write them.
>  The spsample methods for polygons have an iter= argument that can be 
> used to make then "try harder", did you try it (with what values - the 
> help page senctence you quote is from the iter= description)?
Yes sure, I went up to 10, but no success.

> Could you provide an example with a set.seed() value that does what 
> you say, or at least the code you used?
The easiest way is to send the data and the script off list. I will do it.
>
> Did you try asking for multiple points and then choosing a single 
> point at random? This would be equivalent to increasing iter while 
> asking for a single point.
I did not try this one

Actually, I found my way out easy with csr() in splancs, and did not 
fight too much with spsample. My question on the list was just for 
general information
> PS. Perhaps R-sig-geo is a more appropriate list?
I was wondering too... and chose r-help because I though the question 
was of 'general' interest enough. This is debatable indeed...

Thank you anyway for your answer, and see you in a few minutes off list...

Cheers,

Patrick

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Set length of axes in lattice

2008-02-17 Thread Saptarshi Guha
Thank you.
On Feb 17, 2008, at 1:18 PM, Deepayan Sarkar wrote:
> See ?print.trellis.
>
> p <- xyplot(1 ~ 1, aspect = 0.5)
> p
> plot(p, panel.width = list(2, "inches"), panel.height = list(1,  
> "inches"))
>
> This overrides 'aspect=' though, that is, you will need to specify
> both width and height if you want to control the aspect ratio.
>
> -Deepayan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Set length of axes in lattice

2008-02-17 Thread Deepayan Sarkar
On 2/17/08, Saptarshi Guha <[EMAIL PROTECTED]> wrote:
> Hello,
> It is possible to set the aspect ratio  of the Y-axis to the X-axis
> in xyplot
> (a) xyplot(y~x,aspect=1.8)
> Suppose I have only 1 panel and i wish to set the length of the X-
> axis to 2" keeping the same aspect ratio as in (a). I would also like
> to keep the same scales.
> I suppose i need to do something in prepanel but what?
> Is there any function i can call to set the actual length of the axes?

See ?print.trellis.

p <- xyplot(1 ~ 1, aspect = 0.5)
p
plot(p, panel.width = list(2, "inches"), panel.height = list(1, "inches"))

This overrides 'aspect=' though, that is, you will need to specify
both width and height if you want to control the aspect ratio.

-Deepayan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Transfer Crosstable to Word-Document

2008-02-17 Thread Udo König
Zitat von Greg Snow <[EMAIL PROTECTED]>:

> If your final goal is a word document, then you should look at the odfWeave
> package.

Greg,
I had a look at the odfWeave package, but it seems that complex tables, for
instance produced with latex() can´t be produced/included, as can be done
with sweave.



Udo König
Clinic for Child an Adolescent Psychiatry
Philipps University of Marburg / Germany

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


Re: [R] random location in polygons sp spsample splancs csr

2008-02-17 Thread Roger Bivand
On Sun, 17 Feb 2008, Patrick Giraudoux wrote:

> Dear all,
>
> I had to place points at random, one in each of larger number of polygons 
> (actually in objects of class 'SpatialPolygonsDataFrame' , see sp library), 
> and  tried first to do it  using spsample (from sp). Surprisingly, every 5-15 
> trials, the output was a NULL value. The doc says that ' this may occur when 
> trying to hit a small and awkwardly shaped polygon in a large bounding box 
> with a small number of points', but in my case, the shapes were not really 
> awkward, and the bounding box just the smallest rectangle including the 
> shape, just the number of points was 1 in each polygon.

Dear Patrick,

All the different packages providing functions for generating random 2D 
points in an irregular polygon or polygons do it similarly - they increase 
the number of points to be drawn at least in proportion to the ratio of 
the area of bounding box of the polygon to the area of the polygon. Next, 
they return the points found from the bounding box area that fall within 
the polygon. If too many points are found within the polygon, they thin 
them. If, on the other hand, they are unlucky, they iterate until they 
meet or exceed the number needed. Handling holes in the polygon(s) is an 
added attraction as are multiple polygons in a window (spsample methods do 
this, as do similar methods in spatstat).

Could you provide an example with a set.seed() value that does what you 
say, or at least the code you used? The spsample methods for polygons have 
an iter= argument that can be used to make then "try harder", did you try 
it (with what values - the help page senctence you quote is from the 
iter= description)?

Did you try asking for multiple points and then choosing a single point at 
random? This would be equivalent to increasing iter while asking for a 
single point.

>
> Thus I tried csr (from splancs) after having extracted the polygon 
> coordinates of each shape from the Spatial object, and everything went 
> smoothly, with hit success every trial.
>

This is because - see the code csr -> ranpts -> gen - it simply iterates 
until the number of generated points within the polygon exceeds the number 
required. If the polygon is easy to "hit", this isn't costly, the 
alternative is easy to see.

Hope this helps

Roger

PS. Perhaps R-sig-geo is a more appropriate list?

> Has anybody (anybody will probably be Edzer or/and Roger...) an idea why here 
> splancs looks like outperforming spsample ?
>
> Patrick
>
>
>
>
>
>

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 on a computer cluster

2008-02-17 Thread Jay Emerson
Gabriele,

In addition to the suggestions from Markus (below), there is
NetWorkSpaces (package nws).  I have used both nws and snow together
with a package I'm developing (bigmemoRy) which allocates matrices to
shared memory (helping avoid the bottleneck Markus alluded to for
processors on the same computer).  Both seem quite easy to use,
essentially only needing one command to initiate the "cluster" and
then one command to do something like apply() in parallel.  It takes a
little planning of your application, but the "painfully obvious"
parallel problem should be painless to implement.

Jay




Hi,

your required performance is strongly depending on your application.
If you talk about a cluster, you should think about several computers.
Not only one computer with several processors.

If you have several computers. First of all you have to decide for a
communication protocol for parallel computing: MPI, PVM, ...
Then you have to install this at your computers. I think you should use
MPI and one of its implementations: OpenMPI, LamMPI
Then there are several R packages for using the communication protocols:
Rmpi, snow, Rpvm, ...

If you have one computer with severals processors, you can do the same
thinks. But then you have only shared memory (bottleneck) and there is
not to much improvement in performance. R is not yet implemented for
multiple-processors. There is one first, experimental R package using
openMP for multi threading: pnmath
(http://www.stat.uiowa.edu/~luke/R/experimental/)

Some useful links:
http://www.stats.uwo.ca/faculty/yu/Rmpi/
http://ace.acadiau.ca/math/ACMMaC/Rmpi/
http://www.open-mpi.org/
http://www.personal.leeds.ac.uk/~bgy1mm/MPITutorial/MPIHome.html

Best regards
Markus

[EMAIL PROTECTED] schrieb:
> Dear all,
>
> I usually run  R on my laptop with Windows XP Professional.
> Now I really want to run  R on a computer cluster (4 processors) with
> Suse Linux Enterprise ver. 10.   But I  am new with computer cluster.
>
>
> Should I modify my functions in order to use the greater
> performance
> and availability than that provided by my laptop?
>
>
> Is there any R
> manual  on parallel computations on multiple-processor?
> Any suggestion
> on a basic tutorial on this topic?
>
> Thank you.
>
>

-- 
John W. Emerson (Jay)
Assistant Professor of Statistics
Director of Graduate Studies
Department of Statistics
Yale University
http://www.stat.yale.edu/~jay
REvolution Computing, Statistical Consultant

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] History of R

2008-02-17 Thread John C Frain
The windows port of R has been very good for a long time. I know some
people who even think that the current windows port is better than the
Linux version.  Thanks to those who have made the windows port
available and who continue to maintain it.  I now use both MS Windows
and Linux (Fedora) and would not like to lose either..

The windows port of Octave before the recent version 3 was not good.
As far as I know one was restricted to a very old version or using
cygwin.  This would not suit most users of windows.  Thus Octave was
not available to the majority of MS windows users.  Compared to R
which had the latest version available to Windows users is it any
wonder that Octave is not as popular.  The new version 3 is a vast
improvement and should be looked at by anyone familiar with Matlab.
The new front end, using the SciTE editor is a vast improvement on
what was previously available.

Best Regards

John

On 16/02/2008, Kathy Gerber <[EMAIL PROTECTED]> wrote:
> Thanks to all who responded so thoughtfully.  I would like to summarize
> briefly the observations and opinions so far with some of my own
> interpretations and thoughts.  John Fox is working on a much deeper
> history scheduled for August, and his three factors are a good starting
> point.
>
> John Fox wrote:
> > Dear Kathy,
> >
> > As Achim has mentioned, I've been doing interviews with members of the R
> > Core team and with some other people central to the R Project. Although I
> > haven't entirely organized and finished reflecting on this material, the
> > following factors come immediately to mind:
> >
> > (1) Doug has already mentioned the personal and technical talents of the
> > original developers, and their generosity in opening up development to a
> > Core group and in making R open source. To that I would add the collective
> > talents of the Core group as a whole.
> >
> There are three attributes here:
> a) Personal talent:  I take this to mean communication and teaching
> ability along with leadership.  These are the talents and skills that
> provide groundwork for a mature type of collaboration, more along the
> lines found in tightly focused academic areas.  I would think that these
> attributes are  big factors in why R has not devolved into forks and
> holy wars.
> b) Technical talent: Both the technical talent and domain knowledge of
> the original developers and the R Core group are better than
> consistently solid.  The leaders are not rock stars or cult figures.
> c) Generosity:  The responses themselves sincerely gave credit to
> others.  While this may appear to be consistent with Eric Raymond's
> notions of open source as built upon a "gift culture," I haven't really
> seen this going on elsewhere at such a level.
> > (2) R implements the S language, which already was in wide use, and which
> > has many attractive features (each of use, etc.).
> >
> >
> One person who emailed privately pointed out that many open source
> projects are "knock-offs," e.g., linux itself is a unix knock-off.  I
> believe the point is that R is not a totally new approach or invention,
> rather it is based upon advancing some product or collection of ideas
> that are already in place.
> > (3) The R package system and the establishment of CRAN allowed literally
> > hundreds of developers to contribute to the broader R Project. More
> > generally, the Core group worked to integrate users into the R Project,
> > e.g., through R News, the r-help list (though naive users aren't always
> > treated gently there), and the useR conferences.
> >
> >
> Again, this is another distinctive feature, perhaps not in concept but
> in degree and level of actual success thanks to good planning.  Like so
> many other points, this goes back to the leadership.
>
> Another point made was the need or demand for such an application.   Yet
> another was the planning that goes into avoiding breakage of packages.
> What no one mentioned though was the idea of standards.
>
> Finally, in comparing with Octave, it was mentioned that Octave may be
> stuck in a position of playing catch-up to Matlab.
>
> What I have here is far from complete, but I did want to give some
> feedback tonight.  Again, thanks to you all for such articulate
> responses, and I will point to my slides, and later on write up a summary.
>
> Kathy Gerber
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
John C Frain
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]

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

Re: [R] Transfer Crosstable to Word-Document

2008-02-17 Thread Duncan Temple Lang
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


You can programmatically create content directly in Word from R
including tables, lists, paragraphs, etc. via a DCOM connection
where R is the client and Word is the server.  There are two packages
to do this - rcom and RDCOMClient and both allow you to work at much
higher levels of specificity than cutting and pasting HTML or CSV content.

You'd have to learn a little about the DCOM API for Word, but there
are examples.

~ D.

[EMAIL PROTECTED] wrote:
| # Dear list,
| # I am an R-beginner and
| # spent the last days looking for a method to insert tables produced
| # with R into a word document. I thought about SPPS:  copy a table from
| # an SPO-file and paste it into a word document
| # (if needed do some formatting with that table).
| # Annother idea was, to produce a TEX-file,
| # insert it and make it a word-table.
|
| # I found the following libraries, which seemed to be promising:
| # xtable
| # prettyR
| # R2HTML
| # Hmisc
| # SciViews / svViews
|
|
|
| ###
| ## My example: a crosstable (made with CrossTable from lib gmodels 
| ###
|
| library(gmodels)
| library(xtable)
| library(svViews)
|
| # Data for crosstabulation
| set.seed(1)
| n <- 200
| sex <- sample(c("f","m"),n,T)
| state <- sample(c("AL","AK","CA"),n,T)
|
| #Create crosstab
| ct <- CrossTable(state, sex, expected=TRUE, format="SPSS", digits=1)
| ct #display crosstab on screen
|
| #Trie to produce a html file
| xtable(ct) #Error message: No method!
| methods(xtable)
|
|
|
| #Try to create a rich formatted table and insert it into Word
| #with svViws, but only a little part of crosstab it inserted
|
| docdir <- "r:\\r"
| WordOpen(file.path(docdir, "cross.doc"))
| viewfile <- view(ct, type = "summary", browse = FALSE)
| WordGoto("ctview")
| WordInsertFile(viewfile, TRUE) #only a little part of crosstab inserted
| WordActivate(async = TRUE)
|
|
| #How could I create the latex-code for the crosstable?
| w <- latex(ct) #would that work?
|
| # I could not test this, because I didn´t install Miktex yet
| # (I will do this soon)
|
| Can someone help me?
|
| Thanks in advance
| Udo
|
|
| --
| Udo Koenig
| Clinic for child and adolescent psychiatry
| University of Marburg / Germany
|
| __
| R-help@r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-help
| PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
| and provide commented, minimal, self-contained, reproducible code.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHuGsu9p/Jzwa2QP4RAn9xAJ94KmlBA5Yl1hfT4Z0CsmL7s61qpwCfZNhn
BMaw4u4FggRWn3QrKg79PAw=
=mElZ
-END PGP SIGNATURE-

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 use a reserved word in italics in an expression

2008-02-17 Thread Michael Kubovy
Delightfully straightforward! Thanks.

On Feb 16, 2008, at 5:15 PM, Duncan Murdoch wrote:

> On 16/02/2008 4:51 PM, Michael Kubovy wrote:
>> Dear R-helpers,
>> > label2 <- expression(paste(italic(attraction function:), 'slope'))
>> Error: unexpected 'function' in "label2 <-   
>> expression(paste(italic(attraction function"
>> How do I tell R that in this case I don't want 'function' to be   
>> treated as a reserved word but as a string in italics?
>
> Just put it in quotes.  In fact, I think italic("attraction") looks  
> better than italic(attraction), so you may want to do this more  
> generally.
>
> For example,
>
> plot(1, main=expression(paste(italic("attraction function: "),  
> "slope")))
>
> Duncan Murdoch

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

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


[R] random location in polygons sp spsample splancs csr

2008-02-17 Thread Patrick Giraudoux
Dear all,

I had to place points at random, one in each of larger number of 
polygons (actually in objects of class 'SpatialPolygonsDataFrame' , see 
sp library), and  tried first to do it  using spsample (from sp). 
Surprisingly, every 5-15 trials, the output was a NULL value. The doc 
says that ' this may occur when trying to hit a small and awkwardly 
shaped polygon in a large bounding box with a small number of points', 
but in my case, the shapes were not really awkward, and the bounding box 
just the smallest rectangle including the shape, just the number of 
points was 1 in each polygon.

Thus I tried csr (from splancs) after having extracted the polygon 
coordinates of each shape from the Spatial object, and everything went 
smoothly, with hit success every trial.

Has anybody (anybody will probably be Edzer or/and Roger...) an idea why 
here splancs looks like outperforming spsample ?

Patrick

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Specify Path of an Excel file in R

2008-02-17 Thread Charles Annis, P.E.
One way that works for lazy people like me is to use file.choose().

1) Type in "file.choose()" without the quotes and hit 
2) Navigate to the folder and file that you want and click on it.
3) R will show you the complete path to your file.

An even easier way is to do something like this:

my.stuff <- read.csv(file.choose(), ...

and then navigate to your file.

Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of savanna3000
Sent: Sunday, February 17, 2008 10:53 AM
To: r-help@r-project.org
Subject: [R] Specify Path of an Excel file in R


Hello Helpers,


   I have an Excel file on my desktop (.csv) which I want to use in my R
worksheet, how can I specify the path while using read.csv() ?


   Savanna
-- 
View this message in context:
http://www.nabble.com/Specify-Path-of-an-Excel-file-in-R-tp15530586p15530586
.html
Sent from the R help mailing list archive at Nabble.com.

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

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


[R] Set length of axes in lattice

2008-02-17 Thread Saptarshi Guha
Hello,
It is possible to set the aspect ratio  of the Y-axis to the X-axis  
in xyplot
(a) xyplot(y~x,aspect=1.8)
Suppose I have only 1 panel and i wish to set the length of the X- 
axis to 2" keeping the same aspect ratio as in (a). I would also like  
to keep the same scales.
I suppose i need to do something in prepanel but what?
Is there any function i can call to set the actual length of the axes?
Thank you
Saptarsho

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


[[alternative HTML version deleted]]

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


Re: [R] Specify Path of an Excel file in R

2008-02-17 Thread My Coyne
Try:
X<- read.csv ("") or
Y<- read.delim("", sep=",", header=T)

Example, if your file is in C-directory, file name is my_file, and the file
has a header.
X<- read.csv("c:\\my_file") or
Y<- read.delim("c:\\my_file", sep=",", header=T)



My D. Coyne



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of savanna3000
Sent: Sunday, February 17, 2008 10:53 AM
To: r-help@r-project.org
Subject: [R] Specify Path of an Excel file in R


Hello Helpers,


   I have an Excel file on my desktop (.csv) which I want to use in my R
worksheet, how can I specify the path while using read.csv() ?


   Savanna
-- 
View this message in context:
http://www.nabble.com/Specify-Path-of-an-Excel-file-in-R-tp15530586p15530586
.html
Sent from the R help mailing list archive at Nabble.com.

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

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


[R] Set length of axes in lattice's xyplot?

2008-02-17 Thread Saptarshi Guha
Hello,
It is possible to set the aspect ratio  of the Y-axis to the X-axis  
in xyplot
(a) xyplot(y~x,aspect=1.8)
Suppose I have only 1 panel and i wish to set the length of the X- 
axis to 2" keeping the same aspect ratio as in (a), I suppose i need  
to do something in prepanel but what?
Is there any function i can call to set the actual length of the axes?

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Specify Path of an Excel file in R

2008-02-17 Thread savanna3000

Hello Helpers,


   I have an Excel file on my desktop (.csv) which I want to use in my R
worksheet, how can I specify the path while using read.csv() ?


   Savanna
-- 
View this message in context: 
http://www.nabble.com/Specify-Path-of-an-Excel-file-in-R-tp15530586p15530586.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Producing graphs and console output in postscript format

2008-02-17 Thread John Kane
?postscript

Perhaps sweave?
http://www.stat.umn.edu/~charlie/Sweave/

--- John Sorkin <[EMAIL PROTECTED]> wrote:

> R 2.6.1
> Windows XP
> 
> I would like to make a postscript document that
> contains my graphs and the output that I get from
> the R console. So far, all I have been able to do is
> produce my graphs in postscript form. I do this in a
> sub-optimal manner by MANUALLY saving each graph in
> postscript form. I have not been able to save the
> console output in postscript form. Is there some way
> that I can use the sink() function to save console
> output in postscript form? Is there some way to
> automatically save each graph as a postscript file?
> Thanks,
> John 
> 
> John Sorkin M.D., Ph.D.
> Chief, Biostatistics and Informatics
> University of Maryland School of Medicine Division
> of Gerontology
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above
> prior to faxing)
> 
> Confidentiality Statement:
> This email message, including any attachments, is\ > f...{{dropped:18}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Re storing a UPDATES on a data.frame

2008-02-17 Thread savanna3000

Thank you Prof Brian, this really solved my problem and it was well explained
:)



Prof Brian Ripley wrote:
> 
> Well
> 
> - MASS is a package and not a library
> - it is not 'base' but 'contributed', and as library(help=MASS) says, 
> support software for a book.  It is on CRAN.
> - Packages with namespaces are read-only, so you have not changed the 
> data frame in MASS, and even for other packages you can only change the 
> copy in memory, not that on disc (all 'unless you know to subvert the 
> standard ways').
> 
> What you likely did was to create a new data frame 'whiteside' in your 
> user workspace and then save the workspace containing it.  In which case
> 
> rm(whiteside)
> save.image()
> 
> will fix it.  However, you should have got warnings about conflicts when 
> you started R, but perhaps you forgot to mention those.
> 
> Perhaps the following might be educative:
> 
>> library(MASS)
>> find("whiteside")
> [1] "package:MASS"
>> whiteside$temp <- 1
>> find("whiteside")
> [1] ".GlobalEnv"   "package:MASS"
> 
> This is really an internal version of
> 
> whiteside <- `$<-`(whiteside, temp, 1)
> 
> and that assigns in the current frame just like  any other assignment.
> 
> 
> On Fri, 15 Feb 2008, savanna3000 wrote:
> 
>>
>> Hello everyone,
>>
>>  Can anyone tell me how do I restore data in a data.frame provided by
>> base
>> R libraries (MASS) ?
>> I uninstalled R then installed it again and I still see the new changes I
>> made!!!???
>> (eg. whiteside$Temp=1 ==> 1 overwrote all the rows, I want the old values
>> :(
>> !!
>>
>>
>>  Please HELP!
>> --
>> View this message in context:
>> http://www.nabble.com/Restoring-a-UPDATES-on-a-data.frame-tp15512767p15512767.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> -- 
> Brian D. Ripley,  [EMAIL PROTECTED]
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel:  +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UKFax:  +44 1865 272595
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Restoring-a-UPDATES-on-a-data.frame-tp15512767p15530584.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Weird SEs with effect()

2008-02-17 Thread John Fox
Dear Brian and Gustaf,

I too have a bit of trouble following what Gustaf is doing, but I think that
Brian's interpretation -- that Gustaf is trying to transform the standard
errors via the inverse link rather than transforming the ends of the
confidence intervals -- is probably correct. If this is the case, then what
Gustaf has done doesn't make sense. 

It is possible to get standard errors on the scale of the response (using,
e.g., the delta method), but it's probably better to work on the scale of
the linear predictor anyway. This is what the summary, print, and plot
methods in the effects package do (as is documented in the help files for
the package -- see the transformation argument under ?effect and the type
argument under ?summary.eff).

Regards,
 John


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


> -Original Message-
> From: Prof Brian Ripley [mailto:[EMAIL PROTECTED]
> Sent: February-17-08 6:42 AM
> To: Gustaf Granath
> Cc: John Fox; r-help@r-project.org
> Subject: Re: [R] Weird SEs with effect()
> 
> On Sun, 17 Feb 2008, Gustaf Granath wrote:
> 
> > Hi John,
> >
> > In fact I am still a little bit confused because I had read the
> > ?effect help and the archives.
> >
> > ?effect says that the confidence intervals are on the linear
> predictor
> > scale as well. Using exp() on the untransformed confidence intervals
> > gives me the same values as summary(eff). My confidence intervals
> > seems to be correct and reflects the results from my glm models.
> >
> > But when I use exp() to get the correct SEs on the response scale I
> > get SEs that sometimes do not make sense at all. Interestingly I have
> 
> What exactly are you doing here?  I suspect you are not using the
> correct
> formula to transform the SEs (you do not just exponeniate them), but
> without the reproducible example asked for we cannot tell.
> 
> > found a trend. For my model with adjusted means ~ 0.5-1.5 I get huge
> > SEs (SEs > 1, but my glm model shows significant differences between
> > level 1 = 0.55 and level 2 = 1.15). Models with means around 10-20 my
> > SEs are fine with exp(). Models with means around 75-125 my SEs get
> > way too small with exp().
> >
> > Something is not right here (or maybe they are but I don not
> > understand it) so I think my best option will be to use the
> confidence
> > intervals instead of SEs in my plot.
> 
> If you want confidence intervals, you are better off computing those on
> a
> reasonable scale and transforming then.  Or using a profile likelihood
> to
> compute them (which will be equivariant under monotone scale
> transformations).
> 
> > Regards,
> >
> > Gustaf
> >
> >
> >> Quoting John Fox <[EMAIL PROTECTED]>:
> >>
> >> Dear Gustaf,
> >>
> >> From ?effect, "se: a vector of standard errors for the effect, on
> the scale
> >> of the linear predictor." Does that help?
> >>
> >> Regards,
> >>  John
> >>
> >> 
> >> John Fox, Professor
> >> 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]
> >>> project.org] On Behalf Of Gustaf Granath
> >>> Sent: February-16-08 11:43 AM
> >>> To: r-help@r-project.org
> >>> Subject: [R] Weird SEs with effect()
> >>>
> >>> Hi all,
> >>>
> >>> Im a little bit confused concerning the effect() command, effects
> >>> package.
> >>> I have done several glm models with family=quasipoisson:
> >>>
> >>> model <-glm(Y~X+Q+Z,family=quasipoisson)
> >>>
> >>> and then used
> >>>
> >>> results.effects <-effect("X",model,se=TRUE)
> >>>
> >>> to get the "adjusted means". I am aware about the debate concerning
> >>> adjusted means, but you guys just have to trust me - it makes sense
> >>> for me.
> >>> Now I want standard error for these means.
> >>>
> >>> results.effects$se
> >>>
> >>> gives me standard error, but it is now it starts to get confusing.
> The
> >>> given standard errors are very very very small - not realistic. I
> >>> thought that maybe these standard errors are not back transformed
> so I
> >>> used exp() and then the standard errors became realistic. However,
> for
> >>> one of my glm models with quasipoisson the standard errors make
> kind
> >>> of sense without using exp() and gets way to big if I use exp(). To
> be
> >>> honest, I get the feeling that Im on the wrong track here.
> >>>
> >>> Basically, I want to know how SE is calculated in effect() (all I
> know
> >>> is that the reported standard errors are for the fitted values) and
> if
> >>> anyone knows what is going on here.
> >>>
> >>> Regards,
> >>>
> >>> Gustaf Granath
> >>>
> >>> __
> >>> R-help@r-project.org mailing list
> >>> https://stat.ethz.ch/mailman/listinfo/r-help
>

Re: [R] Transfer Crosstable to Word-Document

2008-02-17 Thread Gabor Grothendieck
On Feb 17, 2008 8:20 AM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote:
>
> On Feb 17, 2008 4:41 AM, Peter Dalgaard <[EMAIL PROTECTED]> wrote:
> >
> > Gabor Grothendieck wrote:
> > > On Feb 16, 2008 5:28 PM, David Scott <[EMAIL PROTECTED]> wrote:
> > >
> > >> On Sat, 16 Feb 2008, Alan Zaslavsky wrote:
> > >>
> > >>
> > >>> If you want to get nicely formatted tables in Word and are familiar with
> > >>> Office tools (I know it's the Evil Empire but some of us work there), I
> > >>> suggest that you use Excel for formatting and then insert the table into
> > >>> your Word document.  IMHO, Excel is much superior to Word for table
> > >>> formatting, e.g. modifying number of significant digits, playing around
> > >>> with fonts and number formats, etc.  And when you have gotten the 
> > >>> formats
> > >>> right you can paste in modified values of the numbers in the table 
> > >>> without
> > >>> having to do the formatting again.  Including the table in your Word
> > >>> document is easy by cut-paste or creating a live link.
> > >>>
> > >>> As a user of R under Unix I haven't looked into the facilities for 
> > >>> writing
> > >>> tables to Excel under Windows but there is something there.  
> > >>> Alternatively
> > >>> you can write a fixed-column or tab-delimited file and easily import to
> > >>> Excel.
> > >>>
> > >>>
> > >> Production of tables and formatting them in Word is something I have 
> > >> dealt
> > >> with a couple of times recently and it really is important to do 
> > >> something
> > >> smart because of the time taken to individually format tables.
> > >>
> > >> An approach I used recently was to produce a text table in R and export 
> > >> it
> > >> to Excel as a .csv file which could then be copied as is to Word. Borders
> > >> and the like would still have to be formatted individually but not 
> > >> entries
> > >>
> > >
> > > You could get a border automatically by writing your table out
> > > as HTML.  Try this using the builtin data frame iris:
> > >
> > > library(R2HTML)
> > > HTML(iris, border = 1, file("clipboard","w"), append=FALSE)
> > >
> > > Now paste that into Excel and from Excel into Word and you should
> > > have a border around it.
> > >
> > > See ?HTML.data.frame
> > >
> > > You could alternately generate the HTML yourself giving quite a bit
> > > of control.
> > >
> > Just curious (I don't use Word if I can help it -- even the simplest of
> > things drive me up the wall), but can you not import HTML directly in
> > Word? OpenOffice seems to do it quite happily with xtable output.
>
> You can open an HTML file in Word as a new document and it will
> be properly formatted and then you could save that document as
> a Word document and insert it into your main Word document.
> Alternately, you could copy and paste it from the newly created Word
> document into your main Word document and that would preserve formatting.

Actually you could alternately read the HTML file into Word with
formatting preserved using
   Insert > Object > Create From File
(that's in Word 2007; I think the menus are slightly different in earlier
versions) and not use the clipboard at all.  That's a bit of a nuisance
due to the requirement of creating the intermediate file and having to
browse to it in Word.  Thus pasting it into Excel and then Word is probably
still the fastest but this would be a viable alternative and would be superior
if you wanted to generate many tables in R at once and then later add them
to Word.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] filled.contour with log axis

2008-02-17 Thread Duncan Murdoch
On 16/02/2008 7:33 PM, Thomas Hoffmann wrote:
> Dear all,
> 
> I would like to generate a filled.contour plot with log x and y axis, 
> however using:
> 
> filled.contour(as.line,log="xy")
> 
> results in a warning message.
> 
> 
> Does anybody knos what to do?

You could transform your x and y values to their logs, and then use 
custom axis() calls to plot the axes.  For example, a modification of 
the first example from ?filled.contour:

x <- 10*1:nrow(volcano)
xtick <- pretty(x)
x <- log(x)
y <- 10*1:ncol(volcano)
ytick <- pretty(y)
y <- log(y)
filled.contour(x, y, volcano, color = terrain.colors,
 plot.title = title(main = "The Topography of Maunga Whau",
 xlab = "Meters North", ylab = "Meters West"),
 plot.axes = { axis(1, at=log(xtick), label=xtick);
   axis(2, at=log(ytick), label=ytick) },
 key.title = title(main="Height\n(meters)"),
 key.axes = axis(4, seq(90, 190, by = 10)))# maybe also asp=1

Duncan Murdoch

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


Re: [R] Transfer Crosstable to Word-Document

2008-02-17 Thread Tobias Sing
On Feb 17, 2008 2:49 PM, Udo König <[EMAIL PROTECTED]> wrote:
> [...]
> Greg:
> To the odfWeave package: in [2] I found the sentence "The package is currently
> limited to creating text documents using OpenOffice". So it doesn´t seem work
> with MS-Word?

Udo,

I think odfWeave is exactly what you need here. You can also use it
with MS-Word via the SUN ODF Plugin for MS Office. It adds the
capability to load and save odf docs within MS Office.

Get the (free as in beer) plugin from here:
http://www.sun.com/software/star/odf_plugin/whats_new.jsp

Then write your document in Word, save as ODF, run odfWeave, load the
result in Word and save as .doc.

HTH,
  Tobias

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


Re: [R] Error massage in attaching package 'rgl'

2008-02-17 Thread Duncan Murdoch
On 17/02/2008 8:56 AM, stat stat wrote:
> I am using 2.6.0 version in usual Windows-XP platform

The message indicates a damaged copy of something:  either your 
decompression code, or rgl.

I'd try re-downloading and installing rgl first, and if that doesn't 
work, reinstall R (and upgrade to the current release, 2.6.2).

Duncan Murdoch

> 
> */Duncan Murdoch <[EMAIL PROTECTED]>/* wrote:
> 
> On 17/02/2008 8:15 AM, stat stat wrote:
>  > Hi,
>  >
>  > I am getting following error message while attaching 'rgl' package :
>  >
>  >> library(rgl)
>  > Error in get(Info[i, 1], envir = env) : internal error in
> R_decompress1
>  >
>  > Can anyone tell me what should I do here?
> 
> Not unless you give a proper error report. Versions? Platform?
> 
> Duncan Murdoch
> 
> 
> 
> 
> thanks in advance
> 
> 
> 5, 50, 500, 5000 - Store N number of mails in your inbox. Click here. 
> 
>  
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] filled.contour with log axis

2008-02-17 Thread David Winsemius
Thomas Hoffmann <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]: 

> Dear all,
> 
> I would like to generate a filled.contour plot with log x and y
> axis, however using:
> 
> filled.contour(as.line,log="xy")
> 
> results in a warning message.
> 
> 
> Does anybody knos what to do?

Use a function that does accept the a parameter that does what you expect 
from log? Perhaps contourplot from the lattice package which has an 
extremely versatile scales parameter.

Or the stat_contour() geometry in ggplot2? I did not find a scale or a 
log argument but there was an example at Hadley's webpage that used a 
scale modification to the z value.  This experiment based on that that 
example seemed to create the expected behavior:

library(ggplot2)
volcano3d <- rename(melt(volcano), c(X1="x", X2="y", value="z")) 
v <- ggplot(volcano3d, aes(x=x,y=y,z=z)) 
v + stat_contour() +scale_x_log10() +scale_y_log10()

-- 
David Winsemius

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


Re: [R] Error massage in attaching package 'rgl'

2008-02-17 Thread stat stat
I am using 2.6.0 version in usual Windows-XP platform

Duncan Murdoch <[EMAIL PROTECTED]> wrote: On 17/02/2008 8:15 AM, stat stat 
wrote:
> Hi,
> 
> I am getting following error message while attaching 'rgl' package :
> 
>> library(rgl)
> Error in get(Info[i, 1], envir = env) : internal error in R_decompress1
> 
> Can anyone tell me what should I do here?

Not unless you give a proper error report.  Versions?  Platform?

Duncan Murdoch



thanks in advance
   
-
 5, 50, 500, 5000 - Store N number of mails in your inbox. Click here.
[[alternative HTML version deleted]]

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


Re: [R] Error massage in attaching package 'rgl'

2008-02-17 Thread Duncan Murdoch
On 17/02/2008 8:15 AM, stat stat wrote:
> Hi,
> 
> I am getting following error message while attaching 'rgl' package :
> 
>> library(rgl)
> Error in get(Info[i, 1], envir = env) : internal error in R_decompress1
> 
> Can anyone tell me what should I do here?

Not unless you give a proper error report.  Versions?  Platform?

Duncan Murdoch

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


Re: [R] Transfer Crosstable to Word-Document

2008-02-17 Thread Udo König
(2. attempt to post this)
(Udo)


Quoting Greg Snow <[EMAIL PROTECTED]>:

> If your final goal is a word document, then you should look at the odfWeave
> package.
>

At work my primary goal has to be a word document, because:

 * we have a Windows-XP network with MS-Office software
 * my boss and my colleagues are not firm with other software (I have to
   cooperate with them)

My idea is to insert simple tables into Word (what I asked for in this thread)
and to make more sohisticated tables -like [1]- with latex and include them as
a graphic file. I would NOT like to make such a table with MS-Word! I read an
introductory Latex script and asked our admin to install the Miktex package on
my computer.

At home I can fortunately do what I want (Windows, Linux, OpenOffice,...).

Greg:
To the odfWeave package: in [2] I found the sentence "The package is currently
limited to creating text documents using OpenOffice". So it doesn´t seem work
with MS-Word?



[1] #Taken from:
http://biostat.mc.vanderbilt.edu/twiki/pub/Main/StatReport/summary.pdf, p. 28

library(Hmisc)
getHdata(pbc)
attach(pbc)

s5 <- summary(drug ~ bili + albumin + stage + protime + sex + age + spiders,
  method="reverse", dta=pbc, test=TRUE)
options(digits=1)
print(s5, npct="both")
options(digits=3)

w <- latex(s5, size="smaller", npct="both",
   npct.size="smaller[2]", Nsize="smaller[2]",
   msdsize="smaller[2]",
   middle.bold=TRUE, landscape=TRUE)

wd <- dvi(w)
detach(pbc)


[2] R newsletter, Volume 6/4, October 2006, p.3



Udo König
Clinic for Child an Adolescent Psychiatry
Philipps University of Marburg / Germany

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Transfer Crosstable to Word-Document

2008-02-17 Thread Gabor Grothendieck
On Feb 17, 2008 4:41 AM, Peter Dalgaard <[EMAIL PROTECTED]> wrote:
>
> Gabor Grothendieck wrote:
> > On Feb 16, 2008 5:28 PM, David Scott <[EMAIL PROTECTED]> wrote:
> >
> >> On Sat, 16 Feb 2008, Alan Zaslavsky wrote:
> >>
> >>
> >>> If you want to get nicely formatted tables in Word and are familiar with
> >>> Office tools (I know it's the Evil Empire but some of us work there), I
> >>> suggest that you use Excel for formatting and then insert the table into
> >>> your Word document.  IMHO, Excel is much superior to Word for table
> >>> formatting, e.g. modifying number of significant digits, playing around
> >>> with fonts and number formats, etc.  And when you have gotten the formats
> >>> right you can paste in modified values of the numbers in the table without
> >>> having to do the formatting again.  Including the table in your Word
> >>> document is easy by cut-paste or creating a live link.
> >>>
> >>> As a user of R under Unix I haven't looked into the facilities for writing
> >>> tables to Excel under Windows but there is something there.  Alternatively
> >>> you can write a fixed-column or tab-delimited file and easily import to
> >>> Excel.
> >>>
> >>>
> >> Production of tables and formatting them in Word is something I have dealt
> >> with a couple of times recently and it really is important to do something
> >> smart because of the time taken to individually format tables.
> >>
> >> An approach I used recently was to produce a text table in R and export it
> >> to Excel as a .csv file which could then be copied as is to Word. Borders
> >> and the like would still have to be formatted individually but not entries
> >>
> >
> > You could get a border automatically by writing your table out
> > as HTML.  Try this using the builtin data frame iris:
> >
> > library(R2HTML)
> > HTML(iris, border = 1, file("clipboard","w"), append=FALSE)
> >
> > Now paste that into Excel and from Excel into Word and you should
> > have a border around it.
> >
> > See ?HTML.data.frame
> >
> > You could alternately generate the HTML yourself giving quite a bit
> > of control.
> >
> Just curious (I don't use Word if I can help it -- even the simplest of
> things drive me up the wall), but can you not import HTML directly in
> Word? OpenOffice seems to do it quite happily with xtable output.

You can open an HTML file in Word as a new document and it will
be properly formatted and then you could save that document as
a Word document and insert it into your main Word document.
Alternately, you could copy and paste it from the newly created Word
document into your main Word document and that would preserve formatting.

If you just use the code I posted then if you try to paste that into Word
you get the HTML source code rather than a formatted table in Word.

Thus its really easier just to paste it into Excel and then into Word
as others have mentioned.

It might be possible to get it onto the clipboard in a correctly formatted
way using:

out <-  capture.output(HTML(iris, stdout(), border = 1, append = FALSE))
writeClipboard(out, format = whatever)

for an appropriate whatever so that it retains its format when pasted into Word.
Some experimentation would be required to find an appropriate whatever.

It would also be possible to write rcom or RDCOMClient code in R which
transferred the document to Word or Excel and copied that new document
to the clipboard, all completely automatically, to ensure its in the proper
format.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Producing graphs and console output in postscript format

2008-02-17 Thread John Sorkin
R 2.6.1
Windows XP

I would like to make a postscript document that contains my graphs and the 
output that I get from the R console. So far, all I have been able to do is 
produce my graphs in postscript form. I do this in a sub-optimal manner by 
MANUALLY saving each graph in postscript form. I have not been able to save the 
console output in postscript form. Is there some way that I can use the sink() 
function to save console output in postscript form? Is there some way to 
automatically save each graph as a postscript file?
Thanks,
John 

John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}

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


[R] Error massage in attaching package 'rgl'

2008-02-17 Thread stat stat
Hi,

I am getting following error message while attaching 'rgl' package :

> library(rgl)
Error in get(Info[i, 1], envir = env) : internal error in R_decompress1

Can anyone tell me what should I do here?

Regards,

   
-
 5, 50, 500, 5000 - Store N number of mails in your inbox. Click here.
[[alternative HTML version deleted]]

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


Re: [R] Weird SEs with effect()

2008-02-17 Thread Prof Brian Ripley
On Sun, 17 Feb 2008, Gustaf Granath wrote:

> Hi John,
>
> In fact I am still a little bit confused because I had read the
> ?effect help and the archives.
>
> ?effect says that the confidence intervals are on the linear predictor
> scale as well. Using exp() on the untransformed confidence intervals
> gives me the same values as summary(eff). My confidence intervals
> seems to be correct and reflects the results from my glm models.
>
> But when I use exp() to get the correct SEs on the response scale I
> get SEs that sometimes do not make sense at all. Interestingly I have

What exactly are you doing here?  I suspect you are not using the correct 
formula to transform the SEs (you do not just exponeniate them), but 
without the reproducible example asked for we cannot tell.

> found a trend. For my model with adjusted means ~ 0.5-1.5 I get huge
> SEs (SEs > 1, but my glm model shows significant differences between
> level 1 = 0.55 and level 2 = 1.15). Models with means around 10-20 my
> SEs are fine with exp(). Models with means around 75-125 my SEs get
> way too small with exp().
>
> Something is not right here (or maybe they are but I don not
> understand it) so I think my best option will be to use the confidence
> intervals instead of SEs in my plot.

If you want confidence intervals, you are better off computing those on a 
reasonable scale and transforming then.  Or using a profile likelihood to 
compute them (which will be equivariant under monotone scale 
transformations).

> Regards,
>
> Gustaf
>
>
>> Quoting John Fox <[EMAIL PROTECTED]>:
>>
>> Dear Gustaf,
>>
>> From ?effect, "se: a vector of standard errors for the effect, on the scale
>> of the linear predictor." Does that help?
>>
>> Regards,
>>  John
>>
>> 
>> John Fox, Professor
>> 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]
>>> project.org] On Behalf Of Gustaf Granath
>>> Sent: February-16-08 11:43 AM
>>> To: r-help@r-project.org
>>> Subject: [R] Weird SEs with effect()
>>>
>>> Hi all,
>>>
>>> Im a little bit confused concerning the effect() command, effects
>>> package.
>>> I have done several glm models with family=quasipoisson:
>>>
>>> model <-glm(Y~X+Q+Z,family=quasipoisson)
>>>
>>> and then used
>>>
>>> results.effects <-effect("X",model,se=TRUE)
>>>
>>> to get the "adjusted means". I am aware about the debate concerning
>>> adjusted means, but you guys just have to trust me - it makes sense
>>> for me.
>>> Now I want standard error for these means.
>>>
>>> results.effects$se
>>>
>>> gives me standard error, but it is now it starts to get confusing. The
>>> given standard errors are very very very small - not realistic. I
>>> thought that maybe these standard errors are not back transformed so I
>>> used exp() and then the standard errors became realistic. However, for
>>> one of my glm models with quasipoisson the standard errors make kind
>>> of sense without using exp() and gets way to big if I use exp(). To be
>>> honest, I get the feeling that Im on the wrong track here.
>>>
>>> Basically, I want to know how SE is calculated in effect() (all I know
>>> is that the reported standard errors are for the fitted values) and if
>>> anyone knows what is going on here.
>>>
>>> Regards,
>>>
>>> Gustaf Granath
>>>
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-
>>> guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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

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


Re: [R] how to specify the location of tick mark on x axies

2008-02-17 Thread Jim Lemon
Xin wrote:
> Dear:
> 
> I want to plot barplot and let bar be in the middle of each x axis 
> category.
>  
>Do you have this experience?
>  
Hi Xin,
The "barp" function in the plotrix package centers the bars on integer 
values. This might make it a bit easier to do what you want.

Jim

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


[R] R Package Implementing Kohavi's Wrapper Method for Subset

2008-02-17 Thread Vu Nguyen
Hi List,

I am looking for a R package that implements Kohavi & John's wrapper methods 
for feature subset selection.  Do you know whether there is a such kind of R 
package?

Ref: R. Kohavi and G. H. John, “Wrappers for feature subset selection,” 
Artificial Intelligence, vol. 97,
no. 1-2, pp. 273–324, 1997.

Thanks a lot,
Vu


Computer Science Department
University of Southern California
[[alternative HTML version deleted]]

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


Re: [R] Transfer Crosstable to Word-Document

2008-02-17 Thread Peter Dalgaard
Gabor Grothendieck wrote:
> On Feb 16, 2008 5:28 PM, David Scott <[EMAIL PROTECTED]> wrote:
>   
>> On Sat, 16 Feb 2008, Alan Zaslavsky wrote:
>>
>> 
>>> If you want to get nicely formatted tables in Word and are familiar with
>>> Office tools (I know it's the Evil Empire but some of us work there), I
>>> suggest that you use Excel for formatting and then insert the table into
>>> your Word document.  IMHO, Excel is much superior to Word for table
>>> formatting, e.g. modifying number of significant digits, playing around
>>> with fonts and number formats, etc.  And when you have gotten the formats
>>> right you can paste in modified values of the numbers in the table without
>>> having to do the formatting again.  Including the table in your Word
>>> document is easy by cut-paste or creating a live link.
>>>
>>> As a user of R under Unix I haven't looked into the facilities for writing
>>> tables to Excel under Windows but there is something there.  Alternatively
>>> you can write a fixed-column or tab-delimited file and easily import to
>>> Excel.
>>>
>>>   
>> Production of tables and formatting them in Word is something I have dealt
>> with a couple of times recently and it really is important to do something
>> smart because of the time taken to individually format tables.
>>
>> An approach I used recently was to produce a text table in R and export it
>> to Excel as a .csv file which could then be copied as is to Word. Borders
>> and the like would still have to be formatted individually but not entries
>> 
>
> You could get a border automatically by writing your table out
> as HTML.  Try this using the builtin data frame iris:
>
> library(R2HTML)
> HTML(iris, border = 1, file("clipboard","w"), append=FALSE)
>
> Now paste that into Excel and from Excel into Word and you should
> have a border around it.
>
> See ?HTML.data.frame
>
> You could alternately generate the HTML yourself giving quite a bit
> of control.
>   
Just curious (I don't use Word if I can help it -- even the simplest of 
things drive me up the wall), but can you not import HTML directly in 
Word? OpenOffice seems to do it quite happily with xtable output.

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

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


Re: [R] Weird SEs with effect()

2008-02-17 Thread Gustaf Granath
Hi John,

In fact I am still a little bit confused because I had read the  
?effect help and the archives.

?effect says that the confidence intervals are on the linear predictor  
scale as well. Using exp() on the untransformed confidence intervals  
gives me the same values as summary(eff). My confidence intervals  
seems to be correct and reflects the results from my glm models.

But when I use exp() to get the correct SEs on the response scale I  
get SEs that sometimes do not make sense at all. Interestingly I have  
found a trend. For my model with adjusted means ~ 0.5-1.5 I get huge  
SEs (SEs > 1, but my glm model shows significant differences between  
level 1 = 0.55 and level 2 = 1.15). Models with means around 10-20 my  
SEs are fine with exp(). Models with means around 75-125 my SEs get  
way too small with exp().

Something is not right here (or maybe they are but I don not  
understand it) so I think my best option will be to use the confidence  
intervals instead of SEs in my plot.

Regards,

Gustaf


> Quoting John Fox <[EMAIL PROTECTED]>:
>
> Dear Gustaf,
>
> From ?effect, "se: a vector of standard errors for the effect, on the scale
> of the linear predictor." Does that help?
>
> Regards,
>  John
>
> 
> John Fox, Professor
> 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]
>> project.org] On Behalf Of Gustaf Granath
>> Sent: February-16-08 11:43 AM
>> To: r-help@r-project.org
>> Subject: [R] Weird SEs with effect()
>>
>> Hi all,
>>
>> Im a little bit confused concerning the effect() command, effects
>> package.
>> I have done several glm models with family=quasipoisson:
>>
>> model <-glm(Y~X+Q+Z,family=quasipoisson)
>>
>> and then used
>>
>> results.effects <-effect("X",model,se=TRUE)
>>
>> to get the "adjusted means". I am aware about the debate concerning
>> adjusted means, but you guys just have to trust me - it makes sense
>> for me.
>> Now I want standard error for these means.
>>
>> results.effects$se
>>
>> gives me standard error, but it is now it starts to get confusing. The
>> given standard errors are very very very small - not realistic. I
>> thought that maybe these standard errors are not back transformed so I
>> used exp() and then the standard errors became realistic. However, for
>> one of my glm models with quasipoisson the standard errors make kind
>> of sense without using exp() and gets way to big if I use exp(). To be
>> honest, I get the feeling that Im on the wrong track here.
>>
>> Basically, I want to know how SE is calculated in effect() (all I know
>> is that the reported standard errors are for the fitted values) and if
>> anyone knows what is going on here.
>>
>> Regards,
>>
>> Gustaf Granath
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-
>> guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>

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