Re: [R] R-problem

2008-02-19 Thread Prof Brian Ripley
Is this a *warning* from package 'foreign'?  If so it is discussed on the 
relevant help page (see ?read.spss).

Please note the footer of this message, and the request for 'commented, 
minimal, self-contained, reproducible code' as well as the posting guide's 
request for you to do your homework and not to post HTML.

On Tue, 19 Feb 2008, Theuser, Catrin wrote:

> Dear all,
>
> I encountered the following problem while using the "R" software: 
> "unrecognised record type 7, subtype 16 encountered in system file".
> Can you please help me with this?
>
> Thanks in advance,
> Catrin Theuser
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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

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


Re: [R] paste("Mus., 10 ", expression(mu)," g", sep="")

2008-02-19 Thread Uwe Ligges


Henrique Dallazuanna wrote:
> Try this:
> 
> plot(rnorm(10), main=expression(paste("Mus., 10 ",mu," g", sep="")))

or

plot(rnorm(10), main=expression("Mus., 10 " * mu * g))
without all that paste()ing, just as one formula.

Uwe Ligges

> On 18/02/2008, Samor Gandhi <[EMAIL PROTECTED]> wrote:
>> Dear all,
>>
>>   I am very thankful, if you could tell wheather it is possible to write
>>
>>   paste("Mus., 10 ", expression(mu)," g", sep="")
>>
>>   Thank you in advance,
>>   Samor
>>
>>
>> -
>>
>> [[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] Calculating Distance Metrics using Euclidean

2008-02-19 Thread Keizer_71

I am trying to calculate the distance metrics, but i keep getting this error.
I am very new to R. Am i doing something wrong.  


> dim(data.sub) 
[1] 1   140 

> dist(data.sub, method = "euclidean", diag = FALSE, upper = FALSE, p = 2) 
Error: cannot allocate vector of size 781250 Kb 
In addition: Warning messages: 
1: Reached total allocation of 1014Mb: see help(memory.size) 
2: Reached total allocation of 1014Mb: see help(memory.size)
-- 
View this message in context: 
http://www.nabble.com/Calculating-Distance-Metrics-using-Euclidean-tp15560521p15560521.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] plotEst

2008-02-19 Thread sigalit mangut-leiba
On 2/16/08, hadley wickham <[EMAIL PROTECTED]> wrote:
>
> On Feb 16, 2008 9:11 AM, sigalit mangut-leiba <[EMAIL PROTECTED]> wrote:
> > Hello,
> > This is the first time i'm trying to plot in R. I want to plot estimates
> of
> > OR and their confidence limits, like a scatter plot:
> > the vertical axis should be the estimated OR (with upper and lower conf.
> > limits),
> >  and the horizontal exis should be fixed values: (1,0.8,0.7,0.6,0.5,0.4)
> >
> > Here is a part of my code:
> >
> > ...ests=matrix(ncol=3,nrow=6)
> >
> >
> ests[,1]<-c(mean(or1),mean(or14),mean(or15),mean(or16),mean(or17),mean(or18))
> >
> > ests[,2]<-c(cl1,cl14,cl15,cl16,cl17,cl18)
> >
> > ests[,3]<-c(cu1,cu14,cu15,cu16,cu17,cu18)
> >
> > x1<-c(1,0.8,0.7,0.6,0.5,0.4)...
> >
> > Now I have a matrix with three columns: estimate, lower limit of the
> > confidende interval, and upper limit of the confidence interval:
> >
> >   [,1]  [,2] [,3]
> > [1,] 1.011794 0.6400744 1.383514
> > [2,] 1.646535 1.0421947 2.250875
> > [3,] 2.118518 1.3364878 2.900549
> > [4,] 2.709806 1.6899134 3.729698
> > [5,] 3.570759 2.2510895 4.890428
> > [6,] 4.874569 2.9081958 6.840942
> >
> >
> > The first value in x1 fit the first row in the matrix, etc..
> >
> > I tried the function plotEst like this:
> >
> > plotEst(ests,y = dim(ests)[1]:1, xlab="sensitivity", xtic=x1,
> > xlim=range(xtic))
> >
> > and got the Error:
> >
> > Error in strsplit(x, as.character(split), as.logical(extended),
> > as.logical(fixed),
> > :
> > non-character argument in strsplit()
> >
> > What am I missing?
>
> If you had a data.frame with columns, x, estimate, lcl and ucl, then
> you could use ggplot2 as follows:
>
> library(ggplot2)
> qplot(x, estimate, min=lcl, max=ucl, data=df, geom="pointrange")
>
> It's generally a good idea to store data in a data frame.
>
> Hadley
>
> --
> http://had.co.nz/
>


Another question: Can I add another line to the same plot with qplot?
(like function "lines" in "plot").
Thank You,
Sigalit.

[[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] Confidence Interval for SMR

2008-02-19 Thread RINNER Heinrich
You could have a look at package "epitools" (on CRAN, or at www.epitools.net).

-Heinrich.

> -Ursprüngliche Nachricht-
> Von: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] Im Auftrag von stefan lhachimi
> Gesendet: Dienstag, 19. Februar 2008 10:45
> An: [EMAIL PROTECTED]
> Betreff: [R] Confidence Interval for SMR
> 
> 
> 
> Hello,
> 
> I am looking for a function which allows to calculate the confidence
> interval for a standard mortality ratio. I do have vectors with the
> number of observed and expected death. Has anybody a hint where to
> look?
> Best,
> Stefan
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide 
> commented, minimal, self-contained, reproducible code.
> 

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

2008-02-19 Thread stefan lhachimi
Hello,

I am looking for a function which allows to calculate the confidence
interval for a standard mortality ratio. I do have vectors with the
number of observed and expected death. Has anybody a hint where to
look?
Best,
Stefan

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


[R] plotEst

2008-02-19 Thread sigalit mangut-leiba
-- Forwarded message --
From: sigalit mangut-leiba <[EMAIL PROTECTED]>
Date: Feb 19, 2008 12:17 PM
Subject: Re: [R] plotEst
To: r-help <[EMAIL PROTECTED]>



On 2/16/08, hadley wickham <[EMAIL PROTECTED]> wrote:
>
> On Feb 16, 2008 9:11 AM, sigalit mangut-leiba <[EMAIL PROTECTED]> wrote:
> > Hello,
> > This is the first time i'm trying to plot in R. I want to plot estimates
> of
> > OR and their confidence limits, like a scatter plot:
> > the vertical axis should be the estimated OR (with upper and lower conf.
> > limits),
> >  and the horizontal exis should be fixed values: (1,0.8,0.7,0.6,0.5,0.4)
> >
> > Here is a part of my code:
> >
> > ...ests=matrix(ncol=3,nrow=6)
> >
> >
> ests[,1]<-c(mean(or1),mean(or14),mean(or15),mean(or16),mean(or17),mean(or18))
> >
> > ests[,2]<-c(cl1,cl14,cl15,cl16,cl17,cl18)
> >
> > ests[,3]<-c(cu1,cu14,cu15,cu16,cu17,cu18)
> >
> > x1<-c(1,0.8,0.7,0.6,0.5,0.4)...
> >
> > Now I have a matrix with three columns: estimate, lower limit of the
> > confidende interval, and upper limit of the confidence interval:
> >
> >   [,1]  [,2] [,3]
> > [1,] 1.011794 0.6400744 1.383514
> > [2,] 1.646535 1.0421947 2.250875
> > [3,] 2.118518 1.3364878 2.900549
> > [4,] 2.709806 1.6899134 3.729698
> > [5,] 3.570759 2.2510895 4.890428
> > [6,] 4.874569 2.9081958 6.840942
> >
> >
> > The first value in x1 fit the first row in the matrix, etc..
> >
> > I tried the function plotEst like this:
> >
> > plotEst(ests,y = dim(ests)[1]:1, xlab="sensitivity", xtic=x1,
> > xlim=range(xtic))
> >
> > and got the Error:
> >
> > Error in strsplit(x, as.character(split), as.logical(extended),
> > as.logical(fixed),
> > :
> > non-character argument in strsplit()
> >
> > What am I missing?
>
> If you had a data.frame with columns, x, estimate, lcl and ucl, then
> you could use ggplot2 as follows:
>
> library(ggplot2)
> qplot(x, estimate, min=lcl, max=ucl, data=df, geom="pointrange")
>
> It's generally a good idea to store data in a data frame.
>
> Hadley
>
> --
> http://had.co.nz/
>


I have Another question: Can I add another line to the same plot with qplot?
(like function "lines" in "plot").
Thank You,
Sigalit.

[[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] Change the color and lines of the legend using bwplot

2008-02-19 Thread Tom Cohen
Dear list, 
   
  I have following plot, where I have set the color (red and green) and lines 
(lty=2:3) in the panel.groups but can't not figure out how change the lines and 
color of the legend in the "key" to the same lines and color as in the 
panel.groups.
   
  bwplot(means ~ age | scales , dat, panel = "panel.superpose",
   groups = sex,scales = list(x = list(rot = 45),cex=0.7,alternating=2),
   panel.groups = "panel.linejoin", lwd=1.2,lty=c(2:3),type="b",col=c
("red","green"),
   ylab = list(label = "mean value", cex = 0.8),
   xlab = list(label = "scales", cex = 0.8),
   key = list(lines = Rows(trellis.par.get("superpose.line"),c(1:2, 0)), 
cex=0.8,text = list(lab = as.character(unique(dat$sex))),
  columns = 2, title = " age sex",
  cex.title=0.9))

  Thanks for any help,
  Tom



   
-
Låna pengar utan säkerhet.

[[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] change NA values

2008-02-19 Thread Martin Elff
On Tuesday 19 February 2008 (12:33:21), Alfonso Pérez Rodríguez wrote:
> Hello, I'm sure that this question is too simple, but, I'm begining with R
> and I'm not able to change the NA values in a matrix by 0 values, and it's
> necessary for my work, how can I do It? Thank you.

your.matrix[is.na(your.matrix)] <- 0

Best,

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] qplot

2008-02-19 Thread sigalit mangut-leiba
Hello,
I have a question about "qplot": How can I add another line to the same
plot ?
(like function "lines" in "plot").
Thank You,
Sigalit.

[[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] qplot

2008-02-19 Thread ONKELINX, Thierry
Format your dataframe into a long format. Then use a grouping variable
to distinguish both lines.

library(ggplot2)
DF <- data.frame(X = rep(0:20, 2), Y = c(rnorm(21), runif(21)), Z =
gl(2, 21))
ggplot(data = DF, aes(x = X, y = Y, colour = Z)) + geom_line()

HTH,

Thierry

PS. I suggest you read the ggplot book at
http://had.co.nz/ggplot2/book.pdf



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

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

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Namens sigalit mangut-leiba
Verzonden: dinsdag 19 februari 2008 13:16
Aan: r-help
Onderwerp: [R] qplot

Hello,
I have a question about "qplot": How can I add another line to the same
plot ?
(like function "lines" in "plot").
Thank You,
Sigalit.

[[alternative HTML version deleted]]

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

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


Re: [R] How to join path with arguments

2008-02-19 Thread Henrique Dallazuanna
Try this:

name1 <- 'sample-plot'
filename <- sprintf("%s.png", name1)
inputdir <- '/path/to/dir'
paste(inputdir, filename, sep="")


On 19/02/2008, Hyunchul Kim <[EMAIL PROTECTED]> wrote:
> Hi, all
>
> How to format and join strings ?
> For example, like following short python examples.
>
> *
> name1 = 'sample-plot'
> filename = '%s.png' % name1
>
> inputdir = '/path/to/dir'
> os.path.join(inputdir, filename)
>
> **
>
> Best,
> Hyunchul Kim
>
> [[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.


[R] How to join path with arguments

2008-02-19 Thread Hyunchul Kim
Hi, all

How to format and join strings ?
For example, like following short python examples.

*
name1 = 'sample-plot'
filename = '%s.png' % name1

inputdir = '/path/to/dir'
os.path.join(inputdir, filename)

**

Best,
Hyunchul Kim

[[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] can we include nonparametric component for survival regression?

2008-02-19 Thread gallon li
I've figured it out by repeatedly testing. It is to use a type='term'
statement, just as used in gam.

sorry to bother.

On 2/19/08, gallon li <[EMAIL PROTECTED]> wrote:
>
> Thanks a lot, Prof Lumley.
>
> Now I can fit a model like
>
> coxfit=coxpy((time,censor)~pspline(x1)+x2+x3)
>
> but I am not sure how to extract the estimated function for x1 alone. I
> tried to use predict function but couldn't find appropriate option to do
> this.
>
> if i only have one covariates, then the example in help manule can be used
> as
> plot(x1, predict(coxfit))
>
> but with more than 1 predictor, i am not sure how to select the one i
> want.
>
>
>  On 2/19/08, Thomas Lumley <[EMAIL PROTECTED]> wrote:
> >
> > On Mon, 18 Feb 2008, gallon li wrote:
> >
> > > i am trying to fit a survival regression model (cox model or
> > parametric
> > > model) in R by including the covariate effects as a function m(x)
> > instead of
> > > just beta*x. is it possible to fit such a model? can someone recommend
> > some
> > > reference? I searched but only found a package called addreg where
> > > the hazard is actually modeled additively. That is not what i want.
> >
> > The survival package has pspline() for this purpose (assuming that by
> > 'non-parametric' you mean a flexible smooth curve)
> >
> >-thomas
> >
> > Thomas Lumley   Assoc. Professor, Biostatistics
> > [EMAIL PROTECTED]University of Washington, Seattle
> >
>
>

[[alternative HTML version deleted]]

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


Re: [R] How to join path with arguments

2008-02-19 Thread Andre Nathan


Hyunchul Kim wrote:
> How to format and join strings ?
> For example, like following short python examples.
>
> *
> name1 = 'sample-plot'
> filename = '%s.png' % name1

Two options are sprintf() and paste():

> name1 = "sample-plot"
> sprintf("%s.png", name1)
[1] "sample-plot.png"
> paste(name1, "png", sep = ".")
[1] "sample-plot.png"

HTH,
Andre

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


[R] change NA values

2008-02-19 Thread Alfonso Pérez Rodríguez
Hello, I'm sure that this question is too simple, but, I'm begining with R and 
I'm not able to change the NA values in a matrix by 0 values, and it's 
necessary for my work, how can I do It? Thank you.




Alfonso Pérez Rodríguez
Instituto de Investigaciones Marinas
C/ Eduardo Cabello nº 6 
C.P. 36208 Vigo (España)
Tlf.- 986231930 Extensión 241
e-mail: [EMAIL PROTECTED]
[[alternative HTML version deleted]]

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


Re: [R] How to join path with arguments

2008-02-19 Thread Henrique Dallazuanna
Ops,
paste(inputdir, filename, sep="") should be paste(inputdir, filename, sep="/")

On 19/02/2008, Henrique Dallazuanna <[EMAIL PROTECTED]> wrote:
> Try this:
>
> name1 <- 'sample-plot'
> filename <- sprintf("%s.png", name1)
> inputdir <- '/path/to/dir'
> paste(inputdir, filename, sep="")
>
>
> On 19/02/2008, Hyunchul Kim <[EMAIL PROTECTED]> wrote:
> > Hi, all
> >
> > How to format and join strings ?
> > For example, like following short python examples.
> >
> > *
> > name1 = 'sample-plot'
> > filename = '%s.png' % name1
> >
> > inputdir = '/path/to/dir'
> > os.path.join(inputdir, filename)
> >
> > **
> >
> > Best,
> > Hyunchul Kim
> >
> > [[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
>


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

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


[R] regression with error in predictor

2008-02-19 Thread Irene Mantzouni
Hi all!

 

I am trying to run a regression where the predictor values are not real
data but each is estimated from a different model. So, for each value I
have a mean and variance. 

Which package/function should I use in this case? 

 

Thank you! 

 

Irene


[[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] change NA values

2008-02-19 Thread Gabor Csardi
?RSiteSeach is useful. It gives you this:

http://tolstoy.newcastle.edu.au/R/e2/help/07/09/25536.html

and then keep clicking on "Next in thread".

Gabor

On Tue, Feb 19, 2008 at 12:33:21PM +0100, Alfonso Pérez Rodríguez wrote:
> Hello, I'm sure that this question is too simple, but, I'm begining with R 
> and I'm not able to change the NA values in a matrix by 0 values, and it's 
> necessary for my work, how can I do It? Thank you.
> 
> 
> 
> 
> Alfonso P?rez Rodr?guez
> Instituto de Investigaciones Marinas
> C/ Eduardo Cabello n? 6 
> C.P. 36208 Vigo (Espa?a)
> Tlf.- 986231930 Extensi?n 241
> e-mail: [EMAIL PROTECTED]
>   [[alternative HTML version deleted]]
> 

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


-- 
Csardi Gabor <[EMAIL PROTECTED]>UNIL DGM

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


Re: [R] can we include nonparametric component for survival regression?

2008-02-19 Thread gallon li
Thanks a lot, Prof Lumley.

Now I can fit a model like

coxfit=coxpy((time,censor)~pspline(x1)+x2+x3)

but I am not sure how to extract the estimated function for x1 alone. I
tried to use predict function but couldn't find appropriate option to do
this.

if i only have one covariates, then the example in help manule can be used
as
plot(x1, predict(coxfit))

but with more than 1 predictor, i am not sure how to select the one i want.


On 2/19/08, Thomas Lumley <[EMAIL PROTECTED]> wrote:
>
> On Mon, 18 Feb 2008, gallon li wrote:
>
> > i am trying to fit a survival regression model (cox model or parametric
> > model) in R by including the covariate effects as a function m(x)
> instead of
> > just beta*x. is it possible to fit such a model? can someone recommend
> some
> > reference? I searched but only found a package called addreg where
> > the hazard is actually modeled additively. That is not what i want.
>
> The survival package has pspline() for this purpose (assuming that by
> 'non-parametric' you mean a flexible smooth curve)
>
>-thomas
>
> Thomas Lumley   Assoc. Professor, Biostatistics
> [EMAIL PROTECTED]University of Washington, Seattle
>

[[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] agglomerative algorithm

2008-02-19 Thread giovanni bacaro
Dear list members,

I have a series of plots individuated by coordinates like this:

 

X Y  plot

0 1  001

0 2  002

..

8 8  064

 

Starting from a random selected plot, I'd like to obtain all the possible
combinations of the nearest plots, all the combination of the two nearest
plots and so on, up to all combination of the nearest eight plots. Have you
any idea if an R package exists to do this?

Thank you 

Giovanni

 


[[alternative HTML version deleted]]

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


Re: [R] question on function arguments

2008-02-19 Thread Duncan Murdoch
On 18/02/2008 4:53 AM, baptiste Auguié wrote:
> Hi,
> 
> I have two small issues with my R code, no big deal but curiosity  
> really. Here is a sample code,
> 
> 
>> x <- rnorm(1:10)
>>
>> foo <- function(a = 1, b = list(x = c(1:10), y = c(1:10))){
>>  
>>  for (ii in seq(along=b$y)){
>>  
>>  print(x[ii] + b$x[ii])
>>  }
>>  
>>  
>> }
>>
>> foo() # default OK
>>
>> foo(b=list(x=1, y=c(1:10))) # only the first term works
>>
>> foo(b$y = 1:5) # error
>>
> 
> In the last call, i wish to use all default arguments but b$y (that  
> is, using the default a and b$x). Is this possible?

No, arguments are a simple list where you use the defaults or you don't. 
  You can't treat them as a hierarchical structure.
> 
> The second call is more related to indices: i would like my argument b 
> $x to be either a vector (default), or a scalar. In the latter, the  
> loop b$x[ii] breaks when i would like it to recycle the single value.  
> I can check the length of b$x with a "if" statement, but it becomes  
> intricate when several arguments have this option of being vector or  
> scalar. Is there a way to use b$x that would work in both cases?

The normal way to do this is to standardize the length of the object 
early in the function, e.g.

  len <- max(length(b$y), length(b$x))
  b$y <- rep(b$y, length=len)
  b$x <- rep(b$x, length=len)

Another way (which is the way used internally in the C implementation) 
is to compute an index using the recycling rules, but that's probably 
not efficient in R code, e.g. you'd need

b$x[ (ii - 1) %% length(b$x) + 1 ]

in place of b$x[ii] (and this solution is not general; it doesn't handle 
zero or negative indices properly).

Duncan Murdoch
> 
> 
> Many thanks,
> 
> baptiste
> 
> _
> 
> Baptiste Auguié
> 
> Physics Department
> University of Exeter
> Stocker Road,
> Exeter, Devon,
> EX4 4QL, UK
> 
> Phone: +44 1392 264187
> 
> http://newton.ex.ac.uk/research/emag
> http://projects.ex.ac.uk/atto
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] plotDensity

2008-02-19 Thread laptopcss
Hallo,

I have a question to plotDensity and do not understand what stand behind. In a 
density plot the x-axis is the signal intensity but for what stands than 
density on the y-axis? Here I have the values 0.00-0.30 Can anyone discribe it 
by his own words? I do not understand the help.

Thanks, Conny
--

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] repeated measures ANOVA using a cov matrix

2008-02-19 Thread sun71 sun
Dear all,
how can I perform a repeated measures ANOVA using a covariance matrix as input?
E.g., I have four repeated measures (N = 200) with mean vector tau (no
BS factor):

tau <- rbind(1.10, 2.51, 2.76, 3.52)

and covariance matrix (sigma):

sigma <- matrix(c(0.523, 0.268, 0.267, 0.211,
  0.268, 0.444, 0.492, 0.571,
  0.267, 0.492, 1.213, 1.112,
  0.211, 0.571, 1.112, 1.811), nrow = 4, ncol
= 4, byrow = TRUE)

Thank you very much in advance!

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] good references on "survival analysis"

2008-02-19 Thread Marc Bernard
Dear all,
   
  I am looking for a good reference on "Survival analysis". I am looking for a 
booking containing both applications and Maths. Explaining different methods in 
survival analysis 
   
  Many thanks
   
   
  Bernard
   
   

   
-

[[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] repeated measures ANOVA using a cov matrix

2008-02-19 Thread Peter Dalgaard
sun71 sun wrote:
> Dear all,
> how can I perform a repeated measures ANOVA using a covariance matrix as 
> input?
> E.g., I have four repeated measures (N = 200) with mean vector tau (no
> BS factor):
>
> tau <- rbind(1.10, 2.51, 2.76, 3.52)
>
> and covariance matrix (sigma):
>
> sigma <- matrix(c(0.523, 0.268, 0.267, 0.211,
>   0.268, 0.444, 0.492, 0.571,
>   0.267, 0.492, 1.213, 1.112,
>   0.211, 0.571, 1.112, 1.811), nrow = 4, ncol
> = 4, byrow = TRUE)
>
> Thank you very much in advance!
>
>   
(Please either include new information or wait a little longer for 
someone to react. Reposting after just over a day is a bit like pulling 
on peoples sleeves. And of course you always have the risk that nobody 
has anything to say.)

Your main problem is that few of the standard methods in R allow you to 
come in with pre-aggregated data. So either you have to do it yourself 
using matrix calculus - this is not massively hard if you know what you 
are doing - or you need to fake the raw data and take it from there.

The following generates X2 with variance exactly equal to sigma.  I'm 
sure you can figure out how to get the means right as well.

X <- matrix(rnorm(4*200),200)
X2 <- X %*% solve(chol(var(X))) %*% chol(sigma)

 > var(X2)
  [,1]  [,2]  [,3]  [,4]
[1,] 0.523 0.268 0.267 0.211
[2,] 0.268 0.444 0.492 0.571
[3,] 0.267 0.492 1.213 1.112
[4,] 0.211 0.571 1.112 1.811

(This must be doable with backsolve() too, but the proper incantation 
eludes me just now.)

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


-- 
   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] How to change the axis labels of a wind rose plot?

2008-02-19 Thread Jim Lemon
Huilin Chen wrote:
> Dear all,
> 
> I am make plots using the function windrose() from the package "circular".
> I would like to have the north on the top instead of having 0 degree on 
> the right side.
> Does anybody know how to change the labels in a windrose plot?
> 
> 
Hi Huilin,
As it happens, the Australian BoM uses that orientation, so you could 
try oz.windrose in the plotrix package

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.


Re: [R] R graphics question: "binary" bar chart

2008-02-19 Thread Jim Lemon
Stephan Spat wrote:
> Hello!
> 
> I would like to visualize the hospitalization within one year of several
> patients using a bar chart. For each patient the stay in a hospital
> should be illustrated with a dark colour a if there is a stay at home
> between 2 hopital stays, it should be illustrated with a bright colour.
> 
> e.g.
> 
> P1   |//|  |///| ||
> P2 |//|
> P3  |//|   ||   |///||//|
> Day1Day100-Day365
> 
> 
> legend:
> Px Patient with id x
> |///|Hospital stay (length of bar symbolizes length of stay)
>   Place between 2 hospital stays symbolizes stay at home
>(not in hospital)
> 
> Are there any package which can do that? If not, how can I implement
> this in R?
Hi Stephan,
This looks very much like a Gantt chart with multiple time slots for 
each "task" (hospital stay). I've roughly programmed a function to do 
this, and I'll see if I can finish it off and send you a copy tomorrow.

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.


Re: [R] How to join path with arguments

2008-02-19 Thread Prof Brian Ripley

Please just use file.path(inputdir, filename).

Apart from being less error-prone, in R 2.7.0 it will be internal and so 
faster (and in case you wonder how paste could be too slow, it was in some 
of the package installation/checking computations).


On Tue, 19 Feb 2008, Henrique Dallazuanna wrote:


Ops,
paste(inputdir, filename, sep="") should be paste(inputdir, filename, sep="/")

On 19/02/2008, Henrique Dallazuanna <[EMAIL PROTECTED]> wrote:

Try this:

name1 <- 'sample-plot'
filename <- sprintf("%s.png", name1)
inputdir <- '/path/to/dir'
paste(inputdir, filename, sep="")


On 19/02/2008, Hyunchul Kim <[EMAIL PROTECTED]> wrote:

Hi, all

How to format and join strings ?
For example, like following short python examples.

*
name1 = 'sample-plot'
filename = '%s.png' % name1

inputdir = '/path/to/dir'
os.path.join(inputdir, filename)

**

Best,
Hyunchul Kim

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




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



--
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] Calculating Distance Metrics using Euclidean

2008-02-19 Thread Prof Brian Ripley
On Tue, 19 Feb 2008, Keizer_71 wrote:

>
> I am trying to calculate the distance metrics, but i keep getting this error.
> I am very new to R. Am i doing something wrong.

Cross-posting: see the thread at

https://stat.ethz.ch/pipermail/r-devel/2008-February/048452.html

where your question has already been answered.

>
>
>> dim(data.sub)
> [1] 1   140
>
>> dist(data.sub, method = "euclidean", diag = FALSE, upper = FALSE, p = 2)
> Error: cannot allocate vector of size 781250 Kb
> In addition: Warning messages:
> 1: Reached total allocation of 1014Mb: see help(memory.size)
> 2: Reached total allocation of 1014Mb: see help(memory.size)
> --
> View this message in context: 
> http://www.nabble.com/Calculating-Distance-Metrics-using-Euclidean-tp15560521p15560521.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.


Re: [R] qplot

2008-02-19 Thread Vikas Rawal

> Format your dataframe into a long format. Then use a grouping variable
> to distinguish both lines.
> 
> library(ggplot2)
> DF <- data.frame(X = rep(0:20, 2), Y = c(rnorm(21), runif(21)), Z =
> gl(2, 21))
> ggplot(data = DF, aes(x = X, y = Y, colour = Z)) + geom_line()

You can also use ggplot and then add layers for each geom_line that
you want to add.

Vikas

>

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

2008-02-19 Thread jim holtman
I have no idea what "numbers form the RAD7 machine" look like, but
there is a whole section on importing data in the user manual.
'read.table' is a start.

To change directories, use 'setwd'.  To start a new R session on
Windows, just setup a shortcut to RGUI.exe.  Most of this is covered
in the documentation that comes with R.

On 2/19/08, Rthoughts <[EMAIL PROTECTED]> wrote:
>
> Hello, I need to learn to use r-software for my PhD research project
> involving long timelines of radon radiation variations.
>
> I am using windows.
>
> I am currently discouraged by the use of r. I cannot figure out how to use
> it despite extensive searches. Can anyone help me with getting started? How
> can import a txt file with series of numbers from the RAD7 machine? How can
> I open up and set directories with the imported file or to start a new r
> session?
>
> Thank you so much if you can help.
> --
> View this message in context: 
> http://www.nabble.com/Getting-started-help-tp15560581p15560581.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


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

What is the problem you are trying to solve?

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


[R] Getting started help

2008-02-19 Thread Rthoughts

Hello, I need to learn to use r-software for my PhD research project
involving long timelines of radon radiation variations.

I am using windows.

I am currently discouraged by the use of r. I cannot figure out how to use
it despite extensive searches. Can anyone help me with getting started? How
can import a txt file with series of numbers from the RAD7 machine? How can
I open up and set directories with the imported file or to start a new r
session?

Thank you so much if you can help.
-- 
View this message in context: 
http://www.nabble.com/Getting-started-help-tp15560581p15560581.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] Two bwplots in one single graph

2008-02-19 Thread Tom Cohen
Dear list,
   
  With the below codes, I got 8 bwplots but I would like to put 2 bwplots in 
one single graph so that instead of 8 separate bwplots I would have 4 graphs, 
each contains 2 bwplots.  How can I do that?
   
  Another question is how do I add the mean as a point to each boxplot in the 
bwplot but also keeping the median line.
   
  for (i in 1:length(dat)){ 
windows()
with(dat[[i]], print(bwplot(value  ~ time | sex + age , scales = list(x = 
list(rot = 45)),
 ylab = list(label = paste(sname[i],"-value",sep=""), cex = 0.8),
 xaxis = list(cex = 0.6),
panel = function(x, y){panel.bwplot(x, y, pch 
= '|',horiz=F,stats = boxplot.stats, fill = "khaki2", varwidth = T)}))) 
 }

  Thanks, 
  Tom

   
-
Sök efter kärleken! 

[[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] Building a package and Depends search

2008-02-19 Thread john seers (IFR)
 

Hello R experts

I am just learning how to build a package so this is probably a basic
question. I have read the manual( well, to be more truthful, am reading)
the manual, and I have searched the archives to the best of my ability.
I am on Windows.

When running the command "R CMD check packagename" I get this type of
error:

* checking package dependencies ... ERROR
Packages required but not available:
  chron

I think this is because I install my packages in "mylibrary" and use
"R_LIBS=C:/PROGRA~1/R/mylibrary" in my Renviron.site file. If I move the
package to the R main library it fixes the problem. But rather defeats
the intention behind having a separate mylibrary.

Can anybody tell me how to solve this? That is keep my installed
packages in mylibrary but get the package check/build to work? I guess
Depends: has a search path but I cannot find it or how to alter it. Can
anybody point me to some documentation?

Thanks very much for any help.


Regards


John Seers





 
> sessionInfo()
R version 2.6.2 (2008-02-08) 
i386-pc-mingw32 

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

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


other attached packages:
[1] chron_2.3-20  limma_2.12.0  RWinEdt_1.7-9
> 





 
---

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


Re: [R] Getting started help

2008-02-19 Thread ONKELINX, Thierry

If someone told you to learn R, then there must a local R guru in your
neighbourhood. Therefore I would suggest that you consult this person
first. Reading an introduction into R will help you too (e.g. Peter
Dalgaard. Introductory Statistics with R. Springer, 2002. ISBN
0-387-95475-9)

HTH,

Thierry


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

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

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Namens Rthoughts
Verzonden: dinsdag 19 februari 2008 13:54
Aan: r-help@r-project.org
Onderwerp: [R] Getting started help


Hello, I need to learn to use r-software for my PhD research project
involving long timelines of radon radiation variations.

I am using windows.

I am currently discouraged by the use of r. I cannot figure out how to
use
it despite extensive searches. Can anyone help me with getting started?
How
can import a txt file with series of numbers from the RAD7 machine? How
can
I open up and set directories with the imported file or to start a new r
session?

Thank you so much if you can help.
-- 
View this message in context:
http://www.nabble.com/Getting-started-help-tp15560581p15560581.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] plotDensity

2008-02-19 Thread Henrik Bengtsson
Is 'plotDensity' a specific function you are referring to?  If so, in
which package?  Then we can give a straight answer...

/Henrik

On Feb 19, 2008 4:10 AM,  <[EMAIL PROTECTED]> wrote:
> Hallo,
>
> I have a question to plotDensity and do not understand what stand behind. In 
> a density plot the x-axis is the signal intensity but for what stands than 
> density on the y-axis? Here I have the values 0.00-0.30 Can anyone discribe 
> it by his own words? I do not understand the help.
>
> Thanks, Conny
> --
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Building a package and Depends search

2008-02-19 Thread Gabor Csardi
I think you need "-l":

R CMD check -l  

Gabor

On Tue, Feb 19, 2008 at 02:00:38PM -, john seers (IFR) wrote:
[...]
> I think this is because I install my packages in "mylibrary" and use
> "R_LIBS=C:/PROGRA~1/R/mylibrary" in my Renviron.site file. If I move the
> package to the R main library it fixes the problem. But rather defeats
> the intention behind having a separate mylibrary.
> 
> Can anybody tell me how to solve this? That is keep my installed
> packages in mylibrary but get the package check/build to work? I guess
> Depends: has a search path but I cannot find it or how to alter it. Can
> anybody point me to some documentation?
[...]

-- 
Csardi Gabor <[EMAIL PROTECTED]>UNIL DGM

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


Re: [R] Building a package and Depends search

2008-02-19 Thread Prof Brian Ripley
On Tue, 19 Feb 2008, john seers (IFR) wrote:

>
>
> Hello R experts
>
> I am just learning how to build a package so this is probably a basic
> question. I have read the manual( well, to be more truthful, am reading)
> the manual, and I have searched the archives to the best of my ability.

You could have searched for R_LIBS in the manual (see below).

> I am on Windows.
>
> When running the command "R CMD check packagename" I get this type of
> error:
>
> * checking package dependencies ... ERROR
> Packages required but not available:
>  chron
>
> I think this is because I install my packages in "mylibrary" and use
> "R_LIBS=C:/PROGRA~1/R/mylibrary" in my Renviron.site file. If I move the
> package to the R main library it fixes the problem. But rather defeats
> the intention behind having a separate mylibrary.
>
> Can anybody tell me how to solve this? That is keep my installed
> packages in mylibrary but get the package check/build to work? I guess
> Depends: has a search path but I cannot find it or how to alter it. Can
> anybody point me to some documentation?

Set the environment variable R_LIBS in your commands windows/shell.
As the manual says:

   @quotation Note
   @code{R CMD check} and @code{R CMD build} run @R{} with
   @option{--vanilla}, so none of the user's startup files are read.  If
   you need @env{R_LIBS} set (to find packages in a non-standard library)
   you will need to set it in the environment.
   @end quotation


>
> Thanks very much for any help.
>
>
> Regards
>
>
> John Seers
>
>
>
>
>
>
>> sessionInfo()
> R version 2.6.2 (2008-02-08)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
> Kingdom.1252;LC_MONETARY=English_United
> Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252
>
> attached base packages:
> [1] stats graphics  grDevices datasets  utils methods   base
>
>
> other attached packages:
> [1] chron_2.3-20  limma_2.12.0  RWinEdt_1.7-9
>>
>
>
>
>
>
>
> ---
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


[R] fitted values are different from manually calculating

2008-02-19 Thread gatemaze
Hello,

on a simple linear model the values produced from the fitted(model) function
are difference from manually calculating on calc. Will anyone have a clue...
or any insights on how fitted function calculates the values? Thank you.

-- 
-- Yianni

[[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] Getting started help

2008-02-19 Thread Donatas G.
I have been asking these same questions here on this list half a year before. 
You will probably find what you need by following this link and the 
subsequent discussion:

https://stat.ethz.ch/pipermail/r-help/2007-July/136162.html

Donatas

On Tuesday 19 February 2008 15:14:19 jim holtman rašė:
> I have no idea what "numbers form the RAD7 machine" look like, but
> there is a whole section on importing data in the user manual.
> 'read.table' is a start.
>
> To change directories, use 'setwd'.  To start a new R session on
> Windows, just setup a shortcut to RGUI.exe.  Most of this is covered
> in the documentation that comes with R.
>
> On 2/19/08, Rthoughts <[EMAIL PROTECTED]> wrote:
> > Hello, I need to learn to use r-software for my PhD research project
> > involving long timelines of radon radiation variations.
> >
> > I am using windows.
> >
> > I am currently discouraged by the use of r. I cannot figure out how to
> > use it despite extensive searches. Can anyone help me with getting
> > started? How can import a txt file with series of numbers from the RAD7
> > machine? How can I open up and set directories with the imported file or
> > to start a new r session?
> >
> > Thank you so much if you can help.
> > --
> > View this message in context:
> > http://www.nabble.com/Getting-started-help-tp15560581p15560581.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.



-- 
Donatas Glodenis
http://dg.lapas.info

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

2008-02-19 Thread Donatas G.
I have found several resources very helpful:

http://cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf

http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/Getting-Started-with-the-Rcmdr.pdf

Donatas


On Tuesday 19 February 2008 15:14:19 jim holtman rašė:
> I have no idea what "numbers form the RAD7 machine" look like, but
> there is a whole section on importing data in the user manual.
> 'read.table' is a start.
>
> To change directories, use 'setwd'.  To start a new R session on
> Windows, just setup a shortcut to RGUI.exe.  Most of this is covered
> in the documentation that comes with R.
>
> On 2/19/08, Rthoughts <[EMAIL PROTECTED]> wrote:
> > Hello, I need to learn to use r-software for my PhD research project
> > involving long timelines of radon radiation variations.
> >
> > I am using windows.
> >
> > I am currently discouraged by the use of r. I cannot figure out how to
> > use it despite extensive searches. Can anyone help me with getting
> > started? How can import a txt file with series of numbers from the RAD7
> > machine? How can I open up and set directories with the imported file or
> > to start a new r session?
> >
> > Thank you so much if you can help.
> > --
> > View this message in context:
> > http://www.nabble.com/Getting-started-help-tp15560581p15560581.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.



-- 
Donatas Glodenis
http://dg.lapas.info

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


Re: [R] question on function arguments

2008-02-19 Thread baptiste Auguié
Many thanks, this clarifies both points perfectly.

baptiste



On 19 Feb 2008, at 11:48, Duncan Murdoch wrote:

> On 18/02/2008 4:53 AM, baptiste Auguié wrote:
>> Hi,
>> I have two small issues with my R code, no big deal but curiosity   
>> really. Here is a sample code,
>>> x <- rnorm(1:10)
>>>
>>> foo <- function(a = 1, b = list(x = c(1:10), y = c(1:10))){
>>> 
>>> for (ii in seq(along=b$y)){
>>> 
>>> print(x[ii] + b$x[ii])
>>> }
>>> 
>>> 
>>> }
>>>
>>> foo() # default OK
>>>
>>> foo(b=list(x=1, y=c(1:10))) # only the first term works
>>>
>>> foo(b$y = 1:5) # error
>>>
>> In the last call, i wish to use all default arguments but b$y  
>> (that  is, using the default a and b$x). Is this possible?
>
> No, arguments are a simple list where you use the defaults or you  
> don't.  You can't treat them as a hierarchical structure.
>> The second call is more related to indices: i would like my  
>> argument b $x to be either a vector (default), or a scalar. In the  
>> latter, the  loop b$x[ii] breaks when i would like it to recycle  
>> the single value.  I can check the length of b$x with a "if"  
>> statement, but it becomes  intricate when several arguments have  
>> this option of being vector or  scalar. Is there a way to use b$x  
>> that would work in both cases?
>
> The normal way to do this is to standardize the length of the  
> object early in the function, e.g.
>
>  len <- max(length(b$y), length(b$x))
>  b$y <- rep(b$y, length=len)
>  b$x <- rep(b$x, length=len)
>
> Another way (which is the way used internally in the C  
> implementation) is to compute an index using the recycling rules,  
> but that's probably not efficient in R code, e.g. you'd need
>
> b$x[ (ii - 1) %% length(b$x) + 1 ]
>
> in place of b$x[ii] (and this solution is not general; it doesn't  
> handle zero or negative indices properly).
>
> Duncan Murdoch
>> Many thanks,
>> baptiste
>> _
>> Baptiste Auguié
>> Physics Department
>> University of Exeter
>> Stocker Road,
>> Exeter, Devon,
>> EX4 4QL, UK
>> Phone: +44 1392 264187
>> http://newton.ex.ac.uk/research/emag
>> http://projects.ex.ac.uk/atto
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting- 
>> guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>

_

Baptiste Auguié

Physics Department
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag
http://projects.ex.ac.uk/atto

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] repeated measures ANOVA using a cov matrix

2008-02-19 Thread sun71 sun
Peter,

thank you - that was helpful!!!
I know, there is a more elegant way of doing it, but

N <- 200
dat <- as.data.frame(X2)
m <- tau - mean(dat)
tau_sim <- cbind(rep(m[1,],N), rep(m[2,],N), rep(m[3,],N), rep(m[4,], N))
mat <- X2+tau_sim
data <- as.data.frame(mat)
mean(data)

should give me the correct means...

(I got a rebounce notice on my original message and after I did not
see it go through for a day, I decided to repost it. Did not mean to
tear on peoples sleeves - my apologies!)



On 2/19/08, Peter Dalgaard <[EMAIL PROTECTED]> wrote:
> sun71 sun wrote:
> > Dear all,
> > how can I perform a repeated measures ANOVA using a covariance matrix as 
> > input?
> > E.g., I have four repeated measures (N = 200) with mean vector tau (no
> > BS factor):
> >
> > tau <- rbind(1.10, 2.51, 2.76, 3.52)
> >
> > and covariance matrix (sigma):
> >
> > sigma <- matrix(c(0.523, 0.268, 0.267, 0.211,
> >   0.268, 0.444, 0.492, 0.571,
> >   0.267, 0.492, 1.213, 1.112,
> >   0.211, 0.571, 1.112, 1.811), nrow = 4, ncol
> > = 4, byrow = TRUE)
> >
> > Thank you very much in advance!
> >
> >
> (Please either include new information or wait a little longer for
> someone to react. Reposting after just over a day is a bit like pulling
> on peoples sleeves. And of course you always have the risk that nobody
> has anything to say.)
>
> Your main problem is that few of the standard methods in R allow you to
> come in with pre-aggregated data. So either you have to do it yourself
> using matrix calculus - this is not massively hard if you know what you
> are doing - or you need to fake the raw data and take it from there.
>
> The following generates X2 with variance exactly equal to sigma.  I'm
> sure you can figure out how to get the means right as well.
>
> X <- matrix(rnorm(4*200),200)
> X2 <- X %*% solve(chol(var(X))) %*% chol(sigma)
>
>  > var(X2)
>  [,1]  [,2]  [,3]  [,4]
> [1,] 0.523 0.268 0.267 0.211
> [2,] 0.268 0.444 0.492 0.571
> [3,] 0.267 0.492 1.213 1.112
> [4,] 0.211 0.571 1.112 1.811
>
> (This must be doable with backsolve() too, but the proper incantation
> eludes me just now.)
>
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
> --
>   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] Compare mean survival time

2008-02-19 Thread Roland Rau
Hi,

Xing Yuan wrote:
> Dear List,
> 
> Does anybody no how to compare mean survival times for two (more) groups in
> R? What test statistics should I use?


my answer is less of an R answer than a literature answer:
John P. Klein and Melvin L. Moeschberger devote section 4.5 in their 
book "Survival Analysis" (Springer, starting on page 117 in the 2nd 
edition) to the topic: "Point and Interval Estimates of the Mean and 
Median Survival Time".

I hope this helps,
Roland

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] fitted values are different from manually calculating

2008-02-19 Thread Douglas Bates
On Feb 19, 2008 8:41 AM,  <[EMAIL PROTECTED]> wrote

> on a simple linear model the values produced from the fitted(model) function
> are difference from manually calculating on calc. Will anyone have a clue...
> or any insights on how fitted function calculates the values? Thank you.

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

As the posting guide (you did read the posting guide, didn't you?)
says, it helps if you can provide a reproducible example.   Otherwise,
we can only guess at what you mean.

Try taking a fitted model and examining

model.matrix(model)

and

coef(model)

It should be the case that

model.matrix(model) %*% coef(model)

is reasonably close to fitted(model).

I just saw that Dimitris wrote almost the same thing but, since I have
written it, I'll mail it anyway.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] fitted values are different from manually calculating

2008-02-19 Thread Dimitris Rizopoulos
why do you say this? Check for instance the following code:

x1 <- runif(100, -5, 5)
x2 <- rnorm(100)
x3 <- rep(0:1, each = 50)
y <- 2 + 0.5 * x1 + 2 * x2 - 3 * x3 + rnorm(100)

fit <- lm(y ~ x1 + x2 + x3)

all.equal(
as.vector(fitted(fit)),
as.vector(model.matrix(fit) %*% coef(fit))
)


I hope it helps.

Best,
Dimitris


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm


- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 19, 2008 3:41 PM
Subject: [R] fitted values are different from manually calculating


> Hello,
>
> on a simple linear model the values produced from the fitted(model) 
> function
> are difference from manually calculating on calc. Will anyone have a 
> clue...
> or any insights on how fitted function calculates the values? Thank 
> you.
>
> -- 
> -- Yianni
>
> [[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.
> 


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

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


Re: [R] simple usage of "for"

2008-02-19 Thread K. Elo
Hi,

Hans Ekbrand wrote (19.2.2008):
> I tried the following small code snippet which I copied from the
>
> "Introduction to R":
> > for (i in 2:length(meriter)) { table(meriter[[1]], meriter[[i]]) }

Try:
for (i in 2:length(meriter)) { print(table(meriter[[1]], 
meriter[[i]])) }

Kind regards,
Kimmo

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


Re: [R] simple usage of "for"

2008-02-19 Thread Hans Ekbrand
On Tue, Feb 19, 2008 at 04:52:19PM +0200, K. Elo wrote:
> Hi,
> 
> Hans Ekbrand wrote (19.2.2008):
> > I tried the following small code snippet which I copied from the
> >
> > "Introduction to R":
> > > for (i in 2:length(meriter)) { table(meriter[[1]], meriter[[i]]) }
> 
> Try:
> for (i in 2:length(meriter)) { print(table(meriter[[1]], 
> meriter[[i]])) }

It works, thanks!

--
Hans Ekbrand


signature.asc
Description: Digital 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] simple usage of "for"

2008-02-19 Thread Hans Ekbrand
On Tue, Feb 19, 2008 at 10:04:13AM -0500, Duncan Murdoch wrote:
> On 2/19/2008 9:24 AM, Hans Ekbrand wrote:

[...]

> > I tried the following small code snippet which I copied from the
> > "Introduction to R":
> > 
> >> for (i in 2:length(meriter)) { table(meriter[[1]], meriter[[i]]) }
> 
> Where did you find that?  I don't see anything like it.  (If there is 
> something like that, it should be fixed.)
>
> If you are referring to this snippet:
> 
>  >for (i in 1:length(yc)){
>  plot(xc [[i ]],yc [[i ]]);
>  abline(lsfit(xc [[i ]],yc [[i ]]))
> }

Yes, I copied the for construct from that snippet.

> then it has the important difference that plot() and abline() both have 
> side effects (they do plotting), whereas table() doesn't.

I see. Thanks for the explanation.

-- 
Hans Ekbrand


signature.asc
Description: Digital 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.


[R] create library for own datasets

2008-02-19 Thread Birgit Lemcke
I am using the recent R version on a G4 PowerBook with Mac OS X 10.4.11.

I have a bunch of datasets that I would like to put all together in a  
R library, so that I only have to type:
>library("name")
and all datasets are loaded. Is this like building a package or is  
there an easier way to do that?

Thanks in advance for your help.

B.

Birgit Lemcke
Institut für Systematische Botanik
Zollikerstrasse 107
CH-8008 Zürich
Switzerland
Ph: +41 (0)44 634 8351
[EMAIL PROTECTED]

175 Jahre UZH
«staunen.erleben.begreifen. Naturwissenschaft zum Anfassen.»
MNF-Jubiläumsevent für gross und klein.
19. April 2008, 10.00 Uhr bis 02.00 Uhr
Campus Irchel, Winterthurerstrasse 190, 8057 Zürich
Weitere Informationen www.175jahre.uzh.ch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Which package to install?

2008-02-19 Thread ewan
Hi,

I'm wanting to install R onto my webspace.  My ISP uses CentOS release 4.6
and I'd like to know which one of the available R packages for Linux would
be appropriate.

Thanks.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] nlsList - Error in !unlist(lapply(coefs, is.null))

2008-02-19 Thread Marc Belisle
Howdee,

I am able to fit a 4-parameter logistic growth curve to a dataset which
comprise many individuals (using R v. 2.3.1). Yet, if I want to obtain the
parameters for each individual (i.e., for each 'id') using nlsList, then I
obtain an Error message which I have trouble interpreting. Any advice as to
how I can solve this problem?

Thanks for your time,

Marc


> reg <-nls(mass ~ SSfpl(age, A, B, xmid, scal),
+   na.action=na.omit,
+   data=data)
> summary(reg)

Formula: mass ~ SSfpl(age, A, B, xmid, scal)

Parameters:
 Estimate Std. Error t value Pr(>|t|)
A 1.428950.24472   5.839 5.43e-09 ***
B21.715080.06551 331.495  < 2e-16 ***
xmid  5.935630.05773 102.821  < 2e-16 ***
scal  1.922780.04334  44.369  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.715 on 9039 degrees of freedom

> coef(reg)
A B  xmid  scal
 1.428954 21.715081  5.935634  1.922779


> reg <-nlsList(mass ~ SSfpl(age, A, B, xmid, scal)|id,
+   na.action=na.omit,
+   data=data)
> reg
Call:
  Model: mass ~ SSfpl(age, A, B, xmid, scal) | id
   Data: data

Coefficients:
Error in !unlist(lapply(coefs, is.null)) :
incorrect type of argument

===
Marc Bélisle
Professeur adjoint
Chaire de recherche du Canada en écologie spatiale et en écologie du paysage
Département de biologie
Université de Sherbrooke
2500 Boul. de l'Université
Sherbrooke, Québec
J1K 2R1 Canada

Tél: +1-819-821-8000 poste 61313
Fax: +1-819-821-8049
Courriél: [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.


[R] Van't Veer paper on breast cancer

2008-02-19 Thread Eleni Christodoulou
Hello all,

I am working at the FORTH institute in Crete and it's been a long now that I
am trying to reproduce the results of the paper :
"Gene expression profiling predits clinical outcome of breast cancer", by
Van't Veer et al. It has been published in NATURE, vol 415,
31 January 2002.
http://www.nature.com/nature/journal/v415/n6871/full/415530a.html
I am facing some difficulties in building the classifier and I was wondering
if someone else has worked on it and could give me some help.

Thank you all,
Eleni

[[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] Getting started help

2008-02-19 Thread Mark Difford

Hi Rthoughts,

>> I am currently discouraged by the use of r. I cannot figure out how to
>> use it despite
>> extensive searches. Can anyone help me with getting started? How can
>> import 
>> a txt file with series...

There are piles of documents that you could (and should) read.  I am
surprised that you haven't found them in your extensive searches.  To set
your thoughts free, go here:

http://www.r-project.org/
http://cran.r-project.org/manuals.html## read the first one, and
whatever else you need

Then click on CRAN, and choose a mirror site (nearby), say:
http://cran.za.r-project.org/

Then go:
http://cran.za.r-project.org/other-docs.html

and start at the top.

HTH,
Mark.

PS: It might help you in your future enquiries if you used a real name, and
if you called R R rather than r (since your keyboard clearly doesn't have a
broken R ;).



Rthoughts wrote:
> 
> Hello, I need to learn to use r-software for my PhD research project
> involving long timelines of radon radiation variations.
> 
> I am using windows.
> 
> I am currently discouraged by the use of r. I cannot figure out how to use
> it despite extensive searches. Can anyone help me with getting started?
> How can import a txt file with series of numbers from the RAD7 machine?
> How can I open up and set directories with the imported file or to start a
> new r session?
> 
> Thank you so much if you can help.
> 

-- 
View this message in context: 
http://www.nabble.com/Getting-started-help-tp15560581p15561419.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] plotDensity

2008-02-19 Thread Conny Schmitt
Hallo,

I just loaded the limma package.

Conny

 Original-Nachricht 
> Datum: Tue, 19 Feb 2008 06:41:18 -0800
> Von: "Henrik Bengtsson" <[EMAIL PROTECTED]>
> An: [EMAIL PROTECTED]
> CC: [EMAIL PROTECTED]
> Betreff: Re: [R] plotDensity

> Is 'plotDensity' a specific function you are referring to?  If so, in
> which package?  Then we can give a straight answer...
> 
> /Henrik
> 
> On Feb 19, 2008 4:10 AM,  <[EMAIL PROTECTED]> wrote:
> > Hallo,
> >
> > I have a question to plotDensity and do not understand what stand
> behind. In a density plot the x-axis is the signal intensity but for what 
> stands
> than density on the y-axis? Here I have the values 0.00-0.30 Can anyone
> discribe it by his own words? I do not understand the help.
> >
> > Thanks, Conny
> > --
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/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] good references on "survival analysis"

2008-02-19 Thread Roland Rau
Hi,

Marc Bernard wrote:
> Dear all,
>
>   I am looking for a good reference on "Survival analysis". I am looking for 
> a booking containing both applications and Maths. Explaining different 
> methods in survival analysis 
>
since I just answered in another thread with a book recommendation on 
survival analysis, the only book I ever bought myself on survival 
analysis is:
Klein/Moeschberger: Survival Analysis (Springer)
It has lots of "applications and maths" as you are mentioning that this 
is what you are looking for.
Two classic books which are often cited:
a) Cox/Oates: Analysis of Survival Data
b) Kalbfleisch/Prentice: The Statistical Analysis of Failure Time Data

In the other thread, Ben Bolker suggested the book by Therneau and 
Grambsch. Unfortunately, I have no experience with that one. Please note 
that Terry Therneau wrote the original version of the survival package in S.

I also borrowed the book "Survival Analysis Using S. Analysis of 
Time-to-Event Data". This is a book which focuses on how to implement 
various methods from survival analysis in S. This is certainly useful 
but I checked usually the theory in Klein/Moeschberger. The 
implementation of standard methods was easily found in the documentation 
of the survival package (big thanks to Terry Therneau and Thomas Lumley!)

I hope this helps,
Roland

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] fitted values are different from manually calculating

2008-02-19 Thread gatemaze
Thank you all for your help. Apologies for not giving an example.
model.matrix was useful as comparing that table with the one from the
spreadsheet showed the "mispell".

On 19/02/2008, Douglas Bates <[EMAIL PROTECTED]> wrote:
>
> On Feb 19, 2008 8:41 AM,  <[EMAIL PROTECTED]> wrote
>
> > on a simple linear model the values produced from the fitted(model)
> function
> > are difference from manually calculating on calc. Will anyone have a
> clue...
> > or any insights on how fitted function calculates the values? Thank you.
>
> __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> As the posting guide (you did read the posting guide, didn't you?)
> says, it helps if you can provide a reproducible example.   Otherwise,
> we can only guess at what you mean.
>
> Try taking a fitted model and examining
>
> model.matrix(model)
>
> and
>
> coef(model)
>
> It should be the case that
>
> model.matrix(model) %*% coef(model)
>
> is reasonably close to fitted(model).
>
> I just saw that Dimitris wrote almost the same thing but, since I have
> written it, I'll mail it anyway.
>



-- 
-- Yianni

[[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] one-way anova power calculations

2008-02-19 Thread Will Holcomb
I have been attempting some basic power calculations using R and I am not
getting the results I expect. I had a homework assignment in SAS, but I want
to learn R as well, so I was attempting to reproduce my result. (No one else
in the class is doing R, so there's no need to obsfucate the answer, the SAS
code is what I get my grade for.) The code I am using is:

# You assume that the within-population standard deviations all equal 9. You
set the Type 1 error rate at
# alpha = .05. You presume that the population means will have the following
values: 17.5, 19, 25, 20.5.
# You intend to run 80 subjects in all, with equal n's across all 4 groups.
Compute your power to reject
# the null hypothesis under these conditions.

means = c(17.5, 19, 25, 20.5)
power.anova.test(groups = length(means), n = 80 / length(means),
 between.var = var(means), within.var = 9,
 sig.level = 0.05)

The result I'm getting is:

 Balanced one-way analysis of variance power calculation

 groups = 4
  n = 20
between.var = 10.5
 within.var = 9
  sig.level = 0.05
  power = 1

 NOTE: n is number in each group

I've already done the calculation in SAS with the following code:

data Dep;
Input cue $ mean weight;
datalines;
A 17.5  1
B 191
C 251
D 20.5  1
;

proc glmpower;
class cue;
model mean = cue;
weight weight;
power
stddev = 9
alpha = 0.05
ntotal= 80
power = .;
run;

This produces a power of 0.616 which is the answer I was supposed to get.
Any idea what I need to change?

Will

[[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] Building a package and Depends search

2008-02-19 Thread john seers (IFR)
 

Thank you very much for your help - that fixed it. Sorry I did not see
it in the manual.

Regards


JS 



 
---
-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Sent: 19 February 2008 14:14
To: john seers (IFR)
Cc: r-help@r-project.org
Subject: Re: [R] Building a package and Depends search

On Tue, 19 Feb 2008, john seers (IFR) wrote:

>
>
> Hello R experts
>
> I am just learning how to build a package so this is probably a basic 
> question. I have read the manual( well, to be more truthful, am 
> reading) the manual, and I have searched the archives to the best of
my ability.

You could have searched for R_LIBS in the manual (see below).

> I am on Windows.
>
> When running the command "R CMD check packagename" I get this type of
> error:
>
> * checking package dependencies ... ERROR Packages required but not 
> available:
>  chron
>
> I think this is because I install my packages in "mylibrary" and use 
> "R_LIBS=C:/PROGRA~1/R/mylibrary" in my Renviron.site file. If I move 
> the package to the R main library it fixes the problem. But rather 
> defeats the intention behind having a separate mylibrary.
>
> Can anybody tell me how to solve this? That is keep my installed 
> packages in mylibrary but get the package check/build to work? I guess
> Depends: has a search path but I cannot find it or how to alter it. 
> Can anybody point me to some documentation?

Set the environment variable R_LIBS in your commands windows/shell.
As the manual says:

   @quotation Note
   @code{R CMD check} and @code{R CMD build} run @R{} with
   @option{--vanilla}, so none of the user's startup files are read.  If
   you need @env{R_LIBS} set (to find packages in a non-standard
library)
   you will need to set it in the environment.
   @end quotation


>
> Thanks very much for any help.
>
>
> Regards
>
>
> John Seers
>
>
>
>
>
>
>> sessionInfo()
> R version 2.6.2 (2008-02-08)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
> Kingdom.1252;LC_MONETARY=English_United
> Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252
>
> attached base packages:
> [1] stats graphics  grDevices datasets  utils methods   base
>
>
> other attached packages:
> [1] chron_2.3-20  limma_2.12.0  RWinEdt_1.7-9
>>
>
>
>
>
>
>
> ---
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
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] create library for own datasets

2008-02-19 Thread Gabor Grothendieck
You might want to look at the datasets package
as an example:

https://svn.r-project.org/R/trunk/src/library/datasets/

The other way is to save() them in an .rda file and then
just load() the file.

On Feb 19, 2008 10:20 AM, Birgit Lemcke <[EMAIL PROTECTED]> wrote:
> I am using the recent R version on a G4 PowerBook with Mac OS X 10.4.11.
>
> I have a bunch of datasets that I would like to put all together in a
> R library, so that I only have to type:
>>library("name")
> and all datasets are loaded. Is this like building a package or is
> there an easier way to do that?
>
> Thanks in advance for your help.
>
> B.
>
> Birgit Lemcke
> Institut für Systematische Botanik
> Zollikerstrasse 107
> CH-8008 Zürich
> Switzerland
> Ph: +41 (0)44 634 8351
> [EMAIL PROTECTED]
>
> 175 Jahre UZH
> «staunen.erleben.begreifen. Naturwissenschaft zum Anfassen.»
> MNF-Jubiläumsevent für gross und klein.
> 19. April 2008, 10.00 Uhr bis 02.00 Uhr
> Campus Irchel, Winterthurerstrasse 190, 8057 Zürich
> Weitere Informationen www.175jahre.uzh.ch
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] regression with error in predictor

2008-02-19 Thread Dieter Menne
Irene Mantzouni  difres.dk> writes:

> I am trying to run a regression where the predictor values are not real
> data but each is estimated from a different model. So, for each value I
> have a mean and variance. 
> 
> Which package/function should I use in this case? 

See the Dobson example in the lm documentation. Assuming your x-values are known
accurately enough, you could use your y-variances as weights; this could be a
good approximation to what you want. 

If that's not enough, check one of the packages with "meta" in it. You may 
get better responses when you provide a self-running example as the posting 
guide says.

Dieter

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


Re: [R] History of R

2008-02-19 Thread Roland Rau
Hi Kathy,

maybe this article could be also of use for you?
Ihaka, R., and Gentleman, R. (1996)," R: A Language for Data Analysis 
and Graphics," The Journal of Computational and Graphical Statistics, 5, 
299-314

Best,
Roland


Kathy Gerber wrote:
> Earlier today I sent a question to Frank Harrell as an R developer with 
> whom I am most familiar.  He suggested also that I put my questions to 
> the list for additional responses.  Next month I'll be giving a talk on 
> R as an example of high quality open source software.  I think there is 
> much to learn from R as a high quality extensible product that (at least 
> as far as I can tell) has never been "spun" or "hyped" like so many open 
> source fads.
> 
> The question that intrigues me the most is why is R as an open source 
> project is so incredibly successful and other projects, say for example, 
> Octave don't enjoy that level of success?
> 
> I have some ideas of course, but I would really like to know your 
> thoughts when you look at R from such a vantage point.
> 
> Thanks.
> Kathy Gerber
> University of Virginia
> ITC - Research Computing Support
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Interpolation between 2 vectors

2008-02-19 Thread Dani Valverde
Hello,
I have two vectors, one with 13112 points and the other one with 10909. 
I wonder if there is a way to interpolate the data so the shorter 
vectors has the same number of points as the longer one.
Best,
Dani

-- 
Daniel Valverde Saubí

Grup de Biologia Molecular de Llevats
Facultat de Veterinària de la Universitat Autònoma de Barcelona
Edifici V, Campus UAB
08193 Cerdanyola del Vallès- SPAIN

Centro de Investigación Biomédica en Red
en Bioingeniería, Biomateriales y
Nanomedicina (CIBER-BBN)

Grup d'Aplicacions Biomèdiques de la RMN
Facultat de Biociències
Universitat Autònoma de Barcelona
Edifici Cs, Campus UAB
08193 Cerdanyola del Vallès- SPAIN
+34 93 5814126

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


Re: [R] simple usage of "for"

2008-02-19 Thread Duncan Murdoch
On 2/19/2008 9:24 AM, Hans Ekbrand wrote:
> Hi list
> 
> I have a data frame I would like to loop over. To begin with I would
> like crosstabulations using the first variabel in the data frame,
> which is called "meriter".
> 
>> table(meriter[[1]], meriter[[3]])
>   
>   ja nej
>   Annan 0  2   1
>   Avdelningen för teknik- och vetenskapsstudier 0  5   1
>   CEFOS 0  6   3
>   Förvaltningshögskolan 0 13   6
>   Institutionen för globala studier 0 20  12
>   Institutionen för journalistik och masskommunikation  0  5  17
>   Institutionen för socialt arbete  1 19  35
>   Psykologiska institutionen0 24  21
>   Sociologiska institutionen0 16  12
>   Statsvetenskapliga institutionen  0 19  12
>>
> 
> I tried the following small code snippet which I copied from the
> "Introduction to R":
> 
>> for (i in 2:length(meriter)) { table(meriter[[1]], meriter[[i]]) }

Where did you find that?  I don't see anything like it.  (If there is 
something like that, it should be fixed.)

If you are referring to this snippet:

 >for (i in 1:length(yc)){
 plot(xc [[i ]],yc [[i ]]);
 abline(lsfit(xc [[i ]],yc [[i ]]))
}

then it has the important difference that plot() and abline() both have 
side effects (they do plotting), whereas table() doesn't.

Duncan Murdoch

> 
> And there is no output at all, just a new prompt.
> 
> I added a print statement just to check the loop construct, and it
> seems to work.
> 
>> for (i in 2:length(meriter)) { print(i); table(meriter[[1]], meriter[[i]]) }
> [1] 2
> [1] 3
> [1] 4
> 
> But I get no tables :-(
> 
> What do I do wrong?
> 
> 
> 
> 
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Change the color and lines of the legend using bwplot

2008-02-19 Thread Deepayan Sarkar
On 2/19/08, Tom Cohen <[EMAIL PROTECTED]> wrote:
> Dear list,
>
>   I have following plot, where I have set the color (red and green) and lines 
> (lty=2:3) in the panel.groups but can't not figure out how change the lines 
> and color of the legend in the "key" to the same lines and color as in the 
> panel.groups.
>
>   bwplot(means ~ age | scales , dat, panel = "panel.superpose",
>groups = sex,scales = list(x = list(rot = 45),cex=0.7,alternating=2),
>panel.groups = "panel.linejoin", lwd=1.2,lty=c(2:3),type="b",col=c
> ("red","green"),
>ylab = list(label = "mean value", cex = 0.8),
>xlab = list(label = "scales", cex = 0.8),
>key = list(lines = Rows(trellis.par.get("superpose.line"),c(1:2, 0)), 
> cex=0.8,text = list(lab = as.character(unique(dat$sex))),
>   columns = 2, title = " age sex",
>   cex.title=0.9))

key = list(lines = list(col = c("red", "green")))

should work.

-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] newbie (me) needs to model distribution as two overlapping gaussians

2008-02-19 Thread Greg Snow
The mixreg package may help.  Just fit an intercept only model to your
data (may need to have x be a column of 1's and tell it not to include
an intercept) and see if it finds your mixtures.

Hope this helps,

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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of tcornulier
> Sent: Monday, February 18, 2008 12:48 PM
> To: [EMAIL PROTECTED]
> Cc: r-help@r-project.org
> Subject: Re: [R] newbie (me) needs to model distribution as 
> two overlapping gaussians
> 
> Is a finite mixture of 2 gaussians the name you are looking for?
> This specific model will not deal with your N component however.
> 
> you can find some functions here:
> http://cran.r-project.org/web/views/Cluster.html
> 
> Thomas
> 
> [EMAIL PROTECTED] wrote:
> > Recently, I have been working with some data that look like two 
> > overlapping gaussian distributions.  I would like to either
> > 
> > 1) determine the mean and SD for each of the two distributions
> > 
> > OR
> > 
> > 2) get some (bayesian ?) statistic that estimates how likely an 
> > observation is to belong to the left-hand or right-hand distribution
> > 
> > In case I'm using the wrong language, my data looks 
> something like this:
> > 
> > B <- rnorm(500,40,10)
> > H <- rnorm(500,80,5 )
> > N <- runif(200,0,99)
> > D <- c(B,H,N)
> > 
> > Where B=background, H=hits, N=noise, and D=my observed distribution
> > 
> > I have seen analyses like this in the past, but I can't 
> remember what it is called.  If somebody out there can point 
> me towards an R function, or even the cannonical name for 
> this kind of model, I think I can write the necessary code.
> > 
> > Thanks in advance,
> > Mark
> > 
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide 
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> > 
> 
> -- 
> 
> 
> **
> Thomas Cornulier
> 
> Mammal Research Institute
> Polish Academy of Sciences
> ul. Waszkiewicza 1c
> 17-230 Bialowieza
> http://www.zbs.bialowieza.pl/?en
> 
> tel (0048) 85 682 77 88
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Two bwplots in one single graph

2008-02-19 Thread Deepayan Sarkar
On 2/19/08, Tom Cohen <[EMAIL PROTECTED]> wrote:
> Dear list,
>
>   With the below codes, I got 8 bwplots but I would like to put 2 bwplots in 
> one single graph so that instead of 8 separate bwplots I would have 4 graphs, 
> each contains 2 bwplots.  How can I do that?
>
>   Another question is how do I add the mean as a point to each boxplot in the 
> bwplot but also keeping the median line.
>
>   for (i in 1:length(dat)){
> windows()
> with(dat[[i]], print(bwplot(value  ~ time | sex + age , scales = list(x = 
> list(rot = 45)),
>  ylab = list(label = paste(sname[i],"-value",sep=""), cex = 0.8),
>  xaxis = list(cex = 0.6),
> panel = function(x, y){panel.bwplot(x, y, pch
> = '|',horiz=F,stats = boxplot.stats, fill = "khaki2", varwidth = T)})))
>  }

Your question assumes that we are familiar with your data, which we
are not. As the footer says, please "provide commented, minimal,
self-contained, reproducible code."

-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] how to plot image() without painting a map (the background)

2008-02-19 Thread Greg Snow
The approach that I usually use for things like this is:

Plot the map to get the aspect ratio and limits correct.
Add the image (obscuring the original map).
Add the map again on top of the image using a light grey color.

This seems to work fine for me.  Another aproach that you may try (untested) is 
to use colors with an alpha channel (transparency) in the call to image, then 
the background map may show through.  Not all graphics devices support alpha 
channels, so test on one that does.

Hope this helps,

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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Ptit_Bleu
> Sent: Monday, February 18, 2008 8:59 AM
> To: r-help@r-project.org
> Subject: [R] how to plot image() without painting a map (the 
> background)
> 
> 
> Hello,
> 
> I'm trying to plot dayly evolution of the temperature over 
> France from Global Forecast System files ("I'm trying" is the 
> right expression...).
> 
> akilonlat03 is the temperature for different latitudes and 
> longitudes à 3 o'clock.
> akilonlat06 is the temperature for different latitudes and 
> longitudes à 6 o'clock.
> 
> I would like to plot akilonlat03 and then akilonlat06 and 
> keep the map of France in background.
> My script (see below) doesn't work as image "paints" the 
> background as I read somewhere in this forum.
> 
> So would have someone a solution to correct my script ?
> Thanks in advance,
> Ptit Bleu.
> 
> 
> 
> 
> akilonlat03<-interp(lonlat03$Longitude, lonlat03$Latitude,
> (5/9)*(lonlat03$TMP_200802150300-32))
> akilonlat06<-interp(lonlat06$Longitude, lonlat06$Latitude,
> (5/9)*(lonlat06$TMP_200802150600-32))
> 
> map('france')
> 
> image(akilonlat03, col=cm.colors(100), axes=FALSE, add=TRUE) 
> #contour(akilonlat03, col="blue", add=TRUE) 
> image(akilonlat06, col=cm.colors(100), axes=FALSE, add=TRUE) 
> #contour(akilonlat06, col="blue", add=TRUE)
> 
> --
> View this message in context: 
> http://www.nabble.com/how-to-plot-image%28%29-without-painting
> -a-map-%28the-background%29-tp15546906p15546906.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] Transfer Crosstable to Word-Document

2008-02-19 Thread Greg Snow
There are several options available to you depending on your knowledge and 
workflow.

Others have mentioned using Excel to format the table and to copy that into 
word, one thing along those lines that has not been mentioned yet is that if 
you have your data in a matrix or data frame then (on windows at least, I have 
not tried on other platforms) you can type:

> write.table(my.data, 'clipboard', sep="\t")

Then in Excel just do a paste and the data is there, this saves a couple of 
steps from saving as a .csv file and importing that into excel.  This would 
probably be fine for a few tables.

With a little effort on your part, odfWeave may still be an option.  I have a 
project based on a survey with quite a few questions, but the output wanted was 
basically one of 3 tables and graphs based on a question or set of questions.  
I wrote a set of functions that found the correct columns in the data and 
created a matrix with the appropriate table values and used the odfTable 
function to do the formating (and a set of functions to do the graphs).  Then I 
created an odf template file in OpenOffice that called the appropriate 
functions for each question, ran that through odfWeave, opened the result in 
OpenOffice and saved it as a word file to send to the clients.  Another nice 
thing about this approach is that occasionally I get requests for the same 
output on a subset of the data, I just create the subset, rerun odfWeave, 
convert to word and I'm done (I don't let the client know that it was that easy 
though).  I think there is something in the works to allow conversion of odf 
files to ms word files from a command line.

You can also use the existing LaTeX tools that others have suggested, then 
convert from latex to HTML or RTF or another format that can be read into word. 
 If you take this approach wich will require a few intermediate steps between R 
and word, then you may want to learn the make utility (there are versions of 
make available on windows, otherwise I don't know how I would survive trapped 
in an MS workplace).  Make helps with automating several step processes and 
updating only those parts that need to be updated.

If you can give some more detail on what you want to do and how you want the 
output to look, then we can give more specific ideas on how to get there.

Hope this helps,

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

> -Original Message-
> From: Udo König [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, February 17, 2008 11:08 AM
> To: r-help@r-project.org
> Cc: Greg Snow
> Subject: RE: [R] Transfer Crosstable to Word-Document
> 
> 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
> 
> 
> This message was sent using IMP, the Internet Messaging Program.
> 
> 

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

2008-02-19 Thread My Coyne
Hi Rthoughts,

Don't be discouraged I'm learning R on/off for classes and when I was
under pressure to get work done, learning R likes pulling my hair (and
teeth) off of frustration.  But, this forum is great; I got so much help
from this forum.


I use R on windows as well.  After install R, if the R is not on the
desktop, go to: start -> program -> R, make the short cut on the desktop.
(If this is not what you are asking, please post the question again.)

Hope this helps.  

My D. Coyne



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Rthoughts
Sent: Tuesday, February 19, 2008 11:52 AM
To: r-help@r-project.org
Subject: Re: [R] Getting started help


Hi Mark,

Thank you for the reply.

I meant the command prompts to start an R file.

To be followed on by importint data I can then use to practise the software
with. The installation did put an icon on teh desktop. I am a very skilled
user of computers but command lines for many programs is something that cna
throw me sometimes!

Regrads, Seb.


Mark Difford wrote:
> 
> Hi Rthoughts,
> 
> It isn't clear what you mean.  When you install R, the installation
> program usually puts an icon on your desktop that you can click on to run
> the program.  So, if you don't have that, but have installed R, and what
> you mean is, "How do I start the R program?" or "How do I run R?" then do
> the following:
> 
> Go to the directory where R has been installed.  If necessary, use your
> file manager to find the file named Rgui.exe.  When you have found it,
> execute it to start an R session.  (Rgui.exe usually lives in something
> like: ...\Program Files\R\bin\)
> 
> Later you will find out how to set this all up properly.  Usually the
> installation program does a faultless job.
> 
> HTH,
> Mark.
> 
> 
> Rthoughts wrote:
>> 
>> Hi Mark,
>> 
>> Thank you for your reply. There is one link I haven't come across, the
>> last one. I have seen them but I couldn't find where 'how to start R' is
>> explained for Windows platforms.
>> 
>> I will look further into them.
>> 
>> As for everyone else who sent e-mails, thank you. I have printed them out
>> and will look into them.
>> 
>> 
>> Mark Difford wrote:
>>> 
>>> Hi Rthoughts,
>>> 
> I am currently discouraged by the use of r. I cannot figure out how to
> use it despite
> extensive searches. Can anyone help me with getting started? How can
> import 
> a txt file with series...
>>> 
>>> There are piles of documents that you could (and should) read.  I am
>>> surprised that you haven't found them in your extensive searches.  To
>>> set your thoughts free, go here:
>>> 
>>> http://www.r-project.org/
>>> http://cran.r-project.org/manuals.html## read the first one, and
>>> whatever else you need
>>> 
>>> Then click on CRAN, and choose a mirror site (nearby), say:
>>> http://cran.za.r-project.org/
>>> 
>>> Then go:
>>> http://cran.za.r-project.org/other-docs.html
>>> 
>>> and start at the top.
>>> 
>>> HTH,
>>> Mark.
>>> 
>>> PS: It might help you in your future enquiries if you used a real name,
>>> and if you called R R rather than r (since your keyboard clearly doesn't
>>> have a broken R ;).
>>> 
>>> 
>>> 
>>> Rthoughts wrote:
 
 Hello, I need to learn to use r-software for my PhD research project
 involving long timelines of radon radiation variations.
 
 I am using windows.
 
 I am currently discouraged by the use of r. I cannot figure out how to
 use it despite extensive searches. Can anyone help me with getting
 started? How can import a txt file with series of numbers from the RAD7
 machine? How can I open up and set directories with the imported file
 or to start a new r session?
 
 Thank you so much if you can help.
 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/Getting-started-help-tp15560581p15562214.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] Getting started help

2008-02-19 Thread gatemaze
Hi, if  I may further add it would be very helpful if you get a book on R
from your library... the introductory chapters should be very much helpful
as all of them start on how to simply start R, load your data files, etc
etc The deepness and power of R is well beyond any other software, but
you do have to use your keyboard more than your mouse :). although there are
some GUI's available... when i started using R I used R-commander and rattle
which helped me get started a bit...

On 19/02/2008, Mark Difford <[EMAIL PROTECTED]> wrote:
>
>
> Hi Rthoughts,
>
> >> I am currently discouraged by the use of r. I cannot figure out how to
> >> use it despite
> >> extensive searches. Can anyone help me with getting started? How can
> >> import
> >> a txt file with series...
>
> There are piles of documents that you could (and should) read.  I am
> surprised that you haven't found them in your extensive searches.  To set
> your thoughts free, go here:
>
> http://www.r-project.org/
> http://cran.r-project.org/manuals.html## read the first one, and
> whatever else you need
>
> Then click on CRAN, and choose a mirror site (nearby), say:
> http://cran.za.r-project.org/
>
> Then go:
> http://cran.za.r-project.org/other-docs.html
>
> and start at the top.
>
> HTH,
> Mark.
>
> PS: It might help you in your future enquiries if you used a real name,
> and
> if you called R R rather than r (since your keyboard clearly doesn't have
> a
> broken R ;).
>
>
>
> Rthoughts wrote:
> >
> > Hello, I need to learn to use r-software for my PhD research project
> > involving long timelines of radon radiation variations.
> >
> > I am using windows.
> >
> > I am currently discouraged by the use of r. I cannot figure out how to
> use
> > it despite extensive searches. Can anyone help me with getting started?
> > How can import a txt file with series of numbers from the RAD7 machine?
> > How can I open up and set directories with the imported file or to start
> a
> > new r session?
> >
> > Thank you so much if you can help.
> >
>
> --
> View this message in context:
> http://www.nabble.com/Getting-started-help-tp15560581p15561419.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.
>



-- 
-- Yianni

[[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] plotEst

2008-02-19 Thread hadley wickham
> Another question: Can I add another line to the same plot with qplot?
> (like function "lines" in "plot").

Yes.

(if you want more details, tell us what you're trying to do!)

Hadley


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

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


Re: [R] Conditional Autoregressive (CAR) model simulation

2008-02-19 Thread Dae-Jin Lee
Thanks for your suggestion, Henrique

Here I attach a link to some notes by Robert Bivand, with a SAR model, see
page 30

www.bias-project.org.uk/ASDARcourse/unit6_slides.pdf

The difference with CAR is in the covariance structure, I run and example:

# ===
library(spdep)
set.seed(987654)

# Columbus example in spdep library
example(columbus)
n <- length(col.gal.nb)
coords <- coordinates(columbus)
cards <- card(col.gal.nb)
col.w <- nb2listw(col.gal.nb)

uncorr_x <- rnorm(n)# uncorrelated random variable

cor(uncorr_x, lag(col.w,uncorr_x)) # correlation

# ==
 rho <- .5 # spatial autocorrelation

# Case1: SAR

 IrW <- diag(n) - rho*listw2mat(col.w) # I - rho * W

 SARcov <- solve(t(IrW) %*% IrW)
 SARcovL <- chol((SARcov + t(SARcov))/2)

autocorr_x <- t(SARcovL)%*%uncorr_x

cor(autocorr_x, lag(col.w,autocorr_x))   #
   [,1]
[1,] 0.3876456
# ==

I've did the same but with CAR structure

   CARcov = solve(IrW) #  from  (I-rhoW)^ -1
   CARcovL = chol(CARcov)   # Cholesky Decomposition

a_x = t(CARcovL)%*%uncorr_x #

cor(a_x,lag(col.W,a_x))

   [,1]
[1,] 0.06929324
# ==

I don't know if I'm simulating correctly the CAR,

any help?

Thanks in advance



2008/2/15, Henrique Dallazuanna <[EMAIL PROTECTED]>:
>
> See spautolm function in spdep package
>
> On 15/02/2008, Dae-Jin Lee <[EMAIL PROTECTED]> wrote:
> > Hi all !
> >
> >  I would like to simulate spatial lattice/areal data with a conditional
> >  autoregressive (CAR) structure, for a given neighbouring matrix and for
> a
> >  autocorrelation "rho".
> >
> >  Is there any package or function in R to perform it ?
> >
> >  I found the function "CARsimu" in the hdeco library, but this is not
> what
> >  I'm looking for
> >
> >  Thanks in advance
> >
> >  Dae-Jin
> >
> >  --
> >  __
> >
> >  Dae-Jin Lee
> >
> >  Office/Despacho: 7.3.J04
> >  Phone/Tlfno:+34 91 624 9175
> >  Fax: +34 91 624 9430
> >
> >  Departamento de Estadística
> >  Av. Universidad 30, Ed. Juan Benet
> >  28911 Leganés (Madrid), SPAIN
> >  Universidad Carlos III de Madrid
> >
> >  e-mail: [EMAIL PROTECTED]
> >web: http://www.est.uc3m.es/daejin
> >  __
> >
> > [[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
>



-- 
__

Dae-Jin Lee

Office/Despacho: 7.3.J04
Phone/Tlfno:+34 91 624 9175
Fax: +34 91 624 9430

Departamento de Estadística
Av. Universidad 30, Ed. Juan Benet
28911 Leganés (Madrid), SPAIN
Universidad Carlos III de Madrid

e-mail: [EMAIL PROTECTED]
   web: http://www.est.uc3m.es/daejin
__

[[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] one-way anova power calculations

2008-02-19 Thread apjaworski
Will,

Your SAS input indicates that within standard deviation is 9, not the
variance.  If you use within.var=81 in your R statement you will get the
answer matching SAS.

Cheers,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 "Will Holcomb"
 <[EMAIL PROTECTED] 
 om>To 
 Sent by:  r-help
 [EMAIL PROTECTED]  cc 
 project.org   
   Subject 
   [R] one-way anova power 
 02/19/2008 10:19  calculations
 AM
   
   
   
   
   




I have been attempting some basic power calculations using R and I am not
getting the results I expect. I had a homework assignment in SAS, but I
want
to learn R as well, so I was attempting to reproduce my result. (No one
else
in the class is doing R, so there's no need to obsfucate the answer, the
SAS
code is what I get my grade for.) The code I am using is:

# You assume that the within-population standard deviations all equal 9.
You
set the Type 1 error rate at
# alpha = .05. You presume that the population means will have the
following
values: 17.5, 19, 25, 20.5.
# You intend to run 80 subjects in all, with equal n's across all 4 groups.
Compute your power to reject
# the null hypothesis under these conditions.

means = c(17.5, 19, 25, 20.5)
power.anova.test(groups = length(means), n = 80 / length(means),
 between.var = var(means), within.var = 9,
 sig.level = 0.05)

The result I'm getting is:

 Balanced one-way analysis of variance power calculation

 groups = 4
  n = 20
between.var = 10.5
 within.var = 9
  sig.level = 0.05
  power = 1

 NOTE: n is number in each group

I've already done the calculation in SAS with the following code:

data Dep;
Input cue $ mean weight;
datalines;
A 17.5  1
B 191
C 251
D 20.5  1
;

proc glmpower;
class cue;
model mean = cue;
weight weight;
power
stddev = 9
alpha = 0.05
ntotal= 80
power = .;
run;

This produces a power of 0.616 which is the answer I was supposed to get.
Any idea what I need to change?

Will

 [[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 count from larger value to smaller value in ecdf (Empirical Cumulative Distribution Function)

2008-02-19 Thread Hyunchul Kim
Hi, all

ecdf function (Empirical Cumulative Distribution Function) in "stats"
package  counts from smaller values to larger values.
However, I want to draw it by counting from larger value to smaller values
and I couldn't find options for this purpose.

How can I draw ecdf or ecdf like graph by counting from larger values to
smaller values.

Thank you in advance.

Hyunchul Kim

[[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] Getting started help

2008-02-19 Thread Rthoughts

Hi Mark,

Thank you for your reply. There is one link I haven't come across, the last
one. I have seen them but I couldn't find where 'how to start R' is
explained for Windows platforms.

I will look further into them.

As for everyone else who sent e-mails, thank you. I have printed them out
and will look into them.


Mark Difford wrote:
> 
> Hi Rthoughts,
> 
>>> I am currently discouraged by the use of r. I cannot figure out how to
>>> use it despite
>>> extensive searches. Can anyone help me with getting started? How can
>>> import 
>>> a txt file with series...
> 
> There are piles of documents that you could (and should) read.  I am
> surprised that you haven't found them in your extensive searches.  To set
> your thoughts free, go here:
> 
> http://www.r-project.org/
> http://cran.r-project.org/manuals.html## read the first one, and
> whatever else you need
> 
> Then click on CRAN, and choose a mirror site (nearby), say:
> http://cran.za.r-project.org/
> 
> Then go:
> http://cran.za.r-project.org/other-docs.html
> 
> and start at the top.
> 
> HTH,
> Mark.
> 
> PS: It might help you in your future enquiries if you used a real name,
> and if you called R R rather than r (since your keyboard clearly doesn't
> have a broken R ;).
> 
> 
> 
> Rthoughts wrote:
>> 
>> Hello, I need to learn to use r-software for my PhD research project
>> involving long timelines of radon radiation variations.
>> 
>> I am using windows.
>> 
>> I am currently discouraged by the use of r. I cannot figure out how to
>> use it despite extensive searches. Can anyone help me with getting
>> started? How can import a txt file with series of numbers from the RAD7
>> machine? How can I open up and set directories with the imported file or
>> to start a new r session?
>> 
>> Thank you so much if you can help.
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Getting-started-help-tp15560581p15561538.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] plotDensity

2008-02-19 Thread Henrik Bengtsson
There is no plotDensity() function in 'limma', but plotDensities().

FYI, there are 1000+ CRAN packages, several hundred Bioconductor
packages, and probably another 1000 packages elsewhere, so please be
precise in order to avoid confusion (and time waste).  Take a minute
or two to read the following:

> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html

The vertical scale for plotDensities() in limma gives you the density
at any position scaled such that integral (the area under the curve)
is one.  This is also true for plotDensity() in aroma.light
(Bioconductor), which explicitly says so in the vertical label.
They are both utilizing the density() function in the 'stats' package.
 See help(density) for more details.  Typically you don't interpret
the exact value at a particular position, but rather the relative area
under the curve for an interval of interest compared with another
interval of interest.

Hope this helps

Henrik


On Feb 19, 2008 7:23 AM, Conny Schmitt <[EMAIL PROTECTED]> wrote:
> Hallo,
>
> I just loaded the limma package.
>
> Conny
>
>  Original-Nachricht 
> > Datum: Tue, 19 Feb 2008 06:41:18 -0800
> > Von: "Henrik Bengtsson" <[EMAIL PROTECTED]>
> > An: [EMAIL PROTECTED]
> > CC: [EMAIL PROTECTED]
> > Betreff: Re: [R] plotDensity
>
>
> > Is 'plotDensity' a specific function you are referring to?  If so, in
> > which package?  Then we can give a straight answer...
> >
> > /Henrik
> >
> > On Feb 19, 2008 4:10 AM,  <[EMAIL PROTECTED]> wrote:
> > > Hallo,
> > >
> > > I have a question to plotDensity and do not understand what stand
> > behind. In a density plot the x-axis is the signal intensity but for what 
> > stands
> > than density on the y-axis? Here I have the values 0.00-0.30 Can anyone
> > discribe it by his own words? I do not understand the help.
> > >
> > > Thanks, Conny
> > > --
> > >
> > > __
> > > R-help@r-project.org mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.
> > >
>
> --
> GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
> Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
>

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

2008-02-19 Thread Rthoughts

Hi Mark,

Thank you for the reply.

I meant the command prompts to start an R file.

To be followed on by importint data I can then use to practise the software
with. The installation did put an icon on teh desktop. I am a very skilled
user of computers but command lines for many programs is something that cna
throw me sometimes!

Regrads, Seb.


Mark Difford wrote:
> 
> Hi Rthoughts,
> 
> It isn't clear what you mean.  When you install R, the installation
> program usually puts an icon on your desktop that you can click on to run
> the program.  So, if you don't have that, but have installed R, and what
> you mean is, "How do I start the R program?" or "How do I run R?" then do
> the following:
> 
> Go to the directory where R has been installed.  If necessary, use your
> file manager to find the file named Rgui.exe.  When you have found it,
> execute it to start an R session.  (Rgui.exe usually lives in something
> like: ...\Program Files\R\bin\)
> 
> Later you will find out how to set this all up properly.  Usually the
> installation program does a faultless job.
> 
> HTH,
> Mark.
> 
> 
> Rthoughts wrote:
>> 
>> Hi Mark,
>> 
>> Thank you for your reply. There is one link I haven't come across, the
>> last one. I have seen them but I couldn't find where 'how to start R' is
>> explained for Windows platforms.
>> 
>> I will look further into them.
>> 
>> As for everyone else who sent e-mails, thank you. I have printed them out
>> and will look into them.
>> 
>> 
>> Mark Difford wrote:
>>> 
>>> Hi Rthoughts,
>>> 
> I am currently discouraged by the use of r. I cannot figure out how to
> use it despite
> extensive searches. Can anyone help me with getting started? How can
> import 
> a txt file with series...
>>> 
>>> There are piles of documents that you could (and should) read.  I am
>>> surprised that you haven't found them in your extensive searches.  To
>>> set your thoughts free, go here:
>>> 
>>> http://www.r-project.org/
>>> http://cran.r-project.org/manuals.html## read the first one, and
>>> whatever else you need
>>> 
>>> Then click on CRAN, and choose a mirror site (nearby), say:
>>> http://cran.za.r-project.org/
>>> 
>>> Then go:
>>> http://cran.za.r-project.org/other-docs.html
>>> 
>>> and start at the top.
>>> 
>>> HTH,
>>> Mark.
>>> 
>>> PS: It might help you in your future enquiries if you used a real name,
>>> and if you called R R rather than r (since your keyboard clearly doesn't
>>> have a broken R ;).
>>> 
>>> 
>>> 
>>> Rthoughts wrote:
 
 Hello, I need to learn to use r-software for my PhD research project
 involving long timelines of radon radiation variations.
 
 I am using windows.
 
 I am currently discouraged by the use of r. I cannot figure out how to
 use it despite extensive searches. Can anyone help me with getting
 started? How can import a txt file with series of numbers from the RAD7
 machine? How can I open up and set directories with the imported file
 or to start a new r session?
 
 Thank you so much if you can help.
 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Getting-started-help-tp15560581p15562214.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] one-way anova power calculations

2008-02-19 Thread Peter Dalgaard
Will Holcomb wrote:
> I have been attempting some basic power calculations using R and I am not
> getting the results I expect. I had a homework assignment in SAS, but I want
> to learn R as well, so I was attempting to reproduce my result. (No one else
> in the class is doing R, so there's no need to obsfucate the answer, the SAS
> code is what I get my grade for.) The code I am using is:
>
> # You assume that the within-population standard deviations all equal 9. You
> set the Type 1 error rate at
> # alpha = .05. You presume that the population means will have the following
> values: 17.5, 19, 25, 20.5.
> # You intend to run 80 subjects in all, with equal n's across all 4 groups.
> Compute your power to reject
> # the null hypothesis under these conditions.
>
> means = c(17.5, 19, 25, 20.5)
> power.anova.test(groups = length(means), n = 80 / length(means),
>  between.var = var(means), within.var = 9,
>  sig.level = 0.05)
>
> The result I'm getting is:
>
>  Balanced one-way analysis of variance power calculation
>
>  groups = 4
>   n = 20
> between.var = 10.5
>  within.var = 9
>   sig.level = 0.05
>   power = 1
>
>  NOTE: n is number in each group
>
> I've already done the calculation in SAS with the following code:
>
> data Dep;
> Input cue $ mean weight;
> datalines;
> A 17.5  1
> B 191
> C 251
> D 20.5  1
> ;
>
> proc glmpower;
> class cue;
> model mean = cue;
> weight weight;
> power
> stddev = 9
> alpha = 0.05
> ntotal= 80
> power = .;
> run;
>
> This produces a power of 0.616 which is the answer I was supposed to get.
> Any idea what I need to change?
>
>   
Using the _variance_ rather than the standard deviation for within.var 
seems to help quite a bit!

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


-- 
   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] Producing graphs and console output in postscript format

2008-02-19 Thread Greg Snow
Have you looked at Sweave?  It allows you to put all your commands into
a template file along with details on where you want graphs and any
other markup.  You can also include other text (notes, explanations,
etc) that will show up in the output, but not be processed by R.  The
original version of Sweave uses LaTeX and naturally leads to a
postscript document.  There are also variations on Sweave available to
work with HTML or OpenOffice documents.

Sweave does require you to plan ahead what commands you want to run,
then creates the output.  If you are more interested in capturing your
output as you do an analysis that you do not have the commands
preplanned, then the closest I know of is the R2HTML package wich
captures the output and graphs that you specify to an HTML document (you
could then print that to a tool that creates postscript files).  You
could look at the code for R2HTML and see if you could rewrite some
parts to redirct to postscript (or LaTeX) instead of HTML.  Note that
using R2HTML requires you to tell it which plots you created should be
included in the output (run the HTMLplot command when the graph is
complete), any tool like this needs either human input on which graphs
to include and when, or it will tend to have way more graphs than you
really want (if you create a graph, realize you wanted a different color
so replot it, then add a reference line, do you want all 3 versions of
the graph in the final file? Or just the last one?).

You could also just use sink to save commands and output as text, then
when you have a graph that you want to include use dev.copy2eps to save
the graph and use cat to include information in the text output about
the graph file.  Then postprocess your sink text with enscript to create
a postscript file (with the correct escapes in place from cat commands
the .eps files you create will be included).  You could also write a
function that combined the copying of the graph to an .eps file and
including the appropriate escape in the text file.

Another option is to not capture everything as you go along, but then
use the history command to get the set of commands that you ran, put
those into a sweave input file, edit a bit (I sometimes do this when
showing examples, but edit out the calls to help and all the typos I
made) then run Sweave and LaTeX to get the final postscript version.

Hope this helps,

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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of John Sorkin
> Sent: Saturday, February 16, 2008 12:54 PM
> To: r-help@r-project.org
> Subject: [R] Producing graphs and console output in postscript format
> 
> 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-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Why does plot() ignore the data type for axis labels?

2008-02-19 Thread Stiffler

Hello,

I was wondering why the plot() command ignores the datatype when displaying
axis labels.  More specifically, if the data points are integers then the
axis labels should intuitively also be integers, right?

> x <- as.integer(c(1,2,3))
> y <-x
> typeof(x)
[1] "integer"
> plot(x,y)
>

The axis labels are 1.0, 1.5, 2.0, 2.5, 3.0  but if the integer type were
taken into account they would be 1, 2, 3.

PS what's the right way to get integer labels?
Z.
-- 
View this message in context: 
http://www.nabble.com/Why-does-plot%28%29-ignore-the-data-type-for-axis-labels--tp15562325p15562325.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] Which package to install?

2008-02-19 Thread gatemaze
Hi,

well if there is no binary it seems you have to recompile from source...
>From the R FAQ:

2.5.1 How can R be installed (Unix)

If R is already installed, it can be started by typing R at the shell prompt
(of course, provided that the executable is in your path).

If binaries are available for your platform (see Are there Unix binaries for
R?),
you can use these, following the instructions that come with them.

Otherwise, you can compile and install R yourself, which can be done very
easily under a number of common Unix platforms (see What machines does R run
on?).
The file INSTALL that comes with the R distribution contains a brief
introduction, and the "R Installation and Administration" guide (see What
documentation exists for
R?)
has full details.

Note that you need a FORTRAN compiler or perhaps f2c in addition to a C
compiler to build R. Also, you need Perl version 5 to build the R object
documentations. (If this is not available on your system, you can obtain a
PDF version of the object reference manual via CRAN.)

In the simplest case, untar the R source code, change to the directory thus
created, and issue the following commands (at the shell prompt):

 $ ./configure
 $ make

If these commands execute successfully, the R binary and a shell script
front-end called R are created and copied to the bin directory. You can copy
the script to a place where users can invoke it, for example to
/usr/local/bin. In addition, plain text help pages as well as HTML and LaTeX
versions of the documentation are built.

Use make dvi to create DVI versions of the R manuals, such as refman.dvi (an
R object reference index) and R-exts.dvi, the "R Extension Writers Guide",
in the doc/manual subdirectory. These files can be previewed and printed
using standard programs such as xdvi and dvips. You can also use make pdf to
build PDF (Portable Document Format) version of the manuals, and view these
using e.g. Acrobat. Manuals written in the GNU Texinfo system can also be
converted to info files suitable for reading online with Emacs or
stand-alone GNU Info; use make info to create these versions (note that this
requires Makeinfo version 4.5).

Finally, use make check to find out whether your R system works correctly.

You can also perform a "system-wide" installation using make install. By
default, this will install to the following directories:
${prefix}/binthe front-end shell script
${prefix}/man/man1the man page
${prefix}/lib/Rall the rest (libraries, on-line help system, ...). This is
the "R Home Directory" (R_HOME) of the installed system.

In the above, prefix is determined during configuration (typically
/usr/local) and can be set by running configure with the option

 $ ./configure --prefix=/where/you/want/R/to/go

(E.g., the R executable will then be installed into
/where/you/want/R/to/go/bin.)

To install DVI, info and PDF versions of the manuals, use make
install-dvi, make
install-info and make install-pdf, respectively.


On 19/02/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm wanting to install R onto my webspace.  My ISP uses CentOS release 4.6
> and I'd like to know which one of the available R packages for Linux would
> be appropriate.
>
> Thanks.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
-- Yianni

[[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] Getting started help

2008-02-19 Thread Mark Difford

Hi Rthoughts,

It isn't clear what you mean.  When you install R, the installation program
usually puts an icon on your desktop that you can click on to run the
program.  So, if you don't have that, but have installed R, and what you
mean is, "How do I start the R program?" or "How do I run R?" then do the
following:

Go to the directory where R has been installed.  If necessary, use your file
manager to find the file named Rgui.exe.  When you have found it, execute it
to start an R session.  (Rgui.exe usually lives in something like:
...\Program Files\R\bin\)

Later you will find out how to set this all up properly.  Usually the
installation program does a faultless job.

HTH,
Mark.


Rthoughts wrote:
> 
> Hi Mark,
> 
> Thank you for your reply. There is one link I haven't come across, the
> last one. I have seen them but I couldn't find where 'how to start R' is
> explained for Windows platforms.
> 
> I will look further into them.
> 
> As for everyone else who sent e-mails, thank you. I have printed them out
> and will look into them.
> 
> 
> Mark Difford wrote:
>> 
>> Hi Rthoughts,
>> 
 I am currently discouraged by the use of r. I cannot figure out how to
 use it despite
 extensive searches. Can anyone help me with getting started? How can
 import 
 a txt file with series...
>> 
>> There are piles of documents that you could (and should) read.  I am
>> surprised that you haven't found them in your extensive searches.  To set
>> your thoughts free, go here:
>> 
>> http://www.r-project.org/
>> http://cran.r-project.org/manuals.html## read the first one, and
>> whatever else you need
>> 
>> Then click on CRAN, and choose a mirror site (nearby), say:
>> http://cran.za.r-project.org/
>> 
>> Then go:
>> http://cran.za.r-project.org/other-docs.html
>> 
>> and start at the top.
>> 
>> HTH,
>> Mark.
>> 
>> PS: It might help you in your future enquiries if you used a real name,
>> and if you called R R rather than r (since your keyboard clearly doesn't
>> have a broken R ;).
>> 
>> 
>> 
>> Rthoughts wrote:
>>> 
>>> Hello, I need to learn to use r-software for my PhD research project
>>> involving long timelines of radon radiation variations.
>>> 
>>> I am using windows.
>>> 
>>> I am currently discouraged by the use of r. I cannot figure out how to
>>> use it despite extensive searches. Can anyone help me with getting
>>> started? How can import a txt file with series of numbers from the RAD7
>>> machine? How can I open up and set directories with the imported file or
>>> to start a new r session?
>>> 
>>> Thank you so much if you can help.
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Getting-started-help-tp15560581p15561960.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] simple usage of "for"

2008-02-19 Thread Hans Ekbrand
Hi list

I have a data frame I would like to loop over. To begin with I would
like crosstabulations using the first variabel in the data frame,
which is called "meriter".

> table(meriter[[1]], meriter[[3]])
  
  ja nej
  Annan 0  2   1
  Avdelningen för teknik- och vetenskapsstudier 0  5   1
  CEFOS 0  6   3
  Förvaltningshögskolan 0 13   6
  Institutionen för globala studier 0 20  12
  Institutionen för journalistik och masskommunikation  0  5  17
  Institutionen för socialt arbete  1 19  35
  Psykologiska institutionen0 24  21
  Sociologiska institutionen0 16  12
  Statsvetenskapliga institutionen  0 19  12
>

I tried the following small code snippet which I copied from the
"Introduction to R":

> for (i in 2:length(meriter)) { table(meriter[[1]], meriter[[i]]) }
> 

And there is no output at all, just a new prompt.

I added a print statement just to check the loop construct, and it
seems to work.

> for (i in 2:length(meriter)) { print(i); table(meriter[[1]], meriter[[i]]) }
[1] 2
[1] 3
[1] 4

But I get no tables :-(

What do I do wrong?

-- 
Hans Ekbrand (http://sociologi.cjb.net) <[EMAIL PROTECTED]>
GPG Fingerprint: 1408 C8D5 1E7D 4C9C C27E 014F 7C2C 872A 7050 614E


signature.asc
Description: Digital 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 count from larger value to smaller value in ecdf (Empirical Cumulative Distribution Function)

2008-02-19 Thread Henrique Dallazuanna
Maybe one option should be:

ecdf2 <- function (x)
{
x <- sort(x, decreasing = TRUE)  # Changed Line
n <- length(x)
if (n < 1)
stop("'x' must have 1 or more non-missing values")
vals <- unique(x)
rval <- approxfun(vals, cumsum(tabulate(match(x, vals)))/n,
method = "constant", yleft = 0, yright = 1, f = 0, ties = "ordered")
class(rval) <- c("ecdf", "stepfun", class(rval))
attr(rval, "call") <- sys.call()
rval
}

See the source code of ecdf



On 19/02/2008, Hyunchul Kim <[EMAIL PROTECTED]> wrote:
> Hi, all
>
> ecdf function (Empirical Cumulative Distribution Function) in "stats"
> package  counts from smaller values to larger values.
> However, I want to draw it by counting from larger value to smaller values
> and I couldn't find options for this purpose.
>
> How can I draw ecdf or ecdf like graph by counting from larger values to
> smaller values.
>
> Thank you in advance.
>
> Hyunchul Kim
>
> [[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] fitted values are different from manually calculating

2008-02-19 Thread john seers (IFR)
 

Hi

A simple example of a linear model:

x<-1:10
y<-3*x+1
m1<-lm(y~x)
 
y
# [1]  4  7 10 13 16 19 22 25 28 31

fitted(m1)
# 1  2  3  4  5  6  7  8  9 10 
# 4  7 10 13 16 19 22 25 28 31 

The fitted and calculated values look identical to me.

Can you give an example of how your calculated values do not match? Or
have I misunderstood your question?

Regards

JS 

 
---

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of [EMAIL PROTECTED]
Sent: 19 February 2008 14:41
To: [EMAIL PROTECTED]
Subject: [R] fitted values are different from manually calculating

Hello,

on a simple linear model the values produced from the fitted(model)
function are difference from manually calculating on calc. Will anyone
have a clue...
or any insights on how fitted function calculates the values? Thank you.

--
-- Yianni

[[alternative HTML version deleted]]

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

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


Re: [R] Getting started help

2008-02-19 Thread Mark Difford

Hi Rthoughts,

Yes, I see now that they truly are (just) Rthoughts;) but take courage, for
we are getting closer (to the start).  You still need to read the basic
documentation, and you will get used to the command line.

What I think you need is a package called Rcmdr.  So, start R using your
desktop icon, click on the Packages menu, then on Install package(s)..., and
then scroll down and choose Rcmdr (you will probably first be asked to
choose a download site). For you the TeachingDemos plugin is a good
additional choice.  Click OK.

Once Rcmdr has been installed, type the following at R's command prompt:

require(Rcmdr)## loads Rcmdr and runs it

You can now switch windows between Rcmdr and R.  Again, at the R prompt type
the following commands:

require(datasets)
?datasets
data(ChickWeight)  ## careful: R is case sensitive!
ls()   ## try ?ls

Now, switch to the Rcmdr window and use the "Data set:" button to load
ChickWeight into Rcmdr's workspace.  Now mess with it; or load another data
set, more to your taste.  Use Rcmdr's Tools menu to load any plugins you
installed.

ls()
str(ChickWeight)## try ?str
summary(ChickWeight)
?rm
rm(ChickWeight)
ls()

HTH, Mark.


Rthoughts wrote:
> 
> Hi Mark,
> 
> Thank you for the reply.
> 
> I meant the command prompts to start an R file.
> 
> To be followed on by importint data I can then use to practise the
> software with. The installation did put an icon on teh desktop. I am a
> very skilled user of computers but command lines for many programs is
> something that cna throw me sometimes!
> 
> Regrads, Seb.
> 
> 
> Mark Difford wrote:
>> 
>> Hi Rthoughts,
>> 
>> It isn't clear what you mean.  When you install R, the installation
>> program usually puts an icon on your desktop that you can click on to run
>> the program.  So, if you don't have that, but have installed R, and what
>> you mean is, "How do I start the R program?" or "How do I run R?" then do
>> the following:
>> 
>> Go to the directory where R has been installed.  If necessary, use your
>> file manager to find the file named Rgui.exe.  When you have found it,
>> execute it to start an R session.  (Rgui.exe usually lives in something
>> like: ...\Program Files\R\bin\)
>> 
>> Later you will find out how to set this all up properly.  Usually the
>> installation program does a faultless job.
>> 
>> HTH,
>> Mark.
>> 
>> 
>> Rthoughts wrote:
>>> 
>>> Hi Mark,
>>> 
>>> Thank you for your reply. There is one link I haven't come across, the
>>> last one. I have seen them but I couldn't find where 'how to start R' is
>>> explained for Windows platforms.
>>> 
>>> I will look further into them.
>>> 
>>> As for everyone else who sent e-mails, thank you. I have printed them
>>> out and will look into them.
>>> 
>>> 
>>> Mark Difford wrote:
 
 Hi Rthoughts,
 
>> I am currently discouraged by the use of r. I cannot figure out how
>> to use it despite
>> extensive searches. Can anyone help me with getting started? How can
>> import 
>> a txt file with series...
 
 There are piles of documents that you could (and should) read.  I am
 surprised that you haven't found them in your extensive searches.  To
 set your thoughts free, go here:
 
 http://www.r-project.org/
 http://cran.r-project.org/manuals.html## read the first one, and
 whatever else you need
 
 Then click on CRAN, and choose a mirror site (nearby), say:
 http://cran.za.r-project.org/
 
 Then go:
 http://cran.za.r-project.org/other-docs.html
 
 and start at the top.
 
 HTH,
 Mark.
 
 PS: It might help you in your future enquiries if you used a real name,
 and if you called R R rather than r (since your keyboard clearly
 doesn't have a broken R ;).
 
 
 
 Rthoughts wrote:
> 
> Hello, I need to learn to use r-software for my PhD research project
> involving long timelines of radon radiation variations.
> 
> I am using windows.
> 
> I am currently discouraged by the use of r. I cannot figure out how to
> use it despite extensive searches. Can anyone help me with getting
> started? How can import a txt file with series of numbers from the
> RAD7 machine? How can I open up and set directories with the imported
> file or to start a new r session?
> 
> Thank you so much if you can help.
> 
 
 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Getting-started-help-tp15560581p15562350.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] Why does plot() ignore the data type for axis labels?

2008-02-19 Thread Gavin Simpson
On Tue, 2008-02-19 at 09:17 -0800, Stiffler wrote:
> Hello,
> 
> I was wondering why the plot() command ignores the datatype when displaying
> axis labels.  More specifically, if the data points are integers then the
> axis labels should intuitively also be integers, right?
> 
> > x <- as.integer(c(1,2,3))
> > y <-x
> > typeof(x)
> [1] "integer"
> > plot(x,y)
> >
> 
> The axis labels are 1.0, 1.5, 2.0, 2.5, 3.0  but if the integer type were
> taken into account they would be 1, 2, 3.

It is due to pretty() finding nice numbers for the axis

> pretty(x)
[1] 1.0 1.5 2.0 2.5 3.0

> 
> PS what's the right way to get integer labels?

Do them by hand, if they are (numeric) integers

> plot(x,y, axes = FALSE)
> axis(2)
> axis(1, at = x)
> box()

You could try writing your own Axis.integer function if doing the extra
steps is a pain - something like:

Axis.integer <- function(x = NULL, at = NULL, ..., side, labels = NULL) 
{
at <- unique(x)
labels <- as.character(at)
axis(side = side, at = unique(x), labels = labels, ...)
}

which works in these case,

y2 <- runif(3)
plot(x, y)
plot(x, y2)

But is far from bullet proof and is not guaranteed to work in all
situations.

HTH

G

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

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


Re: [R] Extracting original variable list from lm object

2008-02-19 Thread Gabor Grothendieck
Try:

all.vars(formula(my.model))


On Feb 19, 2008 1:10 PM, Sung, Iyue <[EMAIL PROTECTED]> wrote:
> Fellow R users,
>
> I have an lm object, from which I would like to extract the list of
> original variables.
> The problem I have is the formula includes functions of the covariates.
>
> I tried using "attr", but the result stores the transformed variable
> name.  For example:
>
> > my.model<-lm(y ~ a + log(b + 1), data=my.data)
> > as.character(attr(my.model$terms, "variables"))[-1]
>  [1] "y" "a" "log(b + 1)"
>
> But I just want a character vector of the original variables ("y", "a",
> "b"), not ("y", "a", "log(b + 1)").
> Does someone have a solution they could kindly share?
>
> Thanks,
> Iyue
> 
> This e-mail and any attachments may be confidential or l...{{dropped:11}}
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Extracting original variable list from lm object

2008-02-19 Thread Sung, Iyue
perfect. many thanks. 

-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 19, 2008 1:26 PM
To: Sung, Iyue
Cc: r-help@r-project.org
Subject: Re: [R] Extracting original variable list from lm object

Try:

all.vars(formula(my.model))


On Feb 19, 2008 1:10 PM, Sung, Iyue <[EMAIL PROTECTED]> wrote:
> Fellow R users,
>
> I have an lm object, from which I would like to extract the list of 
> original variables.
> The problem I have is the formula includes functions of the
covariates.
>
> I tried using "attr", but the result stores the transformed variable 
> name.  For example:
>
> > my.model<-lm(y ~ a + log(b + 1), data=my.data) 
> > as.character(attr(my.model$terms, "variables"))[-1]
>  [1] "y" "a" "log(b + 1)"
>
> But I just want a character vector of the original variables ("y", 
> "a", "b"), not ("y", "a", "log(b + 1)").
> Does someone have a solution they could kindly share?
>
> Thanks,
> Iyue
> --
> -- This e-mail and any attachments may be confidential or 
> l...{{dropped:11}}
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


This e-mail and any attachments may be confidential or l...{{dropped:24}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] newbie (me) needs to model distribution as two overlapping gaussians

2008-02-19 Thread Monica Pisica


take a look at:


Du, 2002, Master Thesis, http://www.math.mcmaster.ca/peter/mix/Rmix.pdf

Macdonald, P., 2003, RMIX routine for R, 
http://www.math.mcmaster.ca/peter/mix/mix.html

I don't think this package was actually posted on CRAN (the mix package on CRAN 
is a different one as far as i remember) - maybe because Macdonald has also a 
commercial package - or maybe had  but you can model your distribution with 
2 or maybe more normal or log-normal distributions - as you see fit - and does 
an ANOVA test to see if your modeling is statistically significant or not. You 
will get also mean and standard distribution for each of your modeling 
distributions.

Hope this helps,

Monica

__
Message: 41
Date: Mon, 18 Feb 2008 16:03:10 +
From: 
Subject: [R] newbie (me) needs to model distribution as two
overlapping gaussians
To: 
Message-ID: 
Content-Type: text/plain; charset="iso-8859-1"


Recently, I have been working with some data that look like two overlapping 
gaussian distributions. I would like to either

1) determine the mean and SD for each of the two distributions

OR

2) get some (bayesian ?) statistic that estimates how likely an observation is 
to belong to the left-hand or right-hand distribution

In case I'm using the wrong language, my data looks something like this:

B <- rnorm(500,40,10)
H <- rnorm(500,80,5 )
N <- runif(200,0,99)
D <- c(B,H,N)

Where B=background, H=hits, N=noise, and D=my observed distribution

I have seen analyses like this in the past, but I can't remember what it is 
called. If somebody out there can point me towards an R function, or even the 
cannonical name for this kind of model, I think I can write the necessary code.

Thanks in advance,
Mark



_
[[elided Hotmail spam]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 plot image() without painting a map (the background)

2008-02-19 Thread Rob Robinson
I've used a similar three-stage approach. Depending on the format of your
map (mine came from an ArcView shape file) you may be able to specify
col="transparent" for the foreground (ie land) in plot as I did (tip, use
border= to get colours for the country borders). This works where alpha
channels don't, such as png. 
Not sure what image you have, but there may be alternatives, for example, I
found .Internal(filledcontour()) extremely useful because then I could
explicitly set some of the image to "transparent"...
Hth
rob

*** Want to know about Britain's birds? Try  www.bto.org/birdfacts ***

Dr Rob Robinson, Senior Population Biologist
British Trust for Ornithology, The Nunnery, Thetford, Norfolk, IP24 2PU
Ph: +44 (0)1842 750050 E: [EMAIL PROTECTED]
Fx: +44 (0)1842 750030 W: http://www.bto.org

 "How can anyone be enlightened, when truth is so poorly lit" =
  

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Greg Snow
> Sent: 19 February 2008 17:20
> To: Ptit_Bleu; r-help@r-project.org
> Subject: Re: [R] how to plot image() without painting a map 
> (the background)
> 
> The approach that I usually use for things like this is:
> 
> Plot the map to get the aspect ratio and limits correct.
> Add the image (obscuring the original map).
> Add the map again on top of the image using a light grey color.
> 
> This seems to work fine for me.  Another aproach that you may 
> try (untested) is to use colors with an alpha channel 
> (transparency) in the call to image, then the background map 
> may show through.  Not all graphics devices support alpha 
> channels, so test on one that does.
> 
> Hope this helps,
> 
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> [EMAIL PROTECTED]
> (801) 408-8111
>  
>  
> 
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Ptit_Bleu
> > Sent: Monday, February 18, 2008 8:59 AM
> > To: r-help@r-project.org
> > Subject: [R] how to plot image() without painting a map (the
> > background)
> > 
> > 
> > Hello,
> > 
> > I'm trying to plot dayly evolution of the temperature over 
> France from 
> > Global Forecast System files ("I'm trying" is the right 
> > expression...).
> > 
> > akilonlat03 is the temperature for different latitudes and 
> longitudes 
> > à 3 o'clock.
> > akilonlat06 is the temperature for different latitudes and 
> longitudes 
> > à 6 o'clock.
> > 
> > I would like to plot akilonlat03 and then akilonlat06 and 
> keep the map 
> > of France in background.
> > My script (see below) doesn't work as image "paints" the 
> background as 
> > I read somewhere in this forum.
> > 
> > So would have someone a solution to correct my script ?
> > Thanks in advance,
> > Ptit Bleu.
> > 
> > 
> > 
> > 
> > akilonlat03<-interp(lonlat03$Longitude, lonlat03$Latitude,
> > (5/9)*(lonlat03$TMP_200802150300-32))
> > akilonlat06<-interp(lonlat06$Longitude, lonlat06$Latitude,
> > (5/9)*(lonlat06$TMP_200802150600-32))
> > 
> > map('france')
> > 
> > image(akilonlat03, col=cm.colors(100), axes=FALSE, add=TRUE) 
> > #contour(akilonlat03, col="blue", add=TRUE) image(akilonlat06, 
> > col=cm.colors(100), axes=FALSE, add=TRUE) #contour(akilonlat06, 
> > col="blue", add=TRUE)
> > 
> > --
> > View this message in context: 
> > http://www.nabble.com/how-to-plot-image%28%29-without-painting
> > -a-map-%28the-background%29-tp15546906p15546906.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-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Matrix addition

2008-02-19 Thread Marlin Keith Cox
Matt,  I know you are probably busy with work, but I cannot help buy asking
you these R questions.  If it is bothersome, please let me know and I will
stick with the R help... but

I have two matrices

X

  [,1]   [,2]  [,3]   [,4]  [,5]   [,6]
 [1,]  660 693.00 726.0 759.00 792.0 825.00
 [2,]  548 575.40 602.8 630.20 657.6 685.00
 [3,]  676 709.80 743.6 777.40 811.2 845.00
 [4,]  763 801.15 839.3 877.45 915.6 953.75
 [5,]  768 806.40 844.8 883.20 921.6 960.00
 [6,]  692 726.60 761.2 795.80 830.4 865.00
 [7,]  657 689.85 722.7 755.55 788.4 821.25
 [8,]  630 661.50 693.0 724.50 756.0 787.50
 [9,]  748 785.40 822.8 860.20 897.6 935.00
[10,]  680 714.00 748.0 782.00 816.0 850.00

and

Y

   [,1]  [,2]  [,3]  [,4]  [,5]  [,6]
 [1,]  1369.00  1396.517  1424.308  1452.372  1480.710  1509.323
 [2,]  1521.00  1551.572  1582.448  1613.629  1645.114  1676.903
 [3,]  1521.00  1551.572  1582.448  1613.629  1645.114  1676.903
 [4,]  1521.00  1551.572  1582.448  1613.629  1645.114  1676.903
 [5,]  1600.00  1632.160  1664.640  1697.440  1730.560  1764.000
 [6,]  1722.25  1756.867  1791.829  1827.135  1862.786  1898.781
 [7,]  1936.00  1974.914  2014.214  2053.902  2093.978  2134.440
 [8,]  2025.00  2065.703  2106.810  2148.323  2190.240  2232.563
 [9,]  2116.00  2158.532  2201.486  2244.864  2288.666  2332.890
[10,]  2209.00  2253.401  2298.244  2343.528  2389.254  2435.423

Each row (1-10) is an individual and columns 1-6 are treatments to each
individual.  I need to look at interactions between the two variables X and
Y, by rows

example
1369 + (660*1369 ^ -1)
1396.517 + (660*1396.517 ^ -1)
1424.308 + (660*1424.308 ^ -1)

...
1369 + (693*1369 ^ -1
1396.517 + (693*1396.517 ^ -1
1424.308 + (693*1424.308 ^ -1
...
etc.

so each row would yield 36 numbers.

I have the following which works for X/Y, but I need Y+X/Y

num.x.col <- length(X[1,])
num.y.col <- length(Y[1,])
num.rows <- length(X[,1])

Z <- matrix(nrow=num.rows, ncol=num.x.col*num.y.col)

for( i in 1:num.rows)  {
   Z[i,] <- as.vector(X[i,] %*% t(Y[i,])^-1 )
}

Any help with making this be Y + X/Y would be appreciated.


-- 
Keith Cox, Ph.D.
Sitka Sound Science Center
Fisheries Biologist
P.O. Box 464
Sitka, Alaska, 99835

907 752-0563
[EMAIL PROTECTED]

[[alternative HTML version deleted]]

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


Re: [R] newbie (me) needs to model distribution as two overlappi

2008-02-19 Thread Ted Harding
On 19-Feb-08 18:09:18, Monica Pisica wrote:
> take a look at:
> 
> Du, 2002, Master Thesis, http://www.math.mcmaster.ca/peter/mix/Rmix.pdf
> 
> Macdonald, P., 2003, RMIX routine for R,
> http://www.math.mcmaster.ca/peter/mix/mix.html
> 
> I don't think this package was actually posted on CRAN (the mix package
> on CRAN is a different one as far as i remember)

The CRAN 'mix' package is indeed different -- it deals with
multiple imputation of missing values in multivariate data
of "mixed types", i.e. some variables are continuous, some are
categorical. It has nothing whatever to do with mixtures of
distributions (except insofar as it may be possible, in special
cases, to model a mixture of distibutions within the imputation
framework embodied in 'mix').

It seems that MacDonald's Rmix package is now calle 'mixdist'
(see the above "mix.html" URL), and that name is not listed
on CRAN. However (again see the above URL) versions of it can
be downloaded from MacDonald's website.

Ted.

 - maybe because
> Macdonald has also a commercial package - or maybe had  but you can
> model your distribution with 2 or maybe more normal or log-normal
> distributions - as you see fit - and does an ANOVA test to see if your
> modeling is statistically significant or not. You will get also mean
> and standard distribution for each of your modeling distributions.
> 
> Hope this helps,
> 
> Monica
> 
> __
> Message: 41
> Date: Mon, 18 Feb 2008 16:03:10 +
> From: 
> Subject: [R] newbie (me) needs to model distribution as two
> overlapping gaussians
> To: 
> Message-ID: 
> Content-Type: text/plain; charset="iso-8859-1"
> 
> 
> Recently, I have been working with some data that look like two
> overlapping gaussian distributions. I would like to either
> 
> 1) determine the mean and SD for each of the two distributions
> 
> OR
> 
> 2) get some (bayesian ?) statistic that estimates how likely an
> observation is to belong to the left-hand or right-hand distribution
> 
> In case I'm using the wrong language, my data looks something like
> this:
> 
> B <- rnorm(500,40,10)
> H <- rnorm(500,80,5 )
> N <- runif(200,0,99)
> D <- c(B,H,N)
> 
> Where B=background, H=hits, N=noise, and D=my observed distribution
> 
> I have seen analyses like this in the past, but I can't remember what
> it is called. If somebody out there can point me towards an R function,
> or even the cannonical name for this kind of model, I think I can write
> the necessary code.
> 
> Thanks in advance,
> Mark
> 
> 
> 
> _
> [[elided Hotmail spam]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 19-Feb-08   Time: 18:46:08
-- XFMail --

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


[R] How to use BayesTree or RBF for predict

2008-02-19 Thread andreBR

Hi all,

 sorry for my english, but I don't speak yours language.
 I'm trying to use bart() and rbf(). The package I'm using now is
"BayesTree" and "neural", respectively. I could create the models, but I
can't predict my test data.
  Does anyone have such an experience?  Any advice is appreciated!
  
 Thank you in advanced!.


André
-- 
View this message in context: 
http://www.nabble.com/How-to-use-BayesTree-or-RBF-for-predict-tp15562371p15562371.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Extracting original variable list from lm object

2008-02-19 Thread Sung, Iyue
Fellow R users,

I have an lm object, from which I would like to extract the list of
original variables.
The problem I have is the formula includes functions of the covariates.

I tried using "attr", but the result stores the transformed variable
name.  For example:

> my.model<-lm(y ~ a + log(b + 1), data=my.data)
> as.character(attr(my.model$terms, "variables"))[-1]
 [1] "y" "a" "log(b + 1)"

But I just want a character vector of the original variables ("y", "a",
"b"), not ("y", "a", "log(b + 1)").
Does someone have a solution they could kindly share?

Thanks,
Iyue
 
This e-mail and any attachments may be confidential or l...{{dropped:11}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Why does plot() ignore the data type for axis labels?

2008-02-19 Thread Bert Gunter
I don't do "why" answers. Only how. Occasionally.

?plot.default  ##with the axes=FALSE argument. Then

?axis ## note the labels and at arguments.



Bert Gunter
Genentech Nonclinical Statistics


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Stiffler
Sent: Tuesday, February 19, 2008 9:18 AM
To: r-help@r-project.org
Subject: [R] Why does plot() ignore the data type for axis labels?


Hello,

I was wondering why the plot() command ignores the datatype when displaying
axis labels.  More specifically, if the data points are integers then the
axis labels should intuitively also be integers, right?

> x <- as.integer(c(1,2,3))
> y <-x
> typeof(x)
[1] "integer"
> plot(x,y)
>

The axis labels are 1.0, 1.5, 2.0, 2.5, 3.0  but if the integer type were
taken into account they would be 1, 2, 3.

PS what's the right way to get integer labels?
Z.
-- 
View this message in context:
http://www.nabble.com/Why-does-plot%28%29-ignore-the-data-type-for-axis-labe
ls--tp15562325p15562325.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] Capture warnings

2008-02-19 Thread Nitin Jain

Dear R-help members,

I am using logistic regression on a high throughput data and would like 
to capture warning messages, if generated for a particular probe.  The 
way I am approaching it currently is:


myResult <- data.frame(matrix(NA, nrow = 1000, ncol = 4))
colnames(myResult) <- c("intercept", "coef", "SE", "Warnings")
myResult[, "Warnings"] <- ""  ## initially set each warning as blank

for (i in seq(nrow(myResult))) {

options(warn = 2) ## Convert warnings to error
probeData <- origData[i, ]  ## get current probe data

fit1 <- try(glm(y ~ x, probeData)) ## fit logistic regression

if (inherits(fit1, "try-error")) { ## change the warn option to 0 and refit
 options(warn = 0)
 fit1 <- try(glm(y ~ x, probeData))
 myResult[i, "Warnings"] <- names(last.warning)[1]
}

## Fill in the other columns of myResult
...
}


When I run the above code in batch mode, I get the error:
Error in x[[jj]][iseq] <- vjj : incompatible types (from NULL to 
character) in subassignment type fix


I think the error is due to the fact that when the first warning message 
is generated, last.warning still does not exist in the function (but in 
some other environment), hence R is trying to assign NULL to a character.


Can anyone tell me how to fix the above problem?

Thanks.

Best,
Nitin


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

2008-02-19 Thread Gabor Grothendieck
Check out:

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

On Feb 19, 2008 1:41 PM, Nitin Jain <[EMAIL PROTECTED]> wrote:
> Dear R-help members,
>
> I am using logistic regression on a high throughput data and would like
> to capture warning messages, if generated for a particular probe.  The
> way I am approaching it currently is:
>
> myResult <- data.frame(matrix(NA, nrow = 1000, ncol = 4))
> colnames(myResult) <- c("intercept", "coef", "SE", "Warnings")
> myResult[, "Warnings"] <- ""  ## initially set each warning as blank
>
> for (i in seq(nrow(myResult))) {
>
> options(warn = 2) ## Convert warnings to error
> probeData <- origData[i, ]  ## get current probe data
>
> fit1 <- try(glm(y ~ x, probeData)) ## fit logistic regression
>
> if (inherits(fit1, "try-error")) { ## change the warn option to 0 and refit
>  options(warn = 0)
>  fit1 <- try(glm(y ~ x, probeData))
>  myResult[i, "Warnings"] <- names(last.warning)[1]
> }
>
> ## Fill in the other columns of myResult
> ...
> }
>
>
> When I run the above code in batch mode, I get the error:
> Error in x[[jj]][iseq] <- vjj : incompatible types (from NULL to
> character) in subassignment type fix
>
> I think the error is due to the fact that when the first warning message
> is generated, last.warning still does not exist in the function (but in
> some other environment), hence R is trying to assign NULL to a character.
>
> Can anyone tell me how to fix the above problem?
>
> Thanks.
>
> Best,
> Nitin
>
>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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.


  1   2   >