Re: [R] Difference between prcomp and cmdscale

2007-06-14 Thread michael watson \(IAH-C\)
Hi Mark

I think Brian Ripley answered this most effectively and succinctly.  I
did actually do quite a bit of googling and searching of the R help
before posting, and whilst there is quite a lot on each topic
individually, I failed to find articles that compare and contrast PCA
and MDS.  If you know of any, of course I would be happy to read them.

Many thanks
Mick

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Difford
Sent: 14 June 2007 12:49
To: r-help@stat.math.ethz.ch
Subject: Re: [R] Difference between prcomp and cmdscale


Michael,

Why should that confuse you?  Have you tried reading some of the
literature
on these methods?  There's plenty about them on the Net (Wiki's often a
goodish place to start)---and even in R, if you're prepared to look ;).

BestR,
Mark.


michael watson (IAH-C) wrote:
> 
> I'm looking for someone to explain the difference between these
> procedures.  The function prcomp() does principal components anaylsis,
> and the function cmdscale() does classical multi-dimensional scaling
> (also called principal coordinates analysis).
> 
> My confusion stems from the fact that they give very similar results:
> 
> my.d <- matrix(rnorm(50), ncol=5)
> rownames(my.d) <- paste("c", 1:10, sep="")
> # prcomp
> prc <- prcomp(my.d)
> # cmdscale
> mds <- cmdscale(dist(my.d))
> cor(prc$x[,1], mds[,1]) # produces 1 or -1
> cor(prc$x[,2], mds[,2]) # produces 1 or -1
> 
> Presumably, under the defaults for these commands in R, they carry out
> the same (or very similar) procedures?
> 
> Thanks
> Mick
> 
> The information contained in this message may be\ confiden...{{dropped}}

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


[R] Difference between prcomp and cmdscale

2007-06-14 Thread michael watson \(IAH-C\)
I'm looking for someone to explain the difference between these
procedures.  The function prcomp() does principal components anaylsis,
and the function cmdscale() does classical multi-dimensional scaling
(also called principal coordinates analysis).

My confusion stems from the fact that they give very similar results:

my.d <- matrix(rnorm(50), ncol=5)
rownames(my.d) <- paste("c", 1:10, sep="")
# prcomp
prc <- prcomp(my.d)
# cmdscale
mds <- cmdscale(dist(my.d))
cor(prc$x[,1], mds[,1]) # produces 1 or -1
cor(prc$x[,2], mds[,2]) # produces 1 or -1

Presumably, under the defaults for these commands in R, they carry out
the same (or very similar) procedures?

Thanks
Mick

The information contained in this message may be confidentia...{{dropped}}

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


Re: [R] open .r files with double-click

2007-06-09 Thread michael watson \(IAH-C\)
Hmmm.  Possibly your best bet is to create a batch file, runr.bat or something, 
and associate .r files with that.

The batch file would be something like:

"C:/Program Files/R/R-2.5.0/bin/Rgui.exe" --no-save < %1

(I think thats how you reference arguments in dos...)


-Original Message-
From: [EMAIL PROTECTED] on behalf of [EMAIL PROTECTED]
Sent: Fri 08/06/2007 7:52 PM
To: r-help@stat.math.ethz.ch
Subject: [R] open .r files with double-click
 
Hi Folks,
On Windows XP, R 2.5.0.

After reading the Installation for Windows and Windows FAQs,
I cannot resolve this.

I set file types so that Rgui.exe will open .r files.

When I try to open a .r file by double-clicking, R begins to launch,
but I get an error message saying

"Argument 'C:\Documents and Settings\Zoology\My Documents\trial.r' _ignored_"

I click OK, and then R GUI opens, but not the script file.

Is there a way to change this?

thanks,
Hank

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

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


Re: [R] Averaging across rows & columns

2007-06-07 Thread michael watson \(IAH-C\)
Check out rowMeans to average over replicate columns first, ie:

means <- data.frame(t1=rowMeans(a[,1:3]), 
t2=rowMeans(a[,4:6]),
etc)

Then, if you want to aggregate every 14 rows:

aggregate(means, by=list(rows=rep(1:(nrow(means)/14), each=14)), mean)

Or something...

-Original Message-
From: [EMAIL PROTECTED] on behalf of Silvia Lomascolo
Sent: Thu 07/06/2007 8:26 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Averaging across rows & columns
 

I use Windows, R version 2.4.1.

I have a dataset in which columns 1-3 are replicates, 4-6, are replicates,
etc. I need to calculate an average for every set of replicates (columns
1-3, 4-6, 7-9, etc.) AND each set of replicates should be averaged every 14
rows (for more detail, to measure fruit color using a spectrometer, I
recorded three readings per fruit -replicates- that I need to average to get
one reading per fruit; each row is a point in the light spectrum and I need
to calculate an average reading every 5nm -14 rows- for each fruit).

Someone proposed to another user who wanted an avg across columns to do

a <- matrix(rnorm(360),nr=10)
b <- rep(1:12,each=3)
avgmat <- aggregate(a,by=list(b))

I tried doing this to get started with the columns first but it asks for an
argument FUN that has no default.  The help for aggregate isn't helping me
much (a new R user) to discover what value to give to FUN -'average' doesn't
seem to exist, and 'sum' (whatever it is supposed to sum) gives an error
saying that arguments should have the same length-

Any help will be much appreciated! 
Silvia.
-- 
View this message in context: 
http://www.nabble.com/Averaging-across-rows---columns-tf3885900.html#a11014649
Sent from the R help mailing list archive at Nabble.com.

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

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


Re: [R] How to load a big txt file

2007-06-07 Thread michael watson \(IAH-C\)
Erm... Is that a typo?  Are we really talking 23800 rows and 49 columns?
Because that doesn't seem that many

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of ssls sddd
Sent: 07 June 2007 10:48
To: r-help@stat.math.ethz.ch
Subject: Re: [R] How to load a big txt file

Dear Chung-hong Chan,

Thanks! Can you recommend a text editor for splitting? I used UltraEdit
and TextPad but did not find they can split files.

Sincerely,

Alex

On 6/6/07, Chung-hong Chan <[EMAIL PROTECTED]> wrote:
>
> Easy solution will be split your big txt files by text editor.
>
> e.g. 5000 rows each.
>
> and then combine the dataframes together into one.
>
>
>
> On 6/7/07, ssls sddd <[EMAIL PROTECTED]> wrote:
> > Dear list,
> >
> > I need to read a big txt file (around 130Mb; 23800 rows and 49
columns)
> > for downstream clustering analysis.
> >
> > I first used "Tumor <- read.table("Tumor.txt",header = TRUE,sep =
"\t")"
> > but it took a long time and failed. However, it had no problem if I
just
> put
> > data of 3 columns.
> >
> > Is there any way which can load this big file?
> >
> > Thanks for any suggestions!
> >
> > Sincerely,
> >  Alex
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
> --
> "The scientists of today think deeply instead of clearly. One must be
> sane to think clearly, but one can think deeply and be quite insane."
> Nikola Tesla
> http://www.macgrass.com
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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

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


[R] Suppressing the large amount of white space in heatmap.2 in gplots

2007-06-07 Thread michael watson \(IAH-C\)
Hi

OK, quick question - I can suppress the calculation and drawing of the
column dendrogram by using Colv=FALSE and dendrogram="row", but that
leaves me with a large amount of white space at the top of the plot
where the dendrogram would have been drawn... Is there a way of getting
rid of that?

Thanks
Mick

The information contained in this message may be confidentia...{{dropped}}

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


Re: [R] Linear Discriminant Analysis

2007-06-06 Thread michael watson \(IAH-C\)
Region and Name are effectively the same variable
 
cor(olive[,4:11])

will also show you that there are strong correlations between some of the 
variables - this is something you might want to avoid



From: [EMAIL PROTECTED] on behalf of Soare Marcian-Alin
Sent: Wed 06/06/2007 4:45 PM
To: Uwe Ligges; R-help@stat.math.ethz.ch
Subject: Re: [R] Linear Discriminant Analysis



Thanks for explaining...

Im just sitting at the homework for 6 hours after taking for one week
antibiotica, because i had an amygdalitis...
I just wanted some tipps for solving this homework, but thanks, I will try
to get help on another way :)

I think i solved it, but I still get this Error :(

## Loading Data
library(MASS)
olive <- url("
http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/olive.R";)
print(load(olive))
dim(olive)
summary(olive)

index <- sample(nrow(olive), 286)

train  <- olive[index,-11]
test   <- olive[-index,-11]

summary(train)
summary(test)

table(train$Region)
table(test$Region)

# Linear Discriminant Analysis
z <- lda(Region ~ . , train)
zn <- predict(z, newdata=test)$class
mean(zn != test$Region)

2007/6/6, Uwe Ligges <[EMAIL PROTECTED]>:
>
>
> So what about asking your teacher (who seems to be Peter Filzmoser) and
> try to find out your homework yourself?
> You might want to think about some assumptions that must hold for LDA
> and look at the class of your explaining variables ...
>
> Uwe Ligges
>
>
>
> Soare Marcian-Alin wrote:
> > Hello,
> >
> > I want to make a linear discriminant analysis for the dataset olive, and
> I
> > get always this error:#
> > Warning message:
> > variables are collinear in: lda.default(x, grouping, ...)
> >
> > ## Loading Data
> > library(MASS)
> > olive <- url("
> >
> http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/olive.R
> ")
> > print(load(olive))
> >
> > y <- 1:572
> > x <- sample(y)
> > y1 <- x[1:286]
> >
> > train <- olive[y1,-11]
> > test  <- olive[-y1,-11]
> >
> > summary(train)
> > summary(test)
> >
> > table(train$Region)
> > table(test$Region)
> >
> > # Linear Discriminant Analysis
> > z <- lda(Region ~ . , train)
> > predict(z, train)
> >
> > z <- lda(Region ~ . , test)
> > predict(z, test)
> >
> > Thanks in advance!
> >
> >
> >
> > 
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>



--
Mit freundlichen Grüssen / Best Regards

Soare Marcian-Alin

[[alternative HTML version deleted]]

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


Re: [R] R help

2007-06-06 Thread michael watson \(IAH-C\)
Yes, but you need to be a bit more specific... When it comes to graphs
and drawing lines, there isn't much R can't do... 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of scott flemming
Sent: 06 June 2007 04:49
To: r-help@stat.math.ethz.ch
Subject: [R] R help

Hi,

I wonder whether R can finish the following project:

I want to make a chart to represent 10 genes. Each gene has orientation
and length. Therefore, a gene can be represented by arrows. 

Can R be used to draw 10 arrows in one line ?

scott

   
-

[[alternative HTML version deleted]]

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

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


Re: [R] A matrix with mixed character and numerical columns

2007-05-31 Thread michael watson \(IAH-C\)
OK, where is the best place to post these to to get them incorporated in
R? 

-Original Message-
From: Petr PIKAL [mailto:[EMAIL PROTECTED] 
Sent: 31 May 2007 14:23
To: michael watson (IAH-C)
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] A matrix with mixed character and numerical columns

[EMAIL PROTECTED] napsal dne 31.05.2007 14:32:01:

> What I am trying to do is create an x-y plot from the numerical
values,
> and the output of row() or col() gives me an excellent way of
> calculating an x- or y- co-ordinate, with the value in the data.frame
> being the other half of the pair.
> 
> Thanks for the code, Petr - I'm sure you would agree, however, that
it's
> a bit 'clumsy' (no fault of yours).
> 
> Can we just adjust row() and col() for data.frames?
> 
> col <- function (x, as.factor = FALSE)
> {
> if (is.data.frame(x)) {
>   x <- as.matrix(x)
> }
> if (as.factor)
> factor(.Internal(col(x)), labels = colnames(x))
> else .Internal(col(x))
> }
> 
> row <- function (x, as.factor = FALSE) 
> {
> if (is.data.frame(x)) {
>   x <- as.matrix(x)
> }
> if (as.factor) 
> factor(.Internal(row(x)), labels = rownames(x))
> else .Internal(row(x))
> }
> 
> Is there any reason why these won't work?  Am I oversimplifying it?

Seems to me that both works. At least on data.frame I tried it.

Regards
Petr

> 
> Mick
> -Original Message-
> From: Petr PIKAL [mailto:[EMAIL PROTECTED] 
> Sent: 31 May 2007 12:57
> To: michael watson (IAH-C)
> Cc: r-help@stat.math.ethz.ch
> Subject: Odp: [R] A matrix with mixed character and numerical columns
> 
> Hi
> [EMAIL PROTECTED] napsal dne 31.05.2007 12:48:11:
> 
> > Is it possible to have one?
> > 
> > I have a data.frame with two character columns and 6 numerical
> columns.
> > 
> > I converted to a matrix as I needed to use the col() and row()
> > functions.
> > However, if I convert the data.frame to a matrix, using as.matrix,
the
> > numerical columns get converted to characters, and that messes up
some
> > of the calculations.
> > 
> > Do I really have to split it up into two matrices, one character and
> the
> > other numerical, just so I can use the col() and row() functions?
Are
> > there equivalent functions for data.frames?
> 
> AFAIK I do not remember equivalent functions for data frame. If you
just
> 
> want column or row index you can use
> 
> 1:dim(DF)[1] or 1:dim(DF)[2] for rows and columns
> 
> if you want repeat these indexes row or columnwise use
> 
> rrr<-rep(1:dim(DF)[1], dim(DF)[2])
> matrix(rrr,dim(DF)[1], dim(DF)[2])
> 
> rrr<-rep(1:dim(DF)[2], dim(DF)[1])
> matrix(rrr,dim(DF)[1], dim(DF)[2], byrow=T)
> 
> Regards
> Petr
> 
> 
> 
> > 
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] A matrix with mixed character and numerical columns

2007-05-31 Thread michael watson \(IAH-C\)
What I am trying to do is create an x-y plot from the numerical values,
and the output of row() or col() gives me an excellent way of
calculating an x- or y- co-ordinate, with the value in the data.frame
being the other half of the pair.

Thanks for the code, Petr - I'm sure you would agree, however, that it's
a bit 'clumsy' (no fault of yours).

Can we just adjust row() and col() for data.frames?

col <- function (x, as.factor = FALSE)
{
if (is.data.frame(x)) {
  x <- as.matrix(x)
}
if (as.factor)
factor(.Internal(col(x)), labels = colnames(x))
else .Internal(col(x))
}

row <- function (x, as.factor = FALSE) 
{
if (is.data.frame(x)) {
  x <- as.matrix(x)
}
if (as.factor) 
factor(.Internal(row(x)), labels = rownames(x))
else .Internal(row(x))
}

Is there any reason why these won't work?  Am I oversimplifying it?

Mick
-Original Message-
From: Petr PIKAL [mailto:[EMAIL PROTECTED] 
Sent: 31 May 2007 12:57
To: michael watson (IAH-C)
Cc: r-help@stat.math.ethz.ch
Subject: Odp: [R] A matrix with mixed character and numerical columns

Hi
[EMAIL PROTECTED] napsal dne 31.05.2007 12:48:11:

> Is it possible to have one?
> 
> I have a data.frame with two character columns and 6 numerical
columns.
> 
> I converted to a matrix as I needed to use the col() and row()
> functions.
> However, if I convert the data.frame to a matrix, using as.matrix, the
> numerical columns get converted to characters, and that messes up some
> of the calculations.
> 
> Do I really have to split it up into two matrices, one character and
the
> other numerical, just so I can use the col() and row() functions?  Are
> there equivalent functions for data.frames?

AFAIK I do not remember equivalent functions for data frame. If you just

want column or row index you can use

1:dim(DF)[1] or 1:dim(DF)[2] for rows and columns

if you want repeat these indexes row or columnwise use

rrr<-rep(1:dim(DF)[1], dim(DF)[2])
matrix(rrr,dim(DF)[1], dim(DF)[2])

rrr<-rep(1:dim(DF)[2], dim(DF)[1])
matrix(rrr,dim(DF)[1], dim(DF)[2], byrow=T)

Regards
Petr



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

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


Re: [R] Where is CRAN mirror address stored?

2007-05-31 Thread michael watson \(IAH-C\)
chooseCRANmirror() 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Vladimir Eremeev
Sent: 31 May 2007 12:14
To: r-help@stat.math.ethz.ch
Subject: [R] Where is CRAN mirror address stored?


When I update.packages(), R shows the dialog window, listing CRAN
mirrors and
asks to choose the CRAN mirror to use in this session. Then, R uses this
address and never asks again until quit.

Is there any way to make R ask for the CRAN mirror again, except
restarting
it?

I am just trying to save typing, because sometimes my internet
connection
with CRAN becomes too slow, and mirrors disappear.


-- 
View this message in context:
http://www.nabble.com/Where-is-CRAN-mirror-address-stored--tf3845953.htm
l#a10891857
Sent from the R help mailing list archive at Nabble.com.

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

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


[R] A matrix with mixed character and numerical columns

2007-05-31 Thread michael watson \(IAH-C\)
Is it possible to have one?

I have a data.frame with two character columns and 6 numerical columns.

I converted to a matrix as I needed to use the col() and row()
functions.
However, if I convert the data.frame to a matrix, using as.matrix, the
numerical columns get converted to characters, and that messes up some
of the calculations.

Do I really have to split it up into two matrices, one character and the
other numerical, just so I can use the col() and row() functions?  Are
there equivalent functions for data.frames?

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


Re: [R] sizing and saving graphics in R

2007-05-31 Thread michael watson \(IAH-C\)
There is also the functions pdf(), jpeg(), bmp() and png() 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Murray Pung
Sent: 31 May 2007 01:22
To: Felicity Jones
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] sizing and saving graphics in R

I use the savePlot function for saving graphics. The following will save
the
active graphics panel in your working directory, in format wmf, which I
find
has a high resolution. Check out other possible formats in help.

savePlot(filename = "myfilename",type = c("wmf"))

Murray



On 31/05/07, Felicity Jones <[EMAIL PROTECTED]> wrote:
>
>
> Dear R wizards,
>
> I am seeking advice on graphics in R.  Specifically, how to manipulate
> the size and save a plot I have produced using the LDheatmap library.
> I confess I am relatively new to graphics in R, but I would greatly
> appreciate any suggestions you may have.
>
> LDheatmap produces a coloured triangular matrix of pairwise
> associations between 600 genetic markers in my dataset.  Initially the
> graphical output was confined to the computer screen, such that each
> pairwise marker association was displayed as approximately 1 pixel
> (too small for me to interpret).
>
> I have successfully managed to play with the LDheatmap function to
> enlarge the size of viewport by changing the following code in
> LDheatmap
>
> #From
>
> heatmapVP <- viewport(width = unit(0.8, "snpc"), height = unit(0.8,
> "snpc"),
> name=vp.name)
>
> #To
> heatmapVP <- viewport(width = unit(25, "inches"), height = unit(25,
> "inches"), name=vp.name)
>
> This produces a much larger plot (so big that the majority is not seen
> on the screen).  I would like to save the entire thing so that I can
> import it into photoshop or some other image software.
>
> My problem is that when I save using the R graphics console
> (File->Save As->bmp), it only saves the section I can see on the
> screen.  Any suggestions on how to save the whole plot or manipulate
> the plot so I get higher resolution would be much appreciated.
>
> Thanks for your help in advance,
>
> Felicity.
>
>
>
>
>
>
>
>
> ___
>
> Dr Felicity Jones
> Department of Developmental Biology
> Stanford University School of Medicine
> Beckman Center
> 279 Campus Drive
> Stanford CA 94305-5329
> USA
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Murray Pung
Statistician, Datapharm Australia Pty Ltd
0404 273 283

[[alternative HTML version deleted]]

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

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


Re: [R] opinions please: text editors and reporting/Sweave?

2007-05-30 Thread michael watson \(IAH-C\)
Have you tried R2HTML, or is HTML not what you're looking for?


-Original Message-
From: [EMAIL PROTECTED] on behalf of Tim Howard
Sent: Wed 30/05/2007 9:43 PM
To: r-help@stat.math.ethz.ch
Subject: [R] opinions please: text editors and reporting/Sweave?
 
dear all - 

I currently use Tinn-R as my text editor to work with code that I submit to R, 
with some output dumped to text files, some images dumped to pdf. (system: 
Windows 2K and XP, R 2.4.1 and R 2.5). We are using R for overnight runs to 
create large output data files for GIS, but then I need simple output reports 
for analysis results for each separate data set. Thus, I create many reports of 
the same style, but just based on different input data.

I am recognizing that I need a better reporting system, so that I can create 
clean reports for each separate R run. This obviously means using Sweave and 
some implementation of LaTex, both of which are new to me. I've installed 
MikTex and successfully completed a demo or two for creating pdfs from raw 
LaTeX.

It appears that if I want to ease my entry into the world of LaTeX, I might 
need to switch editors to something like Emacs (I read somewhere that Emacs 
helps with the TeX markup?). After quite a while wallowing at the Emacs site, I 
am finding that ESS is well integrated with R and might be the way to go. 
Aaaagh... I'm in way over my head!

My questions:

What, in your opinion, is the simplest way to integrate text and graphics 
reports into a single report such as a pdf file. 

If the answer to this is LaTeX and Sweave, is it difficult to use a text editor 
such as Tinn-R or would you strongly recommend I leave behind Tinn and move 
over to an editor that has more LaTeX help?  

In reading over Friedrich Leisch's "Sweave User Manual" (v 1.6.0) I am 
beginning to think I can do everything I need with my simple editor. Before 
spending many hours going down that path, I thought it prudent to ask the R 
community.

It is likely I am misunderstanding some of the process here and any 
clarifications are welcome. 

Thank you in advance for any thoughts. 
Tim Howard

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

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


Re: [R] matrix in data.frame

2007-05-30 Thread michael watson \(IAH-C\)
Have you thought of using a list?

> a <- matrix(1:10, nrow=2)
> b <- 1:5
> x <- list(a=a, b=b)
> x
$a
 [,1] [,2] [,3] [,4] [,5]
[1,]13579
[2,]2468   10

$b
[1] 1 2 3 4 5

> x$a
 [,1] [,2] [,3] [,4] [,5]
[1,]13579
[2,]2468   10
> x$b
[1] 1 2 3 4 5
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lina
Hultin-Rosenberg
Sent: 30 May 2007 10:26
To: r-help@stat.math.ethz.ch
Subject: [R] matrix in data.frame

Dear list!

I have run into a problem that seems very simple but I can't find any
solution to it (have searched the internet, help-files and "An
introduction
to R" etc without any luck). The problem is the following: I would like
to
create a data.frame with two components (columns), the first component
being
a matrix and the second component a vector. Whatever I have tried so
far, I
end up with a data.frame containing all the columns from the matrix plus
the
vector which is not what I am after. I have seen this kind of data.frame
among R example datasets (oliveoil and yarn).

I would greatly appreciate some help with this problem!

Kind regards,

Lina Hultin Rosenberg
Karolinska Biomics Center
Karolinska Institute
Sweden

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

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


[R] Help me understand colours on linux

2007-05-30 Thread michael watson \(IAH-C\)
Hi

Here is my sessionInfo():

Version 2.3.1 (2006-06-01) 
i686-redhat-linux-gnu 

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

I have a function that is trying to draw rectangles using 136 different
colours, and I get the following error:

Error in rect(xstart, my.min, xstart + fcount[i, 2], my.max, col =
fcolors[i],  : 
Error: X11 cannot allocate additional graphics colours.
Consider using X11 with colortype="pseudo.cube" or "gray".

However, if I use "pseudo.cube" I don't get anywhere near enough
distinct colours.  I could use gray, but I would prefer colour.  So,
questions:

1) is there any set of options I can use which will actually let me
create that many colours?
2) if not, how do I test if there is not, and implement gray instead of
colours?  This function and package works on windows, and it works with
less colours.  I guess I could try and trap the error, and if I can, go
back and re-run the function with "options(X11colortype="gray")" but I'd
prefer something more elegant... What I'm looking for is some test where
I can say "If you're going to fail, X11colortype='gray', else
X11colortype='true'".  Possible?

Many thanks
Mick

The information contained in this message may be confidentia...{{dropped}}

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


Re: [R] Running R in Bash and R GUI

2007-05-25 Thread michael watson \(IAH-C\)
There are two things that occur.  Firstly, I normally have to unset
no_proxy:

%> unset no_proxy; R

Secondly, if for some reason http_proxy isn't being seen in R, you can
use the Sys.putenv() function within R to manipulate the environment

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 24 May 2007 16:05
To: R-help@stat.math.ethz.ch
Subject: [R] Running R in Bash and R GUI

I have been trying to get the R and package update functions in the  
GUI version of R to work on my Mac.

Initially I got error messages that suggested I needed to set up the  
http_proxy for GUI R to use, but how can this be done?

I eventually got to the point of writing a .bash_profile file in the  
Bash terminal and setting the proxy addresses there.

I can now use my Bash terminal, invoke R, and run the update /  
install commands and they work!

The problem that still remains is that in the R console of the GUI  
R,  the http_proxy is not seen and thus I cannot connect to CRAN or  
any other mirror using the GUI functions in the pull-down menus.

I get

 > update.packages ()
Warning: unable to access index for repository http://cran.uk.r- 
project.org/bin/macosx/universal/contrib/2.5
 >

Basically it still seems unable to access port 80.

Is there a way of solving this so that I can use both terminals  
rather than just everything through Bash?

Thanks


Steve Hodgkinson

University of Brighton

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

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


Re: [R] how to change font size in HTML output

2007-05-24 Thread michael watson \(IAH-C\)
You could always modify the .css file that R2HTML outputs... the default is 
R2HTML.css



From: [EMAIL PROTECTED] on behalf of Bos, Roger
Sent: Thu 24/05/2007 2:58 PM
To: r-help@stat.math.ethz.ch
Subject: [R] how to change font size in HTML output



I have not been able to figure out how to change the font size for
R2HTML::HTML output.  Or for output from prettyR::htmlize.  If anyone
can give me a couple hints that would be great.

Thanks,

Roger J. Bos


** *
This message is for the named person's use only. It may
contain confidential, proprietary or legally privileged
information. No right to confidential or privileged treatment
of this message is waived or lost by any error in
transmission. If you have received this message in error,
please immediately notify the sender by e-mail,
delete the message and all copies from your system and destroy
any hard copies. You must not, directly or indirectly, use,
disclose, distribute, print or copy any part of this message
if you are not the intended recipient.
**
[[alternative HTML version deleted]]

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

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


Re: [R] Fonts do not display properly on Red Hat

2007-05-24 Thread michael watson \(IAH-C\)
Brian

sessionInfo() gives me:

Version 2.3.1 (2006-06-01) 
i686-redhat-linux-gnu 

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

Thanks for the answer

Michael

-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Sent: 23 May 2007 11:40
To: michael watson (IAH-C)
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Fonts do not display properly on Red Hat

Are you using a UTF-8 locale?  (You know, there are good reasons why the

posting guide asks for sessionInfo() output.)

If so, the problem is probably with the non-availability of fonts in 
ISO10646 encoding, and you may well find that the R update suggested 
(before posting) in the posting guide will help.  But you may have to
run 
R in e.g. en_GB to get satisfactory results from an old version of R on
an 
old OS.

On Wed, 23 May 2007, michael watson (IAH-C) wrote:

> Hi
>
> I'm using R version 2.3.1 on Red Hat Enterprise Server 3.
>
> When I run a simple:
>
> plot(1:10,1:10)
>
> The plot comes out great, but the fonts are displayed wrongly:
>
> http://coxpress.sourceforge.net/test.jpg
>
> I realise this is probably not an R problem per se, but before I go
> messing about with my fonts, can someone tell me which fonts R (or
X11)
> is trying to display, where they might be installed and any suggestion
> as to why they're not being displayed properly...
>
> Thanks
> Mick
>
> The information contained in this message may be\ confiden...{{dropped}}

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


[R] Fonts do not display properly on Red Hat

2007-05-23 Thread michael watson \(IAH-C\)
Hi

I'm using R version 2.3.1 on Red Hat Enterprise Server 3. 

When I run a simple:

plot(1:10,1:10)

The plot comes out great, but the fonts are displayed wrongly:

http://coxpress.sourceforge.net/test.jpg

I realise this is probably not an R problem per se, but before I go messing 
about with my fonts, can someone tell me which fonts R (or X11) is trying to 
display, where they might be installed and any suggestion as to why they're not 
being displayed properly...

Thanks
Mick

The information contained in this message may be confidentia...{{dropped}}

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


[R] Fonts do not display properly on Red Hat

2007-05-23 Thread michael watson \(IAH-C\)
Hi

I'm using R version 2.3.1 on Red Hat Enterprise Server 3.  

When I run a simple:

plot(1:10,1:10)

The plot comes out great, but the fonts are displayed wrongly:

http://coxpress.sourceforge.net/test.jpg

I realise this is probably not an R problem per se, but before I go
messing about with my fonts, can someone tell me which fonts R (or X11)
is trying to display, where they might be installed and any suggestion
as to why they're not being displayed properly...

Thanks
Mick

The information contained in this message may be confidentia...{{dropped}}

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


Re: [R] Including data when building an R package in windows

2007-05-09 Thread michael watson \(IAH-C\)
Turns out calling the file DetectiV.rda (rather than .Rdata) fixed it.
Odd.


-Original Message-
From: michael watson (IAH-C)
Sent: Wed 09/05/2007 11:09 AM
To: michael watson (IAH-C); r-help@stat.math.ethz.ch
Subject: RE: [R] Including data when building an R package in windows
 
I forgot to mention.  After using package.skeleton(), I replaced the six .rda 
files with a single .Rdata file that contained all six data frames.

-Original Message-
From: [EMAIL PROTECTED] on behalf of michael watson (IAH-C)
Sent: Wed 09/05/2007 10:58 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Including data when building an R package in windows
 
I've done this before, but when I tried the same thing this time, it didn't 
work.

I'm using R 2.4.1 on windows.

I have 6 data frames that I want to include in a package I am building.  
Instead of making users issue six different "data(...)" commands, I want to 
wrap them all up in one file so that users issue one "data(...)" command and 
have access to all six data sets.

I had the functions and data loaded in R, nothing else, used package.skeleton() 
to create the structure.

Edited everything I needed to (help etc)

Ran "R CMD INSTALL --build DetectiV" in MS-DOS, the package built.

Installed the zip file.  Everything fine.

In R:

>library(DetectiV)
>data(DetectiV)
Warning message:
data set 'DetectiV' not found in: data(DetectiV) 

C:\Program Files\R\R-2.4.1\library\DetectiV\data contains filelist and 
Rdata.zip.

filelist is:

DetectiV.Rdata
filelist

Rdata.zip contains a file called DetectiV.Rdata.

This the exact same structure I have in place for another of my packages - and 
that one works when I issue data(...) commands, whereas this one doesn't.

So, any ideas what I am doing wrong?

Thanks
Mick

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

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


Re: [R] Including data when building an R package in windows

2007-05-09 Thread michael watson \(IAH-C\)
I forgot to mention.  After using package.skeleton(), I replaced the six .rda 
files with a single .Rdata file that contained all six data frames.

-Original Message-
From: [EMAIL PROTECTED] on behalf of michael watson (IAH-C)
Sent: Wed 09/05/2007 10:58 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Including data when building an R package in windows
 
I've done this before, but when I tried the same thing this time, it didn't 
work.

I'm using R 2.4.1 on windows.

I have 6 data frames that I want to include in a package I am building.  
Instead of making users issue six different "data(...)" commands, I want to 
wrap them all up in one file so that users issue one "data(...)" command and 
have access to all six data sets.

I had the functions and data loaded in R, nothing else, used package.skeleton() 
to create the structure.

Edited everything I needed to (help etc)

Ran "R CMD INSTALL --build DetectiV" in MS-DOS, the package built.

Installed the zip file.  Everything fine.

In R:

>library(DetectiV)
>data(DetectiV)
Warning message:
data set 'DetectiV' not found in: data(DetectiV) 

C:\Program Files\R\R-2.4.1\library\DetectiV\data contains filelist and 
Rdata.zip.

filelist is:

DetectiV.Rdata
filelist

Rdata.zip contains a file called DetectiV.Rdata.

This the exact same structure I have in place for another of my packages - and 
that one works when I issue data(...) commands, whereas this one doesn't.

So, any ideas what I am doing wrong?

Thanks
Mick

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

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


[R] Including data when building an R package in windows

2007-05-09 Thread michael watson \(IAH-C\)
I've done this before, but when I tried the same thing this time, it didn't 
work.

I'm using R 2.4.1 on windows.

I have 6 data frames that I want to include in a package I am building.  
Instead of making users issue six different "data(...)" commands, I want to 
wrap them all up in one file so that users issue one "data(...)" command and 
have access to all six data sets.

I had the functions and data loaded in R, nothing else, used package.skeleton() 
to create the structure.

Edited everything I needed to (help etc)

Ran "R CMD INSTALL --build DetectiV" in MS-DOS, the package built.

Installed the zip file.  Everything fine.

In R:

>library(DetectiV)
>data(DetectiV)
Warning message:
data set 'DetectiV' not found in: data(DetectiV) 

C:\Program Files\R\R-2.4.1\library\DetectiV\data contains filelist and 
Rdata.zip.

filelist is:

DetectiV.Rdata
filelist

Rdata.zip contains a file called DetectiV.Rdata.

This the exact same structure I have in place for another of my packages - and 
that one works when I issue data(...) commands, whereas this one doesn't.

So, any ideas what I am doing wrong?

Thanks
Mick

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


Re: [R] Google Custom Search Engine for R

2007-02-23 Thread michael watson \(IAH-C\)
I always just google for the terms I want and then add R-help to the search, 
which limits it to the R-help mailing list.  It's quite effective.



From: [EMAIL PROTECTED] on behalf of Matthew Keller
Sent: Fri 23/02/2007 3:51 PM
To: Sérgio Nunes
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Google Custom Search Engine for R



Hi Sergio,

There was a discussion on this board recently about the difficulty of
searching for "R" related material on the web. I think the custom
google search engine is a good idea. It would be helpful if we could
have access to the full list of websites it is indexing so that we
could make suggestions about other sites that are missing. As it is,
it only tells us that there are 35 websites, and shows us the first
several.

Also, you might check out Sasha Goodman's Rseek: http://www.rseek.org/

Have you tried to compare the success of yours with Rseek?

All the Best,

Matt

On 2/23/07, Sérgio Nunes <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Since "R" is a (very) generic name, I've been having some trouble
> searching the web for this topic. Due to this, I've just created a
> Google Custom Search Engine that includes several of the most relevant
> sites that have information on R.
>
> See it in action at:
>
> http://google.com/coop/cse?cx=018133866098353049407%3Aozv9awtetwy
>
> This is really a preliminary test. Feel free to add yourself to the
> project and contribute with suggestions.
>
> Sérgio Nunes
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


--
Matthew C Keller
Postdoctoral Fellow
Virginia Institute for Psychiatric and Behavioral Genetics

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

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


Re: [R] Sorting a data frame when you don't know the columns

2006-11-28 Thread michael watson \(IAH-C\)
Thanks guys, sorted now :)



From: Peter Dalgaard [mailto:[EMAIL PROTECTED]
Sent: Tue 28/11/2006 11:05 AM
To: Gabor Grothendieck
Cc: michael watson (IAH-C); r-help@stat.math.ethz.ch
Subject: Re: [R] Sorting a data frame when you don't know the columns



Gabor Grothendieck wrote:
> DF <- data.frame(a = c(3, 4, 2, 3, 2, 4, 2), b = 7:1))
> DF[do.call(order, DF),]
>
> will sort on all the columns.
... and you can use

DF[do.call(order, DF[names]),]

if you have the column names in a character vector.

>
> On 11/28/06, michael watson (IAH-C) <[EMAIL PROTECTED]> wrote:
>> Hi
>>
>> Sorry to ask such a well oiled question, but even with multiple google hits 
>> I don't think this has been answered very well.
>>
>> It's all well and good doing a sort of a data frame on multiple columns when 
>> you know in advance which columns you want to sort on, but what about when 
>> the names of the columns you wish to sort on are in a vector?
>>
>> At the minute I'm messing about with paste() to form a string that works for 
>> order() and then calling do.call().  Is this really the best way of doing it?
>>
>> Thanks
>> Mick
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


[R] Sorting a data frame when you don't know the columns

2006-11-28 Thread michael watson \(IAH-C\)
Hi
 
Sorry to ask such a well oiled question, but even with multiple google hits I 
don't think this has been answered very well.
 
It's all well and good doing a sort of a data frame on multiple columns when 
you know in advance which columns you want to sort on, but what about when the 
names of the columns you wish to sort on are in a vector?
 
At the minute I'm messing about with paste() to form a string that works for 
order() and then calling do.call().  Is this really the best way of doing it?
 
Thanks
Mick

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


Re: [R] Colour-coded Editor for R Code

2006-11-06 Thread michael watson \(IAH-C\)
Tinn-R



From: [EMAIL PROTECTED] on behalf of Jon Minton
Sent: Mon 06/11/2006 9:11 AM
To: R-help@stat.math.ethz.ch
Subject: [R] Colour-coded Editor for R Code



Do any of you know any simple programming editors for R scripts which offer
basic colour-coding and bracket-matching facilities?

Dregging through scripts to find a missing comma or parentheses is something
I'd rather do less of...



Jon Minton






[[alternative HTML version deleted]]

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

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


[R] Finding out about objects and classes

2006-10-17 Thread michael watson \(IAH-C\)
When R help simply states something like:

Value:

 An object of class '"loess"'.

How do I find out more about that class?  Shouldn't there be a link in
the help file or something?

ATB
Mick

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


[R] Faster alternative to by?

2006-07-26 Thread michael watson \(IAH-C\)
Hi

I have a data.frame, two columns, 12304 rows.  Both columns are factors.
I want to do an equivalent of an SQL "group by" statement, and count the
number of rows in the data frame for each unique value of the second
column.

I have:

countl <- by(mapped, mapped$col2, nrow)

Now, mapped$col2 has 10588 levels, so this statement takes a really long
time to run.  Is there a more efficient way of doing this in R?

Thanks

Mick

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


Re: [R] Plotting lines and points on the second plot when usinggap.plot in plotrix

2006-07-19 Thread michael watson \(IAH-C\)
I've answered my own question, the x-values of the line/points I want to
plot must be adjusted by the gap size

Thanks
Mick 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of michael watson
(IAH-C)
Sent: 19 July 2006 11:58
To: r-help@stat.math.ethz.ch
Subject: [R] Plotting lines and points on the second plot when
usinggap.plot in plotrix

Hi

My question is simple - the gap.plot function in the plotrix package
allows users to draw graphs that have a broken axis.  However, I want to
then add a line to the "second" plot, but can't.

Eg:

twogrp<-c(rnorm(10)+4,rnorm(10)+20)
gap.plot(twogrp,rnorm(20),gap.bounds=c(8,16),gap.axis="x",xlab="X
values",
   xtics=c(4,7,17,20),ylab="Y values",main="Plot gap on X axis") 

# this doesn't work
points(17,0,col="red")

# this does work
points(4,0,col="green")

I somehow need to set the focus to the second plot so that I can draw
lines and points on it.

Any help?

Mick

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

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


[R] Plotting lines and points on the second plot when using gap.plot in plotrix

2006-07-19 Thread michael watson \(IAH-C\)
Hi

My question is simple - the gap.plot function in the plotrix package
allows users to draw graphs that have a broken axis.  However, I want to
then add a line to the "second" plot, but can't.

Eg:

twogrp<-c(rnorm(10)+4,rnorm(10)+20)
gap.plot(twogrp,rnorm(20),gap.bounds=c(8,16),gap.axis="x",xlab="X
values",
   xtics=c(4,7,17,20),ylab="Y values",main="Plot gap on X axis") 

# this doesn't work
points(17,0,col="red")

# this does work
points(4,0,col="green")

I somehow need to set the focus to the second plot so that I can draw
lines and points on it.

Any help?

Mick

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


Re: [R] Generating random normal distribution with mean 0 and standarddeviation 1

2006-07-14 Thread michael watson \(IAH-C\)
See rnorm() 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Neuro 
LeSuperHéros
Sent: 14 July 2006 13:15
To: r-help@stat.math.ethz.ch
Subject: [R] Generating random normal distribution with mean 0 and 
standarddeviation 1

Hello,

This must be really simple, but I can't find it on R Site search.  I need to 
generate a random normally distributed series with mean 0 and sd 1. In 
Matlab, this code is randn(n).

The closest I found is runif(20,-1,1) but this forces a maximum and a 
minimum, and there's no way to specify a standard deviation of 1.

>sd(runif(20,-1,1))
[1] 0.578164

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

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


Re: [R] FW: How to create a new package?

2006-06-01 Thread michael watson \(IAH-C\)
In that case, I have found the following useful:

http://www.biostat.jhsph.edu/~kbroman/Rintro/Rwinpack.html 

-Original Message-
From: Uwe Ligges [mailto:[EMAIL PROTECTED] 
Sent: 01 June 2006 12:43
To: michael watson (IAH-C)
Cc: Gabor Grothendieck; Rita Sousa; r-help@stat.math.ethz.ch
Subject: Re: [R] FW: How to create a new package?

michael watson (IAH-C) wrote:

> ?package.skeleton


Folks, please!


Rita Sousa told you she already has a DESCRIPTION file.

Obviously, Rita forgot to build and *install* the package using
R CMD build
and
R CMD INSTALL

(the Meta directory is creating during the installation procedure)

Please note that using the Windows GUI, you can only install binary 
packages, but you have got a source package so far. Hence you need to 
install from the Windows command shell using R CMD INSTALL.

Please see the R Installation and Administration manual on how to 
install packages. For some examples of what is mentioned in that manual 
(how to set stuff up in Windows), you might additionally want to take a 
look into the article "R Help Desk: Make `R CMD' Work under Windows - an 
Example" in R News 5 (2), 27-28.

Best,
Uwe Ligges



> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabor 
> Grothendieck
> Sent: 01 June 2006 12:20
> To: Rita Sousa
> Cc: r-help@stat.math.ethz.ch
> Subject: Re: [R] FW: How to create a new package?
> 
> The minimum is to create a DESCRIPTION file, plus R and man directories 
> containing R code and .Rd files respectively.
> It might help to run  Rcmd CHECK mypkg  before installation and fix any 
> problems it finds.
> 
> Googling for   creating R package   will locate some tutorials.
> 
> 
> On 6/1/06, Rita Sousa <[EMAIL PROTECTED]> wrote:
> 
>>Hi,
>>
>>
>>
>>I'm a group of functions and I would like to create a package for load in R.
>>I have created a directory named INE and a directory below that named 
>>R, for the files of R functions. A have created the files DESCRIPTION 
>>and INDEX in the INE directory. The installation from local zip files, 
>>in the R 2.3.0, results but to load the package I get an error like:
>>
>>
>>
>>'INE' is not a valid package -- installed < 2.0.0?
>>
>>
>>
>>I think that is necessary create a Meta directory with package.rds 
>>file, but I don't know make it! I have read the manual 'Writing R Extensions 
>>- 1.
>>Creating R packages' but I don't understand the procedure...
>>
>>Can I create it automatically?
>>
>>
>>
>>Could you help me with this?
>>
>>
>>
>>Thanks,
>>
>>---
>>Rita Sousa
>>DME - ME: Departamento de Metodologia Estatística - Métodos 
>>Estatísticos INE - DRP: Instituto Nacional de Estatística - Delegação 
>>Regional do Porto
>>Tel.: 22 6072016 (Extensão: 4116)
>>---
>>
>>
>>
>>
>>   [[alternative HTML version deleted]]
>>
>>
>>
>>__
>>R-help@stat.math.ethz.ch mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide! 
>>http://www.R-project.org/posting-guide.html
>>
>>
> 
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] FW: How to create a new package?

2006-06-01 Thread michael watson \(IAH-C\)
?package.skeleton 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabor 
Grothendieck
Sent: 01 June 2006 12:20
To: Rita Sousa
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] FW: How to create a new package?

The minimum is to create a DESCRIPTION file, plus R and man directories 
containing R code and .Rd files respectively.
It might help to run  Rcmd CHECK mypkg  before installation and fix any 
problems it finds.

Googling for   creating R package   will locate some tutorials.


On 6/1/06, Rita Sousa <[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
> I'm a group of functions and I would like to create a package for load in R.
> I have created a directory named INE and a directory below that named 
> R, for the files of R functions. A have created the files DESCRIPTION 
> and INDEX in the INE directory. The installation from local zip files, 
> in the R 2.3.0, results but to load the package I get an error like:
>
>
>
> 'INE' is not a valid package -- installed < 2.0.0?
>
>
>
> I think that is necessary create a Meta directory with package.rds 
> file, but I don't know make it! I have read the manual 'Writing R Extensions 
> - 1.
> Creating R packages' but I don't understand the procedure...
>
> Can I create it automatically?
>
>
>
> Could you help me with this?
>
>
>
> Thanks,
>
> ---
> Rita Sousa
> DME - ME: Departamento de Metodologia Estatística - Métodos 
> Estatísticos INE - DRP: Instituto Nacional de Estatística - Delegação 
> Regional do Porto
> Tel.: 22 6072016 (Extensão: 4116)
> ---
>
>
>
>
>[[alternative HTML version deleted]]
>
>
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>
>

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

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


[R] lapply and list attributes

2006-03-10 Thread michael watson \(IAH-C\)
Hi

I have a list that has attributes:

attributes(lis[2])
$names
[1] "150096_at"

I want to use those attributes in a function and then use lapply to
apply that function to every element of the list, eg for simplicity's
sake:

my.fun <- function(x) {
attributes(x)
}

Then

l2 <- lapply(lis, my.fun)

It seems that "attributes(x)" within the function is not the same as eg.
"attributes(lis[2])" used outside of the function, ie the attributes
have changed.

Help for someone who's trying to understand lists?

Many thanks
Mick 


[[alternative HTML version deleted]]

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


Re: [R] Identifying or searching for labels in a hclust/dendrogram/heatmap

2006-03-09 Thread michael watson \(IAH-C\)
Hi Sean
 
Thanks for the help, but I really wanted to do this in R :)
 
Any suggestions?
 
Mick



From: Sean Davis [mailto:[EMAIL PROTECTED]
Sent: Thu 09/03/2006 1:01 PM
To: michael watson (IAH-C); r-help
Subject: Re: [R] Identifying or searching for labels in a 
hclust/dendrogram/heatmap






On 3/9/06 7:47 AM, "michael watson (IAH-C)" <[EMAIL PROTECTED]>
wrote:

> Hi
> 
> Sorry if this is in the help :-S
> 
> I've looked at example(dendrogram) and though it gives some indication of what
> I want, it doesn't do all.
> 
> OK, so here is what I want to do: draw a tree, and then have an action, on
> user-click, to either draw a sub tree or a plot of the data.  I also want
> users to be able to search for a particular label and have it highlighted on
> the tree, say in red, where all the other labels are black.
> 
> Now, the only tree I can use the "user-click" with is an hclust object, with
> the identify.hclust() function.  As far as I know, neither the dendrogram
> objects or the output of heatmap is cut-able in this way.  So I have the
> sub-tree and plot drawing set up on user-click using an hclust object and
> identify.hclust - good :)
> 
> Therefore I am working with hclust objects (which is a shame as the dendrogram
> and heatmap objects look prettier) but I can cope.  How do I then go on and
> highlight a single label, or group of labels, when I have plotted the hclust
> object?  Can I highlight labels on dendrograms and heatmaps 2?
> 
> I can just imagine that after a user has drawn the tree, they will want to
> know where their genes of interest actually lie within that tree.
> 
> I'm happy to share the completed code when I have sorted all of this out

Mick,

I personally would make use of the ctc package (bioconductor) to output data
to Treeview (and/or cluster).  R may be able to do this, but interaction
with graphics still leaves a bit to be desired in R (at least as compared to
a dedicated, specialized Java App), particularly once you get beyond about
50 genes.  Treeview is just much better set up for this kinda stuff.  You
could probably automate the process given, for example, a limma MAList or
fit object, or something like that.

That said, I'd love to see what other people come up with to accomplish what
you are asking.

Sean

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


[R] Identifying or searching for labels in a hclust/dendrogram/heatmap

2006-03-09 Thread michael watson \(IAH-C\)
Hi
 
Sorry if this is in the help :-S
 
I've looked at example(dendrogram) and though it gives some indication of what 
I want, it doesn't do all.
 
OK, so here is what I want to do: draw a tree, and then have an action, on 
user-click, to either draw a sub tree or a plot of the data.  I also want users 
to be able to search for a particular label and have it highlighted on the 
tree, say in red, where all the other labels are black.
 
Now, the only tree I can use the "user-click" with is an hclust object, with 
the identify.hclust() function.  As far as I know, neither the dendrogram 
objects or the output of heatmap is cut-able in this way.  So I have the 
sub-tree and plot drawing set up on user-click using an hclust object and 
identify.hclust - good :)
 
Therefore I am working with hclust objects (which is a shame as the dendrogram 
and heatmap objects look prettier) but I can cope.  How do I then go on and 
highlight a single label, or group of labels, when I have plotted the hclust 
object?  Can I highlight labels on dendrograms and heatmaps 2?  
 
I can just imagine that after a user has drawn the tree, they will want to know 
where their genes of interest actually lie within that tree.
 
I'm happy to share the completed code when I have sorted all of this out
 
Many thanks
Mick

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


Re: [R] Boxplot Help Needed

2006-03-07 Thread michael watson \(IAH-C\)
You can always use points()

mat <- matrix(rnorm(360),nrow=10)
boxplot(mat~col(mat))
means <- apply(mat,2, mean)
points(1:36,means,pch="X",col="red") 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sumanta Basak
Sent: 07 March 2006 09:55
To: r-help@stat.math.ethz.ch
Subject: [R] Boxplot Help Needed

Hi R-Experts,

 

How can I show all the relevant measures like mean, median, min. value,
max. value, outlier in a single boxplot diagram?

 

Suppose I have a data set  c(2,4,5,7,12,14,15,13,8,5,23,98,11)

 

Sumanta Basak.

 


[[alternative HTML version deleted]]

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

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


[R] Problems with heatmap.2 in the gregmisc package

2006-03-06 Thread michael watson \(IAH-C\)
Hi

Sorry to revisit an old problem, I seemed to solve this in 2004, only
for it to resurface :-S

I am trying to plot a heatmap, and I don't want the columns of my matrix
re-ordered.  The function doesn't seem to behave as the help would have
you believe:

a <- matrix(rnorm(100),nr=20)
a.d  <- dist(a)
a.hc <- hclust(a.d)
a.de <- as.dendrogram(a.hc)

# columns are re-ordered
heatmap.2(a, Rowv=a.de, Colv=FALSE)

# columns are re-ordered
heatmap.2(a, Rowv=a.de, Colv=1:5)

# columns are re-ordered
heatmap.2(a, Rowv=a.de, dendrogram="row")

# error
heatmap.2(a, Rowv=a.de, Colv=FALSE, dendrogram="row") 

Thanks in advance

Mick


[[alternative HTML version deleted]]

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


[R] Averaging over columns

2006-03-06 Thread michael watson \(IAH-C\)
Hi

I've been reading the help for by and aggregate but can't get my head
round how to do this.  

I have a data frame - the first three columns are replicate
measurements, then the next 3 are replicates etc up to 36 (so 12
variables with 3 replicate measurements each).  I want to compute the
mean for each of the 12 variables, so that, for each row, I have 12
means.

A grouping variable across columns can easily be created by
rep(1:12,each=3), but I can't figure out which function to use to get R
to calculate the means I want.

Thanks in advance
Mick

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


Re: [R] lines() and recycled colours

2006-02-28 Thread michael watson \(IAH-C\)
Hi

Lines behaves as the help() says it does:

plot(0:1,0:1,type="n")
lines(runif(11),runif(11),col=c("red","green"), type="h")

Mick

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Robin Hankin
Sent: 28 February 2006 09:31
To: RHelp
Subject: [R] lines() and recycled colours

Hi

?lines says


  For 'type = "h"', 'col' can be a vector and will be recycled as
  needed.


Why doesn't  lines() recycle colours for other types?

If I type


 > plot(0:1,0:1,type="n")
 > lines(runif(11),runif(11),col=c("red","green"))
 >


then all ten lines are red, with no warning given.  Is there a reason
why colour recycling would be a bad idea in this case?
  Also, it would be nice if arguments such as lwd were recycled if
needed too.




--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton European Way, Southampton SO14
3ZH, UK
  tel  023-8059-7743

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

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


Re: [R] Sorting a dataframe by one column?

2006-02-24 Thread michael watson \(IAH-C\)
You mean like this?

a<-1:10
b<-(a-5)^2
d<-data.frame(a,b)
d[order(d$b),]

?? 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of mtb954 mtb954
Sent: 24 February 2006 13:55
To: r-help@stat.math.ethz.ch
Subject: [R] Sorting a dataframe by one column?

Given the following dataframe:

A=1:10
B=(a-5)^2
DATAFRAME=data.frame(A,B)

How can I sort DATAFRAME increasing (or decreasing, for that matter) by
B without making reference to A, or any other column?

I've read ?order and ?sort but cannot seem to figure this out.

Thank you.

Mark

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

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


[R] Changing the x-axis labels in plot()

2006-02-23 Thread michael watson \(IAH-C\)
Hi

Hopefully this one isn't in the manual or I am about to get shot :-S

One of my colleagues wants a slightly strange graph.  We basically have
a data matrix, and she wants to plot, for each row, the values in the
row as points on the graph.  The following code draws the graph just
fine:

plot(row(d)[,3:9],d[,3:9])

So as there are 12 rows in my matrix, there are 12 columns of points,
which is what she wants.

However, she wants the x-axis labelled with the row names, not with
1,2,3,4,5 etc

I can figure out from reading par() how to turn off the default drawing
of the numerical labels, but how do I use the row names instead?

Thanks
Mick

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


Re: [R] Bug in setting GUI to SDI mode?

2006-02-23 Thread michael watson \(IAH-C\)
Woops!

RTFM for me :(

Thanks everyone for your help.

Mick 

-Original Message-
From: Liaw, Andy [mailto:[EMAIL PROTECTED] 
Sent: 23 February 2006 13:57
To: michael watson (IAH-C); r-help@stat.math.ethz.ch
Subject: RE: [R] Bug in setting GUI to SDI mode?

The file needs to be in R_HOME\etc.  See ?Rconsole.

Andy

From: michael watson (IAH-C)
> 
> Hi
> 
> I did a google search on this and came up with nothing.
> 
> OK, in the latest release of R for windows, I want to change the gui 
> to SDI mode.
> 
> Edit -> GUI preferences
> Choose SDI
> Apply
> 
> I get the message about properties not being able to be changed on a 
> running console, and that I need to save.
> 
> So I click Save, and am met with a "Save As" dialogue box with the 
> default file called Rconsole, the file type as "All files".  I have no

> idea where I actually have to save this.
> 
> I saved it in C:\Program File\R\2.2.1 anyway, restarted the console, 
> and SDI mode was not set.
> 
> I realiuse I can use the --sdi option on the command line, but I want 
> to know how to make this work through the GUI
> 
> Any help?
> 
> Thanks
> Mick
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
> 



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

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


[R] Bug in setting GUI to SDI mode?

2006-02-23 Thread michael watson \(IAH-C\)
Hi

I did a google search on this and came up with nothing.

OK, in the latest release of R for windows, I want to change the gui to
SDI mode.  

Edit -> GUI preferences
Choose SDI
Apply

I get the message about properties not being able to be changed on a
running console, and that I need to save.

So I click Save, and am met with a "Save As" dialogue box with the
default file called Rconsole, the file type as "All files".  I have no
idea where I actually have to save this.

I saved it in C:\Program File\R\2.2.1 anyway, restarted the console, and
SDI mode was not set.

I realiuse I can use the --sdi option on the command line, but I want to
know how to make this work through the GUI

Any help?

Thanks
Mick

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


Re: [R] R under suse linux 9.3

2005-07-07 Thread michael watson \(IAH-C\)
I've been successfully using R on SuSe linux for the last 2 years and I
use the rpm :-)

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ernesto Jardim
Sent: 07 July 2005 10:48
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] R under suse linux 9.3


Peter Dalgaard wrote:
> Ernesto Jardim <[EMAIL PROTECTED]> writes:
> 
> 
>>Mahdi Osman wrote:
>>
>>>Hi, dear list members,
>>> 
>>>I've been using R under windows XP and I am now changing
>>>my system to SUSE LINUX 9.3. 
>>> 
>>>I could figure out that there is no precompiled version
>>>of R for LINUX. To get me going, I would like your help 
>>>regarding what I need to setup R under my SUSE LINUX. 
>>> 
>>>Which compiler do I need to be able to compile the source
>>>and I was wondering if I could get GNU compiler? 
>>> 
>>>I highly appreciate your help and for taking your time.
>>> 
>>> 
>>>Looking forward to hearing from you
>>> 
>>>Regards
>>> 
>>>Mahdi
>>>
>>
>>Hi Mahdi,
>>
>>Just uncompress the file
>>
>>tar -xzf R-2.1.0.tar.gz
> 
> 
> Er, 2.1.1 has been out a couple of weeks...
>  
> 
>>cd into the directory and do
>>
>>./configure --prefix=/usr/local
>>make
>>make install
>>
>>It might happen that some packages are not installed, the most common 
>>is
>>not to have the devel version of "readline" and "f2c". Just start yast

>>and install these packages.
> 
> 
> f2c ??
> 
> gcc-g77 more likely. Plus various other stuff relating to tcl/tk, etc.
> 
> 
> 
>>Another issue is that you should run the previous commands with your
>>user and the "make install" has root.
> 
> 
> Yes, but what was ever wrong with
> 
> http://cran.r-project.org/bin/linux/suse/9.3/RPMS/i586/R-base-2.1.1-1.
> i586.rpm
> 
> ?
> 


Hi,

Probably nothing is wrong with the rpm, I just prefer to compile it 
myself ...

Regards

EJ

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

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


Re: [R] Discriminant Function Analysis

2005-07-07 Thread michael watson \(IAH-C\)
Thanks for the answers Uwe!

So this is a common problem in biology - few number of cases and many,
many variables (genes, proteins, metabolites, etc etc)! 

Under these conditions, is discriminant function analysis not an ideal
method to use then?  Are there alternatives?

> 1) First problem, I got this error message:
> 
>>z <- lda(C0GRP_NA ~ ., dpi30)
> 
> Warning message:
> variables are collinear in: lda.default(x, grouping, ...) 
> 
> I guess this is not a good thing, however, I *did* get a result and it

> discriminated perfectly between my groups.  Can anyone explain what 
> this means?  Does it invalidate my results?

Well, 14 cases and 37 variables mean that not that many degrees of 
freedom are left ;-)
Of course, you get a perfect fit - with arbitrary data.

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


[R] Discriminant Function Analysis

2005-07-05 Thread michael watson \(IAH-C\)
Dear All

This is more of a statistics question than a question about help for R,
so forgive me.

I am using lda from the MASS package to perform linear discriminant
function analysis.  I have 14 cases belonging to two groups and have
measured each of 37 variables.  I want to find those variables that best
discriminate between the two groups, and I want to visualise that and
create a classification function.  Please note at this stage it is a
proof of concept problem - I realise that I must follow this up with a
much more robust anaylsis involving cross-validation.

1) First problem, I got this error message:
> z <- lda(C0GRP_NA ~ ., dpi30)
Warning message: 
variables are collinear in: lda.default(x, grouping, ...) 

I guess this is not a good thing, however, I *did* get a result and it
discriminated perfectly between my groups.  Can anyone explain what this
means?  Does it invalidate my results?

2) My analysis came up with one discriminant variable.  How do I control
how many are produced?  I currently assume this is the only significant
discriminant variable found.  Can I insist it finds more?

3) More of a tip - when my analysis only finds one significant variable,
what is a good way to visualise this graphically?

4) Can I work out from the coefficients which sub groups of my variable
are better at discriminating than others?  I guess I could simply
perform a t-test first to select the best variables...?

5) How do I turn my discriminant function into a classification
function?  i.e. when I plot the scores for the groups I can see
graphically that all the values for one group are below 0.1 and all the
values for the other group are above 1.  But how do I turn my
discriminant function into a classification function?

Many thanks in advance for your help

Mick

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


RE: [R] Running R from Perl program

2005-05-10 Thread michael watson \(IAH-C\)
Well, after reviewing all the available options about 2 years ago, I
decided on the traditional perl option of opening up a pipe to R from
within perl and simply firing commands at it.

This worked for me because all I wanted to do was create images.  If you
want to get back the results of an analysis, say from topTable() in
limma, then you can write the results of that out to a temporary file
and read that in using perl.

All very cumbersome, but it works :-)

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sean Davis
Sent: 10 May 2005 12:39
To: Tarun Kumar Singh
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Running R from Perl program


A quick search of the archives (http://finzi.psych.upenn.edu/nmz.html) 
produces several hits.  Just one example:

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

Sean

On May 10, 2005, at 7:26 AM, Tarun Kumar Singh wrote:

> Hi all,
>
> Is it possoble to include an R function in a Perl program? I would 
> like to use
> the "limma" library for microarray analysis, and have no clue how this
> can be done.
>
> Thanks in Advance
> -Tarun
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html

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

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


[R] Wilcoxon paired signed rank test and continuity correction

2005-05-05 Thread michael watson \(IAH-C\)
Hi

I am applying the wilcoxon paired signed rank test to many sub-groups of
a data frame using by() and wilcox.test, and sometimes the test uses
continuity correction and sometimes it doesn't.  What I want to know is:

1) what is continuity correction?  The docs say:

 correct: a logical indicating whether to apply continuity correction
  in the normal approximation for the p-value.

But come on, I'm a biologist

2) what makes wilcox.test sometimes decide to implement continuity
correction and sometimes not?

3) should I be letting wilcox.test use continuity correction when it
wants to?

I know I can turn this on/off using the correct and exact options, but I
want to know what is best to do.  Presently I have it turned off because
as I am doing ~200 tests, I want the tests to be consistent (ie none of
them use continuity correction rather than some of them do, some of them
don't)

Many thanks in advance for your replies :-)

Mick

Michael Watson
Head of Informatics
Institute for Animal Health,
Compton Laboratory,
Compton,
Newbury,
Berkshire RG20 7NN
UK

Phone : +44 (0)1635 578411 ext. 2535
Mobile: +44 (0)7990 827831
E-mail: [EMAIL PROTECTED]

"To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of." R.A. Fisher, 1938.

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


[R] Anova - interpretation of the interaction term

2005-04-22 Thread michael watson \(IAH-C\)
Hi

So carrying on my use of analysis of variance to check for the effects
of two factors.  It's made simpler by the fact that both my factors have
only two levels each, creating four unique groups.

I have a highly significant interaction term.  In the context of the
experiment, this makes sense.  I can visualise the data graphically, and
sure enough I can see that both factors have different effects on the
data DEPENDING on what the value of the other factor is.  

I explain this all to my colleague - and she asks "but which ones are
different?"  This is best illustrated with an example.  We have either
infected | uninfected, and vaccinated | unvaccinated (the two factors).
We're measuring expression of a gene.  Graphically, in the infected
group, vaccination makes expression go up.  In the uninfected group,
vaccination makes expression go down.  In both the vaccinated and
unvaccinated groups, infection makes expression go down, but it goes
down further in unvaccinated than it does in vaccinated.

So from a statistical point of view, I can see exactly why the
interaction term is significant, but what my colleage wants to know is
that WITHIN the vaccinated group, does infection decrease expression
significantly?  And within the unvaccinated group, does infection
decrease expression significantly?  Etc etc etc  Can I get this
information from the output of the ANOVA, or do I carry out a separate
test on e.g. just the vaccinated group? (seems a cop out to me)

Many thanks, and sorry, but it's Friday.

Mick

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


RE: [R] Anova - adjusted or sequential sums of squares?

2005-04-21 Thread michael watson \(IAH-C\)
OK, I had no idea I was opening such a pandora's box, but thank you for
all of your answers, it's been fascinating reading.

This is how far I have got:

I will fit the most complex model, that is the one that includes the
interaction term.  If the interaction term is significant, I will only
interpret this term.

If the interaction term is not significant, then it makes sense to test
the effects of the factors on their own.  This is where I get a little
shaky... Using the example from the WNV paper, page 14.  If I want to
test for the effect of Litter, given that I have already decided that
there is no interaction term, I can fit:

Wt ~ Mother + Litter
Wt ~ Litter + Mother
Wt ~ Litter

The latter tests for the effect of Litter ignoring the effect of Mother.
The first two test for the effect of Litter eliminating the effect of
Mother.  Have I read that correct?  However, it still remains that the
top two give different results due to the non-orthogonal design.  

The way I see it I can do a variety of things when the interaction term
is NOT significant and I have a non-orthogonal design:

1) Run both models "Wt ~ Mother + Litter" and "Wt ~ Litter + Mother" and
take the consensus opinion.  If that's the case, which p-values do I use
in my paper? (that's not as flippant a remark as it should be...)
2) Run both models "Wt ~ Litter" and "Wt ~ Mother", and use those.  Is
that valid?
3) Believe Minitab, that I should use type III SS, change my contrast
matrices to sum to zero and use drop1(model, .~., test="F")

Many thanks

Mick

-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Sent: 20 April 2005 16:35
To: michael watson (IAH-C)
Cc: Liaw, Andy; r-help@stat.math.ethz.ch
Subject: RE: [R] Anova - adjusted or sequential sums of squares?


On Wed, 20 Apr 2005, michael watson (IAH-C) wrote:

> I guess what I want to know is if I use the type I sequential SS, as 
> reported by R, on my factorial anova which is unbalanced, am I doing 
> something horribly wrong?  I think the answer is no.

Sort of.  You really should test a hypothesis at a time.  See Bill's 
examples in MASS.

> I guess I could use drop1() to get from the type I to the type III in 
> R...

Only if you respect marginality.  The quote Doug gave is based on a
longer 
paper available at

http://www.stats.ox.ac.uk/pub/MASS3/Exegeses.pdf

Do read it all.


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

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


RE: [R] Anova - adjusted or sequential sums of squares?

2005-04-20 Thread michael watson \(IAH-C\)
I guess the real problem is this:

As I have a different number of observations in each of the groups, the
results *change* depending on which order I specify the factors in the
model.  This unnerves me.  With a completely balanced design, this
doesn't happen - the results are the same no matter which order I
specify the factors.  

It's this reason that I have been given for using the so-called type III
adjusted sums of squares...

Mick

-Original Message-
From: Douglas Bates [mailto:[EMAIL PROTECTED] 
Sent: 20 April 2005 15:07
To: michael watson (IAH-C)
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Anova - adjusted or sequential sums of squares?


michael watson (IAH-C) wrote:
> Hi
> 
> I am performing an analysis of variance with two factors, each with 
> two levels.  I have differing numbers of observations in each of the 
> four combinations, but all four combinations *are* present (2 of the 
> factor combinations have 3 observations, 1 has 4 and 1 has 5)
> 
> I have used both anova(aov(...)) and anova(lm(...)) in R and it gave 
> the same result - as expected.  I then plugged this into minitab, 
> performed what minitab called a General Linear Model (I have to use 
> this in minitab as I have an unbalanced data set) and got a different 
> result. After a little mining this is because minitab, by default, 
> uses the type III adjusted SS.  Sure enough, if I changed minitab to 
> use the type I sequential SS, I get exactly the same results as aov()
and lm() in R.
> 
> So which should I use?  Type I adjusted SS or Type III sequential SS? 
> Minitab help tells me that I would "usually" want to use type III 
> adjusted SS, as  type I sequential "sums of squares can differ when 
> your design is unbalanced" - which mine is.  The R functions I am 
> using are clearly using the type I sequential SS.

Install the fortunes package and try
 > fortune("Venables")

I'm really curious to know why the "two types" of sum of squares are
called "Type I" and "Type III"! This is a very common misconception,
particularly among SAS users who have been fed this nonsense quite often
for all their professional lives. Fortunately the reality is much
simpler. There is, 
by any
sensible reckoning, only ONE type of sum of squares, and it always 
represents
an improvement sum of squares of the outer (or alternative) model over
the inner (or null hypothesis) model. What the SAS highly dubious 
classification of
sums of squares does is to encourage users to concentrate on the null
hypothesis model and to forget about the alternative. This is always a 
very bad
idea and not surprisingly it can lead to nonsensical tests, as in the 
test it
provides for main effects "even in the presence of interactions",
something which beggars definition, let alone belief.
-- Bill Venables
   R-help (November 2000)

In the words of the master, "there is ... only one type of sum of 
squares", which is the one that R reports.  The others are awkward 
fictions created for times when one could only afford to fit one or two 
linear models per week and therefore wanted the output to give results 
for all possible tests one could conceive, even if the models being 
tested didn't make sense.

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


RE: [R] problem with RODBC

2005-04-20 Thread michael watson \(IAH-C\)
> the row number specified is 1 less than in the actual excel file 

At a guess I'd say this is because the row 1 in excel is taken as the
column heads for the data in R

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


RE: [R] Anova - adjusted or sequential sums of squares?

2005-04-20 Thread michael watson \(IAH-C\)
Thanks for the response.  Answers to your questions in turn:

My null hypothesis is that these is no difference between the treatment
means.  I guess that makes my alternative there is a difference.

I understand all about interactions, and yes, there's an interaction
term in my model.  Moreover, it is a pretty easy to understand and
interpret interaction.  In this example case, yes the interaction term
is significant, and so I know I can and should only interpret this term
and not any of the lower order terms.  

However, I will be repeating this analysis for other response variables,
some of which inevitably will not have a significant interaction term.
What then?  I guess one answer would be to say that as it's not
significant, I could remove it from the model and perform some model
comparisons as you suggest?

Doug agrees with the guy who taught me stats, and I should only be
looking at the type I sequential sums of squares.  I also like that as
it comes out of R.  It's just minitab freaked me out.  

I guess what I want to know is if I use the type I sequential SS, as
reported by R, on my factorial anova which is unbalanced, am I doing
something horribly wrong?  I think the answer is no.  

I guess I could use drop1() to get from the type I to the type III in
R...

-Original Message-
From: Liaw, Andy [mailto:[EMAIL PROTECTED] 
Sent: 20 April 2005 15:05
To: michael watson (IAH-C); r-help@stat.math.ethz.ch
Subject: RE: [R] Anova - adjusted or sequential sums of squares?


> From: michael watson (IAH-C)
> 
> Hi
> 
> I am performing an analysis of variance with two factors,
> each with two
> levels.  I have differing numbers of observations in each of the four
> combinations, but all four combinations *are* present (2 of the factor
> combinations have 3 observations, 1 has 4 and 1 has 5)
> 
> I have used both anova(aov(...)) and anova(lm(...)) in R and
> it gave the
> same result - as expected.  I then plugged this into minitab, 
> performed
> what minitab called a General Linear Model (I have to use this in
> minitab as I have an unbalanced data set) and got a different result.
> After a little mining this is because minitab, by default, 
> uses the type
> III adjusted SS.  Sure enough, if I changed minitab to use the type I
> sequential SS, I get exactly the same results as aov() and 
> lm() in R.  
> 
> So which should I use?  Type I adjusted SS or Type III sequential SS? 
> Minitab help tells me that I would "usually" want to use type III 
> adjusted SS, as  type I sequential "sums of squares can differ when 
> your design is unbalanced" - which mine is.  The R functions I am 
> using are clearly using the type I sequential SS.

Here we go again...  The `type I vs. type III SS' controversy has long
been debated here and elsewhere.  I'll give my personal bias, and leave
you to dig deeper if you care to.

The `types' of sum of squares are creation of SAS.  Each type 
corresponds to different hypothesis being considered.  The short answer
to your question would be: `What are your null and alternative
hypotheses'?

One of the problems with categorizing like that is it tends to keep
people from thinking about the question above, and thus leading to the
confusion of which to use.

The school of thought I was broght up in says you need (and should) not
think that way.  Rather, frame your question in terms of 
model comparisons.  This approach avoids the notorious problem of
comparing the full model to ones that contain interaction, but 
lack one main effect that is involved in that interaction.

More practically:  Do you have interaction in your model?  If so, the
result for the interaction term should be the same in either `type' of
test.  If that interaction term is significant, you should find other
ways to understand the effects, and 
_not_ test for significance of the main effects in the presence of
interaction.  If there is no interaction term, you can 
assess effects by model comparisons such as:

m.full <- lm(y ~ A + B)
m.A <- lm(y ~ A)
m.B <- lm(y ~ B)
anova(m.B, m.full)  ## test for A effect
anova(m.A, m.full)  ## test for B effect

HTH,
Andy

 
> Any help would be very much appreciated!
> 
> Thanks
> Mick
> 
> __
> R-help@stat.math.ethz.ch mailing list 
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> 
> 
> 




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

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


[R] Anova - adjusted or sequential sums of squares?

2005-04-20 Thread michael watson \(IAH-C\)
Hi

I am performing an analysis of variance with two factors, each with two
levels.  I have differing numbers of observations in each of the four
combinations, but all four combinations *are* present (2 of the factor
combinations have 3 observations, 1 has 4 and 1 has 5)

I have used both anova(aov(...)) and anova(lm(...)) in R and it gave the
same result - as expected.  I then plugged this into minitab, performed
what minitab called a General Linear Model (I have to use this in
minitab as I have an unbalanced data set) and got a different result.
After a little mining this is because minitab, by default, uses the type
III adjusted SS.  Sure enough, if I changed minitab to use the type I
sequential SS, I get exactly the same results as aov() and lm() in R.  

So which should I use?  Type I adjusted SS or Type III sequential SS?
Minitab help tells me that I would "usually" want to use type III
adjusted SS, as  type I sequential "sums of squares can differ when your
design is unbalanced" - which mine is.  The R functions I am using are
clearly using the type I sequential SS.

Any help would be very much appreciated!

Thanks
Mick

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


[R] Order of boxes in boxplot()

2005-04-07 Thread michael watson \(IAH-C\)
Hi

Sorry for such an inane question - how do I control the order in which
the boxes are plotted using boxplot() when I pass it a formula and a
data.frame?  It seems that the groups are plotted in alphabetical
order... I want to change this

Many thanks
Mick

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


RE: [R] Help with three-way anova

2005-04-06 Thread michael watson \(IAH-C\)
Hi John

Thanks for your help, that was a very clear answer.  It looks as though,
due to my design, the best way forward is:

> contrasts(il4$Infected)
   [,1]
I-1
UI1
> contrasts(il4$Vaccinated)
   [,1]
UV   -1
V 1
> summary(lm(IL.4 ~ Infected * Vaccinated, il4))

Thanks
Mick

-Original Message-
From: John Fox [mailto:[EMAIL PROTECTED] 
Sent: 06 April 2005 12:52
To: michael watson (IAH-C)
Cc: 'r-help'; [EMAIL PROTECTED]
Subject: RE: [R] Help with three-way anova


Dear Mick,

For a three-way ANOVA, the difference between aov() and lm() is mostly
in the print and summary methods -- aov() calls lm() but in its summary
prints an ANOVA table rather than coefficient estimates, etc. You can
get the same ANOVA table from the object returned by lm via the anova()
function. The problem, however, is that for unbalanced data you'll get
sequential sums of squares which likely don't test hypotheses of
interest to you.

If you didn't explicitly set the contrast coding, then the out-of-box
default in R [options("contrasts")] is to use treatment.contr(), which
produces dummy-coded (0/1) contrasts. In this case, the "intercept"
represents the fitted value when all of the factors are at their
baseline levels, and it's probably entirely uninteresting to test
whether it is 0.

More generally, however, it seems unreasonable to try to learn how to
fit and interpret linear models in R from the help files. There's a
brief treatment in the Introduction to R manual that's distributed with
R, and many other more detailed treatments -- see
http://www.r-project.org/other-docs.html.

Regards,
 John


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

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> michael watson (IAH-C)
> Sent: Wednesday, April 06, 2005 4:31 AM
> To: [EMAIL PROTECTED]
> Cc: r-help
> Subject: RE: [R] Help with three-way anova
> 
> OK, now I am lost.
> 
> I went from using aov(), which I fully understand, to lm()
> which I probably don't.  I didn't specify a contrasts matrix 
> in my call to lm()
> 
> Basically I want to find out if Infected/Uninfected affects
> the level of IL.4, and if Vaccinated/Unvaccinated affects the 
> level of IL.4, obviously trying to separate the effects of 
> Infection from the effects of Vaccination.
> 
> The documentation for specifying contrasts to lm() is a
> little convoluted, sending me to the help file for 
> model.matrix.default, and the help there doesn't really give 
> me much to go on when trying to figure out what contrasts 
> matrix I need to use...
> 
> Many thanks for your help
> 
> Mick
> 
> -Original Message-
> From: Federico Calboli [mailto:[EMAIL PROTECTED]
> Sent: 06 April 2005 10:15
> To: michael watson (IAH-C)
> Cc: r-help
> Subject: RE: [R] Help with three-way anova
> 
> 
> On Wed, 2005-04-06 at 09:11 +0100, michael watson (IAH-C) wrote:
> > OK, so I tried using lm() instead of aov() and they give similar
> > results:
> > 
> > My.aov <-  aov(IL.4 ~ Infected + Vaccinated + Lesions, data)
> > My.lm  <-   lm(IL.4 ~ Infected + Vaccinated + Lesions, data)
> 
> Incidentally, if you want interaction terms you need
> 
> lm(IL.4 ~ Infected * Vaccinated * Lesions, data)
> 
> for all the possible interactions in the model (BUT you need enough 
> degrees of freedom from the start to be able to do this).
> > 
> > If I do summary(My.lm) and summary(My.aov), I get similar
> results, but
> 
> > not identical. If I do anova(My.aov) and anova(My.lm) I get
> identical
> > results.  I guess that's to be expected though.
> > 
> > Regarding the results of summary(My.lm), basically
> Intercept, Infected
> 
> > and Vaccinated are all significant at p<=0.05.  I presume the
> > signifcance of the Intercept is that it is significantly 
> different to
> > zero?  How do I interpret that?
> 
> I guess it's all due to the contrast matrix you used. Check with
> contrasts() the term(s) in the datafile you use as independent 
> variables, and change the contrast matrix as you see fit.
> 
> HTH,
> 
> F
> --
> Federico C. F. Calboli
> Department of Epidemiology and Public Health
> Imperial College, St Mary's Campus
> Norfolk Place, London W2 1PG
> 
> Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193
> 
> f.calboli [.a.t] imperial.ac.uk
> f.calboli [.a.t] gmail.com
> 
> __
> R-help@stat.math.ethz.ch mailing list 
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

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


RE: [R] Help with three-way anova

2005-04-06 Thread michael watson \(IAH-C\)
OK, now I am lost.

I went from using aov(), which I fully understand, to lm() which I
probably don't.  I didn't specify a contrasts matrix in my call to
lm()

Basically I want to find out if Infected/Uninfected affects the level of
IL.4, and if Vaccinated/Unvaccinated affects the level of IL.4,
obviously trying to separate the effects of Infection from the effects
of Vaccination.

The documentation for specifying contrasts to lm() is a little
convoluted, sending me to the help file for model.matrix.default, and
the help there doesn't really give me much to go on when trying to
figure out what contrasts matrix I need to use...

Many thanks for your help

Mick

-Original Message-
From: Federico Calboli [mailto:[EMAIL PROTECTED] 
Sent: 06 April 2005 10:15
To: michael watson (IAH-C)
Cc: r-help
Subject: RE: [R] Help with three-way anova


On Wed, 2005-04-06 at 09:11 +0100, michael watson (IAH-C) wrote:
> OK, so I tried using lm() instead of aov() and they give similar
> results:
> 
> My.aov <-  aov(IL.4 ~ Infected + Vaccinated + Lesions, data)
> My.lm  <-   lm(IL.4 ~ Infected + Vaccinated + Lesions, data)

Incidentally, if you want interaction terms you need 

lm(IL.4 ~ Infected * Vaccinated * Lesions, data)

for all the possible interactions in the model (BUT you need enough
degrees of freedom from the start to be able to do this).
> 
> If I do summary(My.lm) and summary(My.aov), I get similar results, but

> not identical. If I do anova(My.aov) and anova(My.lm) I get identical 
> results.  I guess that's to be expected though.
> 
> Regarding the results of summary(My.lm), basically Intercept, Infected

> and Vaccinated are all significant at p<=0.05.  I presume the 
> signifcance of the Intercept is that it is significantly different to 
> zero?  How do I interpret that?

I guess it's all due to the contrast matrix you used. Check with
contrasts() the term(s) in the datafile you use as independent
variables, and change the contrast matrix as you see fit.

HTH,

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

Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193

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

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


RE: [R] Help with three-way anova

2005-04-06 Thread michael watson \(IAH-C\)
OK, so I tried using lm() instead of aov() and they give similar
results:

My.aov <-  aov(IL.4 ~ Infected + Vaccinated + Lesions, data)
My.lm  <-   lm(IL.4 ~ Infected + Vaccinated + Lesions, data)

If I do summary(My.lm) and summary(My.aov), I get similar results, but
not identical.
If I do anova(My.aov) and anova(My.lm) I get identical results.  I guess
that's to be expected though.

Regarding the results of summary(My.lm), basically Intercept, Infected
and Vaccinated are all significant at p<=0.05.  I presume the
signifcance of the Intercept is that it is significantly different to
zero?  How do I interpret that?

Many thanks
Mick

-Original Message-
From: Federico Calboli [mailto:[EMAIL PROTECTED] 
Sent: 05 April 2005 16:33
To: michael watson (IAH-C)
Cc: r-help
Subject: Re: [R] Help with three-way anova


On Tue, 2005-04-05 at 15:51 +0100, michael watson (IAH-C) wrote:

> So, what I want to know is:
> 
> 1) Given my unbalanced experimental design, is it valid to use aov?

I'd say no. Use lm() instead, save your analysis in an object and then
possibly use drop1() to check the analysis

> 2) Have I used aov() correctly?  If so, how do I get access results 
> for interactions?

The use of aov() per se seems fine, but you did not put any interaction
in the model... for that use factor * factor.

HTH,

F

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

Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193

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

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


[R] Help with three-way anova

2005-04-05 Thread michael watson \(IAH-C\)
Hi

I have data from 12 subjects.  The measurement is log(expression) of a
particular gene and can be assumed to be normally distributed.  The 12
subjects are divided into the following groups:

Infected, Vaccinated, Lesions - 3 measurements
Infected, Vaccintaed, No Lesions - 2 measurements
Infected, Not Vaccinated, Lesions - 4 measurements
Uninfected, Not Vaccinated, No Lesions - 3 measurements

Although presence/absence of lesions could be considered to be a
phenotype, here I would like to use it as a factor.  This explains some
of the imbalance in the design (ie we could not control how many
subjects, if any, in each group would get lesions).

First impressions - the data looks like we would expect.  Gene
expression is lowest in the infected/not vaccinated group, then next
lowest is the infected/vaccinated group and finally comes the
uninfected/not vaccinated group.  So the working hypothesis is that gene
expression of the gene in question is lowered by infection, but that the
vaccine somehow alleviates this effect, but not as much as to the level
of a totally uninfected subject.  We *might* have access to data
relating to uninfected/vaccinated group, my pet scientist is digging for
this as we speak.

As for lesions, well none of the uninfected subjects have them, all of
the infected/not vaccinated subjects have them, and some of the
infected/vaccinated have them, some don't.  Again, this makes for a very
sensible hypothesis if we treat presence/absence of lesions as a
phenotype, but in addition to that I want to know if gene expression is
linked to presence/absence of lesion, but only one group of subjects has
both lesions and non-lesions within it.  Eye-balling this group,
presence/absence of lesions and gene expression are not linked.

So I have this as a data.frame in R, and I wanted to run an analysis of
variance.  I did:

aov <-  aov(IL.4 ~ Infected + Vaccinated + Lesions, data)
summary(aov)

And got:

Df  Sum Sq Mean Sq F valuePr(>F)
Infected 1 29.8482 29.8482 66.7037 3.761e-05 ***
Vaccinated   1 13.5078 13.5078 30.1868 0.0005777 ***
Lesions  1  0.0393  0.0393  0.0878 0.7746009
Residuals8  3.5798  0.4475  
---

This tells me that Infected and Vaccinated are highly significant,
whereas lesions are not.

So, what I want to know is:

1) Given my unbalanced experimental design, is it valid to use aov?
2) Have I used aov() correctly?  If so, how do I get access results for
interactions?
3) Is there some other, more relevant way of analysing this?  What I am
really interested in is the gene expression, and whether it can be shown
to be statistically related to one or more of the factors involved
(Infected, Vaccinated, Lesions) or interactions between those factors.

Many thanks in advance

Mick

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


[R] Converting a list to a matrix - I still don't think I have it right

2005-02-17 Thread michael watson \(IAH-C\)
Hi

We have touched on this before, but I don't think I quite got it right.

So I have a list, each element of which is a a vector of 2 numbers:

> l2
$cat000_a01
[1] 0.3429944 4.5138244

$cat000_a02
[1] 0.1929336 4.3064944

$cat000_a03
[1] -0.2607796  4.1551591

What I actually want to convert this into is a matrix with the names
(cat000_a01 etc) as row names, the first element of each of the vectors
forming the first column of the new matrix, and the second element of
each of the vectors forming the second column:

cat000_a01  0.3429944   4.5138244
cat000_a02  0.1929336   4.3064944
cat000_a03  -0.2607796  4.1551591

What was suggested on the list last time was
matrix(unlist(mylist),nrow=length(mylist)).  But if I do this I get:

> matrix(unlist(l2),nrow=length(l2))
  [,1]   [,2]
[1,] 0.3429944  4.3064944
[2,] 4.5138244 -0.2607796
[3,] 0.1929336  4.1551591

Which is not what I want.  Here, the second element of the first vector
in my list has gone into the first column of the new matrix, and that's
not what I want at all.

Any more help would be appreciated.

Thanks
Mick

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


[R] A vector or array of data frames

2005-02-17 Thread michael watson \(IAH-C\)
Hi

A simple question again, but I can't find it by google-ing R-help.

Quite simply, I want to read in the contents of a number of files, using
read.table, and assign the results to elements of a
vector/array/list/whatever.

I want it so that, if my vector/array/whatever is "pos", that pos[1]
will give me the first data frame, pos[2] will give me the second etc...

Kind of basic stuff I know... Sorry..

Mick

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


RE: [R] Making a Package

2005-02-15 Thread michael watson \(IAH-C\)
I follow the guide here and it never fails:
 
http://www.biostat.jhsph.edu/~kbroman/Rintro/Rwinpack.html
 
So if I have the MyPackage directory, that was created with package.skeleton 
and subsequently edited, I will cd to the directory that contains the MyPackage 
directory and:
 
R CMD INSTALL --build MyPackage
 
MyPackage_1.0.zip will be created.  Then install using the menus.

-Original Message- 
From: [EMAIL PROTECTED] on behalf of Gabor Grothendieck 
Sent: Tue 2/15/2005 9:59 PM 
To: r-help@stat.math.ethz.ch 
Cc: 
Subject: Re: [R] Making a Package



KKThird  Yahoo.Com  yahoo.com> writes:

:
: Hello.
: I have what I know to be a simple question, but never having done 
anything
like this it is
: pretty tough.
:
: I'm trying to write an R package. I have a collection of functions 
that I
loaded into R and
: then used package.skeleton(). After editing everything in the 
resulting
folder, call it
: NewPackage, I tried to follow along with some instructions I found for
Windows users.
:
: I installed ActivePearl to the C drive, placed the unzipped Rtools 
folder,
tools, there also
: (is placing it there all that is necessary; I couldn't find anything
to "install" tools), and
: I'm using R 2.00 (also installed on the C drive) on a Win-XP machine.
:
: My understaning is that (since I have no C, Fortran, etc., code) I 
can move
the NewPackage
: folder (with all of the edited material) to the 
C:\r\rw2000\src\library
folder and then open
: MS-Dos in C:\r\rw2000\src\gnuwin32 and type: make pkg-NewPackage. 
After
that, a folder called
: NewPackage should be placed in the C:\r\rw2000\library and from there 
loaded
into R and/or zipped and
: distributed. If everything I have said is correct (which it may not 
be) then
I'm
: stuck. When I type 'make pkg-NewPackage' in the 
C:\r\rw2000\src\gnuwin32
directory I get
: "'make' is not recognized as an internal or external command, operable
program or batch file."
:
: I've tried to use "Writing R Extensions," but I could only follow 
part of
what it was saying
: and got confused as to what was done on Windows and what was done on 
Unix
machines.
: I know this is probably an easy question, but it has proved difficult 
for me
to figure out how
: to make my own package.
: Thanks, Ken


Make sure that:
- the tools and the R bin folders are in your path
- you have installed fptex or MiKTeX, perl and the Microsoft help 
compiler
  (MiKTeX is a bit harder to install but I otherwise prefer it.  If you
  are writing vignettes you must use MiKTeX.)
- you have read:
   Writing R Extensions Manual
   http://www.murdoch-sutherland.com/Rtools/

I am assuming here that your R installation is in \Program 
Files\R\rw

1. Assuming your source package tree is in \Rpkgs\mypackage
   then in the Windows cmd line:

cd \Rpkgs
Rcmd install mypackage

   which will install it to your \Program 
Files\R\rw\library\mypackage
   or if you want to install it to a separate library:

cd \Rpkgs
md library
Rcmd install -l library mypackage

2. Now in R:

library(mypackage)
... test it out ...

or if you installed it to a separate library:

library(mypackage, lib.loc = "/Rpkgs/library")

3. Once it seems reasonably ok,  see if it passes Rcmd check:

cd \Rpkgs
Rcmd check mypackage

   and fix it up until it does.

4. Now create versions for UNIX and Windows that you can distribute:

cd \Rpkgs
Rcmd build mypackage
Rcmd build mypackage --binary

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

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


RE: [R] NA's in if statement

2005-02-11 Thread michael watson \(IAH-C\)
Some careful use of is.na() may help.
Either by using it to remove NA values or as part of the if statement.
 
Or:
 
my.wdir <- na.omit(dat$wdir)
for(i in 1:length(my.wdir)) {
 
#etc

-Original Message- 
From: [EMAIL PROTECTED] on behalf of [EMAIL PROTECTED] 
Sent: Fri 2/11/2005 9:34 PM 
To: r-help@stat.math.ethz.ch 
Cc: 
Subject: [R] NA's in if statement



Hello,

I am having trouble dealing with NA values in if statements such as:
i<-1
for(i in 1:length(dat$wdir)){
if (dat$wspd[i]==0){
dat$wdir[i]<-0
}
}

I get the following error due to the presence of NS values in the data:
Error in if (dat$wspd[i] == 0) { : missing value where TRUE/FALSE needed

Sorry if this is an old question but I was unable to resolve this from 
the
info on na.action etc. or old archives.

Thank you for any suggestions,

Vera Lindsay

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

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


[R] Setting x-axis labels in plot()

2005-02-11 Thread michael watson \(IAH-C\)
Hi
 
This draws the (kind of) plot I want:
 
plot(InsectSprays[,2:1])
 
But how do I make it label the x-axis with A, B, C, D etc instead of 1:6?
 
Mick

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


[R] RE: Using a number as a name to access a list

2005-02-10 Thread michael watson \(IAH-C\)
The answer of course is parse()!

Thank you and good night!
M

-Original Message-
From: michael watson (IAH-C) 
Sent: 10 February 2005 13:36
To: r-help@stat.math.ethz.ch
Subject: Using a number as a name to access a list


Hi

Dumb question time again, for which I apologise.

I have a variable that contains the following numerical text "04010".
This is the name to access a list:

> as.list(KEGGPATHID2NAME)$"04010"
[1] "MAPK signaling pathway"

Marvellous!  Except I want to do that when "04010" is assigned to a
variable called path and I can't figure out how to do it!

> path <- "04010"
>
> # the original and best
> as.list(KEGGPATHID2NAME)$"04010"
[1] "MAPK signaling pathway"
>
> # clearly this doesn't, and shouldn't, work 
> as.list(KEGGPATHID2NAME)$path
NULL
>
> # this produces a string...
> eval(paste("as.list(KEGGPATHID2NAME)$",path,sep=''))
[1] "as.list(KEGGPATHID2NAME)$04010"
>
> # as does this
> eval(paste('as.list(KEGGPATHID2NAME)$"',path,'"',sep=''))
[1] "as.list(KEGGPATHID2NAME)$\"04010\""
>

Whats really annoying is that when everyone mails me the answer, I'm
going to have known how obvious it is Thanks in advance

Mick
Village Idiot

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


[R] Using a number as a name to access a list

2005-02-10 Thread michael watson \(IAH-C\)
Hi

Dumb question time again, for which I apologise.

I have a variable that contains the following numerical text "04010".
This is the name to access a list:

> as.list(KEGGPATHID2NAME)$"04010"
[1] "MAPK signaling pathway"

Marvellous!  Except I want to do that when "04010" is assigned to a
variable called path and I can't figure out how to do it!

> path <- "04010"
>
> # the original and best
> as.list(KEGGPATHID2NAME)$"04010"
[1] "MAPK signaling pathway"
>
> # clearly this doesn't, and shouldn't, work
> as.list(KEGGPATHID2NAME)$path
NULL
>
> # this produces a string...
> eval(paste("as.list(KEGGPATHID2NAME)$",path,sep=''))
[1] "as.list(KEGGPATHID2NAME)$04010"
>
> # as does this
> eval(paste('as.list(KEGGPATHID2NAME)$"',path,'"',sep=''))
[1] "as.list(KEGGPATHID2NAME)$\"04010\""
>

Whats really annoying is that when everyone mails me the answer, I'm
going to have known how obvious it is Thanks in advance

Mick
Village Idiot

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


FW: [R] Drawing maps of UK

2005-02-09 Thread michael watson \(IAH-C\)

Hi Guys

Thanks for this!  As I am a beginner, I bet I'm running into some really
basic problems.  Using the example from the Map2poly function in
maptools:

try <- read.shape("euadmll.shp")
mappolys <-  Map2poly(try)
# this produces 14 warnings() of the type:
# 1: level 2 circularity at 62 in: .mtlbuild(.mtafters(r1), rD) # etc #
14: From next release, default hole handling will change in:
Map2poly(try) 
plot(mappolys)

Gives an error:
Error in plot.polylist(mappolys) : malformed plot order

I also get this with Map2ploy(..., raw=FALSE)

I have no idea what this means! :-(

Mick

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


[R] Drawing maps of UK

2005-02-08 Thread michael watson \(IAH-C\)
Hi

I have downloaded the maps package from CRAN, along with a few other
map* packages that I could find - but there didn't seem to be data on
the UK.

What I actually want to do (finally) is draw some maps of data that I
have which is organised by postcode (sort of equivalent of US Zip code
for those who don't know).  I think this may be quite ambitious, but I
wanted to see just how far I could get with R.

I have seen examples on the list (e.g.
http://www.r-project.org/nocvs/mail/r-help/2000/4480.html) giving
examples of drawing maps of the UK at county level
(map("uk",fill=T,color=pop.colour)) but this didn't work on my system -
as I don't seem to have the correct data for the UK.

Thanks in advance for your help

Mick

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


[R] How to convert a list to a matrix

2005-02-03 Thread michael watson \(IAH-C\)
Hi

Sorry to ask such a basic question.  I have a list, each element of
which is a vector of two values.  What I actually want is a matrix with
two columns, and one row per element of the list.  Obviously I have
tried as.matrix(), and as.vector() but I didn't expect the latter to
work.

I feel so lame asking this.  Any suggestions?

Mick

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


[R] Mantel Ranomization test

2005-02-03 Thread michael watson \(IAH-C\)
Hi

I found this post from 2001
(https://stat.ethz.ch/pipermail/r-help/2001-April/011073.html) and was
just wondering if this has been updated and included in an R package
yet?

Cheers
Mick

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


RE: [R] Runnning R remotely

2005-02-02 Thread michael watson \(IAH-C\)
This isn't exactly the same as your problem, but I came across access to X11 
problems when running R over CGI. 
I got round it by installing Xvfb (X Virtual Frame Buffer) on the server.  
 
Mick

-Original Message- 
From: [EMAIL PROTECTED] on behalf of Laura Quinn 
Sent: Wed 2/2/2005 4:18 PM 
To: r-help@stat.math.ethz.ch 
Cc: 
Subject: [R] Runnning R remotely



Hi,

I was wondering if anyone might be able to help. I am trying to run R 
on a
remote machine, part of the model run I am attempting writes an external
file output as a png (about 48 iterations per model run). I am running R
1.9.1 on SuSe9.0, and am accessing this via ssh from a Debian machine.

Initially I used the command ssh -X IP.address and whilst I was able to
run the model successfully the model run was extremely slow (which I 
could
not understand as the output was being written to the remote machine), 
but
tried to log in again, this time without the X windows facility and 
found
that I couldn't run the model:

Error in X11(paste("png::", filename, sep = ""), width, height, 
pointsize,
:
unable to start device PNG
In addition: Warning message:
unable to open connection to X11 display`'

Could somebody please advise a way around this?

Thanks in advance,
Laura

Laura Quinn
Institute of Atmospheric Science
School of Earth and Environment
University of Leeds
Leeds
LS2 9JT

tel: +44 113 343 1596
fax: +44 113 343 6716
mail: [EMAIL PROTECTED]

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

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


RE: [R] Combining two histograms

2005-02-02 Thread michael watson \(IAH-C\)
Something a bit more sohpisticated than this:
 

a <- rnorm(2)
b <- rnorm(2, mean=1.5)
ah <- hist(a,breaks= seq(-5,6,by=0.2),plot=FALSE)
bh <- hist(b,breaks= seq(-5,6,by=0.2),plot=FALSE)
data <- t(cbind(ah$counts,bh$counts))
barplot(data,beside=TRUE, space=rep(0,2*ncol(data)))
 

-Original Message- 
From: [EMAIL PROTECTED] on behalf of Sean Davis 
Sent: Wed 2/2/2005 1:42 PM 
To: r-help 
Cc: 
Subject: [R] Combining two histograms



I have data like:

a <- rnorm(2)
b <- rep(FALSE,2)
b[sample(1:2,15000)] <- TRUE

Using Lattice graphics, I can produce two side-by-side histograms quite
easily by:

histogram(a | b)

However, I would like to produce a "single" histogram with two bars
within each bin, one for each group, as the groups are in reality very
slightly different from each other.  The difference isn't evident
unless one "overlays" the two histograms in some manner.

Thanks,
Sean

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

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


RE: [R] Combining two histograms

2005-02-02 Thread michael watson \(IAH-C\)
Sean
If you want two bars for each bin then that sounds more like barplot() could be 
used.  I know you can tightly control the distance between bars and the width 
of the bars, and so with a little coding you could probably use that.
 
Mick

-Original Message- 
From: [EMAIL PROTECTED] on behalf of Sean Davis 
Sent: Wed 2/2/2005 1:42 PM 
To: r-help 
Cc: 
Subject: [R] Combining two histograms



I have data like:

a <- rnorm(2)
b <- rep(FALSE,2)
b[sample(1:2,15000)] <- TRUE

Using Lattice graphics, I can produce two side-by-side histograms quite
easily by:

histogram(a | b)

However, I would like to produce a "single" histogram with two bars
within each bin, one for each group, as the groups are in reality very
slightly different from each other.  The difference isn't evident
unless one "overlays" the two histograms in some manner.

Thanks,
Sean

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

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


RE: [R] A "rude" question

2005-01-27 Thread michael watson \(IAH-C\)
Hi

I don't know if you are asking the question for the same reasons I did,
but recently (and ongoing) we have been required to adopt an
internationally recognised standard.  Being in the bioinformatics field,
where open-source software is the beating heart of cutting edge
research, we have obviously had to ask ourselves that exact question -
"How can we be sure the software we use works?".  

In science, this doesn't just apply to software though.  When someone
publishes a paper, how can any of us be sure they did what they said
they did?  Or that their methods are the correct ones to use?  Luckily,
there is a two word answer that we hope will satisfy our auditors, and
that is "Peer Review".  In the context of R, I would say that you could
put a confidence measure on any package based on the number of people
who use it; the more people who use a package, the more likely they are
to find and remove bugs.  

I won't get into the "open source" vs "commercial" argument, but put
simply, all software has bugs at some stage, no matter who has written
it.  Given that fact, I prefer the code to be open so I can see them,
not closed so that I can't.  The fact that we can see all code relating
to R is surely the biggest quality measure of all?

Cheers
Mick

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: 27 January 2005 05:10
To: r-help@stat.math.ethz.ch
Subject: [R] A "rude" question


Dear all, 
 I am beginner using R. I have a question about it. When you use it,
since it is written by so many authors, how do you know that the
results are trustable?(I don't want to affend anyone, also I trust
people). But I think this should be a question.

 Thanks,
 Ming

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

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


RE: [R] Plotting hclust with lot of objects

2005-01-25 Thread michael watson \(IAH-C\)
I think you need to use just:

cut

You may also want to look at:

cutree

-Original Message-
From:   [EMAIL PROTECTED] on behalf of [EMAIL PROTECTED]
Sent:   Tue 1/25/2005 6:06 PM
To: r-help@stat.math.ethz.ch
Cc: 
Subject:[R] Plotting hclust with lot of objects
Hi!

I am newbee to R and I am facing the problem in plotting 
the dedrogram with lot of objects. The lines and labels are overlapped very 
badly, and writing the graphic to postscript and zooming there is not helping 
either. I tried cut.dendrogram method, but getting the error that it doesn't 
exist even though I get the man pages for it. 

I would not find any solution in web as well, and I would be grateful to you 
if you would share your thoughts or solutions with me. 

Here is my code:
A <- read.table("temp.csv", sep =",", header =TRUE, row.names = 1)
hc <- hclust(dist(A),method='single')
plot(as.dendrogram(hc), horiz=TRUE, cex=0.2)
memb <- cut.dendrogram(as.dendrogram(hc), 4)
Error: couldn't find function "cut.dendrogram"

Thanks allot,
Samatha

___
Samatha Kottha
Center for High Performance computing   TeL: (+49) 351 4633 1945
Technical University Dresden
Willers-bau A106 
Zellescher Weg 12
D-01069 Dresden
Germany

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

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


[R] Rd problems when converting DVI version

2005-01-25 Thread michael watson \(IAH-C\)
Hi

Running R v2.0 on SuSe linux 8.2.

I'm trying to build a package (which built perfectly on Windows...) on
Linux, and I ran:

R CMD check mypackage

I got:

* checking mypackage-maual.tex ... ERROR
LaTeX errors when creating DVI version
This typically indicates Rd problems

OK, there are no problems with my Rd - I got 3 warnings but they were
all expected, and the whole package builds find on windows.  There is no
indication which of my Rd files is upsetting LaTeX and no information
about what it is about the Rd that is the problem.

I have in my notes that I used to use:

R CMD R2dvi

But that now returns an error saying R2dvi is not found... Did this
change when upgrading to v2?  Or are my notes wrong?

So any help getting to the root of this error would be very much
appreciated.

Cheers
Mick

Michael Watson
Head of Informatics
Institute for Animal Health,
Compton Laboratory,
Compton,
Newbury,
Berkshire RG20 7NN
UK

Phone : +44 (0)1635 578411 ext. 2535
Mobile: +44 (0)7990 827831
E-mail: [EMAIL PROTECTED]

"To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of." R.A. Fisher, 1938.

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


RE: [R] lookups and joins

2005-01-24 Thread michael watson \(IAH-C\)
All together now:

?merge

:-)


-Original Message-
From:   [EMAIL PROTECTED] on behalf of Paul Sorenson
Sent:   Mon 1/24/2005 10:34 PM
To: r-help@stat.math.ethz.ch
Cc: 
Subject:[R] lookups and joins
I have some data coming from SQL sources that I wish to relate in various ways. 
 For reasons only known to our IT people, this can't be done in SQL at present.

I am looking for an R'ish technique for looking up new columns on a data frame. 
 As a simple, hardwired example I have tried the following:

# This gives me two columns, one the lookup value and the second one
# the result column, ie my lookup table.
stcl = read.csv("stockclass.csv")
stockclass = as.vector(stcl$stock_class)
# This gives me what appears to be a dictionary or map
names(stockclass) = as.vector(stcl$stock_group)

getstockclass = function(stock_group) {
try(stockclass[[stock_group]], TRUE)
}
csg$stk_class=factor(sapply(csg$stock_group, getstockclass))

I need the try since if there is a missing value I get an exception.

I also tried something along the lines of (from memory):
getstockclass = function(stock_group) {
stcl[which(stcl$stock_group == stock_group),]$stock_class
}

These work but I just wanted to check if there was an inbuilt way to do this 
kind of thing in R?  I searched on "join" without much luck.

Really what I would like is a generic function that:
- Takes 2 data frames,
- Some kind of specification on which column(s) to join
- Outputs the joined frames, or perhaps a vector which is an index 
vector that I can use on the second data frame.

I don't really want to reinvent SQL and my data sets are not huge.

cheers

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

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


[R] Subsetting a data frame by a factor, using the level that occurs the most times

2005-01-20 Thread michael watson \(IAH-C\)
I think that title makes sense... I hope it does...

I have a data frame, one of the columns of which is a factor.  I want
the rows of data that correspond to the level in that factor which
occurs the most times.  

I can get a list by doing:

by(data,data$pattern,subset)

And go through each element of the list counting the rows, to find the
maximum

BUT I can't help thinking there's a more elegant way of doing this

The second part is figuring out the rows which have the maximum number
of consecutive patterns which are the same... Now that I would love some
help with... :-)

Thanks
Mick

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


RE: [R] Replacing NAs in a data frame using is.na() fails if there are no NAs

2005-01-14 Thread michael watson \(IAH-C\)
Thank you for the answers.  Checking for NAs using any() will help.
I just thought it was worth mentioning because the behaviour of data
frames (which throw an error) is different to the behaviour of matrices
(which don't), and that might not be expected.  

mat <- matrix(c(1,1,1,1),nrow=2,ncol=2)
mat[is.na(mat)] <- 0

mat <- matrix(c(1,1,1,NA),nrow=2,ncol=2)
mat[is.na(mat)] <- 0

-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Sent: 14 January 2005 11:57
To: michael watson (IAH-C)
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Replacing NAs in a data frame using is.na() fails if
there are no NAs


On Fri, 14 Jan 2005, michael watson (IAH-C) wrote:

> Hi
>
> This is a difference between the way matrices and data frames work I 
> guess.  I want to replace the NA values in a data frame by 0, and the 
> code works as long as the data frame in question actually includes an 
> NA value.  If it doesn't, there is an error:
>
> df <- data.frame(c1=c(1,1,1),c2=c(2,2,NA))
> df[is.na(df)] <- 0
> df
>
> df <- data.frame(c1=c(1,1,1),c2=c(2,2,2))
> df[is.na(df)] <- 0
> Df
>
> Any help would be appreciated.  I could just convert the data frame to

> a matrix, execute the code, then convert it back to a data frame, but 
> that appears long winded.

As always, look at the objects:

> is.na(df)
  c1c2
1 FALSE FALSE
2 FALSE FALSE
3 FALSE FALSE

so there is nothing to replace by 0.

What you should have is

ind <- is.na(df)
df[ind] <- rep(0, sum(ind))

to give the right number of replacements.

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

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


[R] Replacing NAs in a data frame using is.na() fails if there are no NAs

2005-01-14 Thread michael watson \(IAH-C\)
Hi

This is a difference between the way matrices and data frames work I
guess.  I want to replace the NA values in a data frame by 0, and the
code works as long as the data frame in question actually includes an NA
value.  If it doesn't, there is an error:

df <- data.frame(c1=c(1,1,1),c2=c(2,2,NA))
df[is.na(df)] <- 0
df

df <- data.frame(c1=c(1,1,1),c2=c(2,2,2))
df[is.na(df)] <- 0
Df

Any help would be appreciated.  I could just convert the data frame to a
matrix, execute the code, then convert it back to a data frame, but that
appears long winded.

Thanks
Mick

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


[R] Space between bars in barplot

2005-01-13 Thread michael watson \(IAH-C\)
Hi

I am trying to understand the "space" argument to barplot() and I think
it is not working as stated.  The docs say:

  space: the amount of space (as a fraction of the average bar width)
  left before each bar.

Which means that I can pass a vector, the same length as the no. of
bars, and the nth element of that vector will be the space left before
the nth bar.  This is always true except for the FIRST bar.  Eg:

barplot(c(1,2,3,4),space=c(1,1,1,1))  # equally spaced bars as expected

barplot(c(1,2,3,4),space=c(1,20,1,1))  # massive gap before the 2nd bar

barplot(c(1,2,3,4),space=c(20,1,1,1))  # the same as the first plot

I'm guessing this is going to be something to do with par() any idea
how I can adjust the space between the x-axis and the first bar?

Thanks
Mick


 


[[alternative HTML version deleted]]

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


RE: [R] Installation of XML library can't find libxml2.dll

2005-01-11 Thread michael watson \(IAH-C\)
Thank you for all the responses;  in fact, it was all solved by using
Bioconductor

library(reposTools)
install.packages2("XML")

However, I am still having heaps of trouble getting SSOAP, Rcurl and
KEGGSOAP to use my proxy server

Mick

-Original Message-
From: dr mike [mailto:[EMAIL PROTECTED] 
Sent: 10 January 2005 17:47
To: michael watson (IAH-C)
Cc: R-help@stat.math.ethz.ch
Subject: RE: [R] Installation of XML library can't find libxml2.dll


My reading of this is that you may have installed the 'Windows binary'
package from the Omegahat site - if so, it would appear that this is for
versions of R < 2.0 . Further to the pointer to the reply by Prof
Ripley, hisa link provides the correct Windows binary for R >= 2.0.

Regards

Mike

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of michael watson
(IAH-C)
Sent: 10 January 2005 14:41
To: R list
Subject: [R] Installation of XML library can't find libxml2.dll

Sorry to ask a (probably) dumb question, but I am trying to install XML
package on Windows XP, R 2.0.1, and I get the error: 

"This application has failed to start because libxml2.dll was not found.
Re-installing the application may fix this problem"

> library(XML)
Error in dyn.load(x, as.logical(local), as.logical(now)) : 
unable to load shared library
"C:/PROGRA~1/R/rw2001/library/XML/libs/XML.dll":
  LoadLibrary failure:  The specified module could not be found. Error
in library(XML) : package/namespace load failed for 'XML'

Now, having read the website at http://www.omegahat.org/RSXML/, I find
that the package:

"uses libxml2, by default and only libxml(version 1) if libxml2 is not
present "

And here's my dumb question - what is libxml2 in a windows context and
where do I get it from?

Thanks
Mick

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

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


[R] SSOAP and Rcurl with proxy server

2005-01-10 Thread michael watson \(IAH-C\)
Hi

I'm trying to use a bioconductor package (KEGGSOAP) which relies on
Rcurl and SSOAP.

As an example, a function exists:

> list.organisms
function () 
{
orgs <- matrix(unlist(.SOAP(KEGGserver, "list_organisms", 
"", action = KEGGaction, xmlns = KEGGxmlns), use.names = FALSE),

ncol = 2, byrow = TRUE)
temp <- orgs[, 2]
names(temp) <- orgs[, 1]
return(temp)
}

As can be seen, this function uses the .SOAP method from SSOAP.

The function does not work as the .SOAP function times out.  This is
undoubtedly because it is not aware of my proxy server (functions such
as download.file() and getURL() (from RCurl) work fine, although the
latter requires me to specifically pass the proxy argument as
tag=value).  Unfortunately, the SSOAP package seems to have an alarming
lack of documentation on how to make it work with proxy servers.  The
.SOAP function even includes:

"...: name=value arguments to pass to the "

So a bit of a typo there (no problem we all do it).  Anyway, even if I
pass proxy="blah" to .SOAP I still get a time out.

I would really appreciate hearing from someone who has SSOAP, RCurl and
even KEGGSOAP working from behind a firewall and through a proxy server.

Cheers
Mick

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


[R] Installing RCurl on Linux

2005-01-10 Thread michael watson \(IAH-C\)
Hi

I'm not having much luck today!  Running Suse Linux 8.2, R 2.0.0, trying
to install RCurl_0.5-1.tar.gz.  

Perhaps there's an issue with my C compiler, but I got some errors:

IAHC-LINUX03:/usr/users/mwatson # R CMD INSTALL RCurl_0.5-1.tar.gz
* Installing *source* package 'RCurl' ...
checking for curl-config... /usr/bin/curl-config
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
No libidn field in version structure.
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -I/usr/lib/R/include -Wall -I/usr/include  -I/usr/local/include
-I/opt/gnome/include -D__NO_MATH_INLINES -mieee-fp  -fPIC   -c curl.c -o
curl.o
curl.c: In function `R_curl_easy_init':
curl.c:43: error: `CURLOPT_HTTPAUTH' undeclared (first use in this
function)
curl.c:43: error: (Each undeclared identifier is reported only once
curl.c:43: error: for each function it appears in.)
curl.c:43: error: `CURLAUTH_ANY' undeclared (first use in this function)
curl.c: In function `R_curl_easy_setopt':
curl.c:153: warning: implicit declaration of function
`curl_easy_strerror'
curl.c:154: warning: format argument is not a pointer (arg 7)
curl.c: In function `RCurlVersionInfoToR':
curl.c:683: error: structure has no member named `ares'
curl.c:683: error: structure has no member named `ares'
curl.c:684: error: structure has no member named `ares_num'
make: *** [curl.o] Error 1
ERROR: compilation failed for package 'RCurl'

Any ideas?  Thanks

Mick

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


[R] Installation of XML library can't find libxml2.dll

2005-01-10 Thread michael watson \(IAH-C\)
Sorry to ask a (probably) dumb question, but I am trying to install XML
package on Windows XP, R 2.0.1, and I get the error: 

"This application has failed to start because libxml2.dll was not found.
Re-installing the application may fix this problem"

> library(XML)
Error in dyn.load(x, as.logical(local), as.logical(now)) : 
unable to load shared library
"C:/PROGRA~1/R/rw2001/library/XML/libs/XML.dll":
  LoadLibrary failure:  The specified module could not be found.
Error in library(XML) : package/namespace load failed for 'XML'

Now, having read the website at http://www.omegahat.org/RSXML/, I find
that the package:

"uses libxml2, by default and only libxml(version 1) if libxml2 is not
present "

And here's my dumb question - what is libxml2 in a windows context and
where do I get it from?

Thanks
Mick

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


RE: [R] Replacing all NA values in a matrix

2005-01-05 Thread michael watson \(IAH-C\)
Doh, replace() does the job just fine.
Sheesh, I'm not coping well with work post christmas ;-)

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of michael watson
(IAH-C)
Sent: 05 January 2005 14:26
To: R-help@stat.math.ethz.ch
Subject: [R] Replacing all NA values in a matrix


OK, dumb question, and it is probably in the docs somewhere, but after
12 months working with R and quite a while looking at the docs, I still
don't know (or have forgotten) how to replace all NA values in a matrix
at once with some other value.  I can do it column by column using
is.na(), but I can't figure out how to do it for the whole matrix.  My
apologies, I am ashamed ;-)

Michael Watson
Head of Informatics
Institute for Animal Health,
Compton Laboratory,
Compton,
Newbury,
Berkshire RG20 7NN
UK

Phone : +44 (0)1635 578411 ext. 2535
Mobile: +44 (0)7990 827831
E-mail: [EMAIL PROTECTED]

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

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


[R] Replacing all NA values in a matrix

2005-01-05 Thread michael watson \(IAH-C\)
OK, dumb question, and it is probably in the docs somewhere, but after
12 months working with R and quite a while looking at the docs, I still
don't know (or have forgotten) how to replace all NA values in a matrix
at once with some other value.  I can do it column by column using
is.na(), but I can't figure out how to do it for the whole matrix.  My
apologies, I am ashamed ;-)

Michael Watson
Head of Informatics
Institute for Animal Health,
Compton Laboratory,
Compton,
Newbury,
Berkshire RG20 7NN
UK

Phone : +44 (0)1635 578411 ext. 2535
Mobile: +44 (0)7990 827831
E-mail: [EMAIL PROTECTED]

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


[R] Where to put example files?

2005-01-04 Thread michael watson \(IAH-C\)
I'm writing an R package which includes some text file parsing
functions, and I want to include with my package some example files to
be used with those functions.  My question is which directory should I
put these example files in for the user to access?  I have tried demo,
example, doc and sample but none seem to work or "fit".

Thanks in advance
Mick

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


[R] Difference between "R CMD build --binary" and "R CMD INSTALL --build"

2005-01-04 Thread michael watson \(IAH-C\)
As the title suggests, when building R packages on Windows, what is the
difference between:

R CMD build --binary mypack

And 

R CMD INSTALL --build mypack

??  The former is suggested by my previous notes and seems to work, and
the latter is suggested by
http://www.biostat.jhsph.edu/~kbroman/Rintro/Rwinpack.html, and also
seems to work.

Thanks in advance

Mick

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


[R] Preformatted text in Rd files

2004-12-22 Thread michael watson \(IAH-C\)
A quickie - how do I include preformatted text within the "details" section of 
an .Rd file?

Thanks
Mick

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Creating a vector of colours that are as different from one another as possible

2004-12-21 Thread michael watson \(IAH-C\)
Hi

I want to create a vector of colors that are as different from one
another as possible.  ?rainbow states "Conceptually, all of these
functions actually use (parts of) a line cut out of the 3-dimensional
color space...".  This suggests to me that the resulting colors are all
placed on this "line" and are equi-distant along it.  The resulting
color palette is a range of colours where adjacent colours are actually
quite similar, especially when n (the number of colours) is high.

Conceptually I guess what I want is colors from a 3D polygon in 3D
colour space, where the number of vertices in the polygon is n,
resulting in a color palette where the colors are all quite different
from one another.  Is this possible or am I talking crap? (I've only had
one coffee this morning)

Thanks in advance
Mick

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] about colnames

2004-12-21 Thread michael watson \(IAH-C\)
Try

colnames(df)[4:6] <- c("x","y","z")

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 21 December 2004 09:45
To: [EMAIL PROTECTED]
Subject: [R] about colnames


Hello sir:
If there's a data frame(with name "df"):
a  b  c d  e   f 
1 10 12 20 30  100
2 3  15 16 40  200
..

If I wanna change the last 3 colunm names"d" "e" "f" respectively into
"x" "y" "z"respectively,the following is what I do:
colnames(df[4:6])<-c("x","y","z")
But no change to the colnames of df.



And if I wanna change all the colnames: colnames(df)<-letters[1:6] All
the colnames have been changed.

So I wanna know the reason,and how to change the last 3 colnames of df.

Thanks a lot!

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] problems with limma

2004-12-20 Thread michael watson \(IAH-C\)
Could you give a bit more detail about your experimental design?  You're using 
affy, so you're working with single channel data - so nzw, akr and bas all have 
six arrays?


-Original Message-
From:   [EMAIL PROTECTED] on behalf of [EMAIL PROTECTED]
Sent:   Mon 12/20/2004 8:45 PM
To: [EMAIL PROTECTED]
Cc: 
Subject:[R] problems with limma
I try to send this message To Gordon Smyth at [EMAIL PROTECTED],edu.au but it 
bounced
back, so here it is to r-help

I am trying to use limma, just downloaded it from CRAN. I use R 2.0.1 on Win XP
see the following:
> library(RODBC)
> chan1 <- odbcConnectExcel("D:/Data/mgc/Chips/Chips4.xls")
> dd <- sqlFetch(chan1,"Raw")   # all data  12000
> #
> nzw <- cbind(dd$NZW1C,dd$NZW2C,dd$NZW3C,dd$NZW1T,dd$NZW2T,dd$NZW3T)
> akr <- cbind(dd$AKR1C,dd$AKR2C,dd$AKR3C,dd$AKR1T,dd$AKR2T,dd$AKR3T)
> bas <- cbind(dd$NZW1C,dd$NZW2C,dd$NZW3C,dd$AKR1C,dd$AKR2C,dd$AKR3C)
> #
>  design<-matrix(c(1,1,1,1,1,1,0,0,0,1,1,1),ncol=2)
>  fit1 <- lmFit(nzw,design)
>  fit1 <- eBayes(fit1)
>  topTable(fit1,adjust="fdr",number=5)
  M t  P.Value B
1  3679.480 121.24612 7.828493e-06 -4.508864
1903   3012.405 118.32859 7.828493e-06 -4.508866
9068   1850.232  92.70893 1.178902e-05 -4.508889
10635  2843.534  91.99336 1.178902e-05 -4.508890
561   18727.858  90.17085 1.178902e-05 -4.508893
> #
>  fit2 <- lmFit(akr,design)
>  fit2 <- eBayes(fit2)
>  topTable(fit2,adjust="fdr",number=5)
  Mt  P.Value B
88 1426.738 80.48058 5.839462e-05 -4.510845
1964  36774.167 73.05580 5.839462e-05 -4.510861
5854   7422.578 68.60316 5.839462e-05 -4.510874
11890  1975.316 66.54480 5.839462e-05 -4.510880
9088   2696.952 64.16343 5.839462e-05 -4.510889
> #
>  fit3 <- lmFit(bas,design)
>  fit3 <- eBayes(fit3)
>  topTable(fit3,adjust="fdr",number=5)
 M t  P.Value B
6262  1415.088 100.78933 2.109822e-05 -4.521016
5660  1913.479  96.40903 2.109822e-05 -4.521020
11900 4458.489  94.30738 2.109822e-05 -4.521022
9358  1522.330  80.46641 3.346749e-05 -4.521041
11773 1784.483  73.76620 3.346749e-05 -4.521053
> #Now lets do all together in Anova
> #
>  all <- cbind(nzw,akr)
>  ts <- c(1,1,1,2,2,2,3,3,3,4,4,4)
>  ts <- as.factor(ts)
>  levels(ts) <- c("nzwC","nzwT","akrC","akrT")
>  design <- model.matrix(~0+ts)
>  colnames(design) <- levels(ts)
>  fit4 <- lmFit(all,design)
>  cont.matrix <- makeContrasts(
+  Baseline = akrC - nzwC,
+  NZW_Smk = nzwT - nzwC,
+  AKR_Smk = akrT - akrC,
+  Diff = (akrT - akrC) - (nzwT - nzwC),
+  levels=design)
>   fit42 <- contrasts.fit(fit4,cont.matrix)
>   fit42 <- eBayes(fit42)
> #
>   topTable(fit42,coef="Baseline",adjust="fdr",number=5)
   M t P.Value B
3189942.0993  13.57485 0.004062283 -4.528799
8607   2634.1826  11.23476 0.006913442 -4.530338
10242  -942.2860 -10.99253 0.006913442 -4.530551
283-609.0831 -10.79354 0.006913442 -4.530735
3224  -1564.2572 -10.19429 0.008089034 -4.531351

- Shouldn't this be equal to fit1 above?

>   topTable(fit42,coef="NZW_Smk",adjust="fdr",number=5)
 M t   P.Value B
7724 -246.5956 -8.687324 0.1615395 -4.591133
1403 -307.8660 -7.063312 0.4066814 -4.591363
3865 -253.4899 -6.585582 0.4598217 -4.591457
3032 -509.2413 -5.841901 0.8294166 -4.591640
2490 -240.3259 -5.338679 0.9997975 -4.591795

- Shouldn't this be equal to fit2 above?
- The P.Value are unreal!!

>   topTable(fit42,coef="AKR_Smk",adjust="fdr",number=5)
 Mt  P.Value B
11547 151.6622 6.380978 0.917470 -4.595085
12064 324.0851 6.337235 0.917470 -4.595085
6752  964.5478 5.858994 0.952782 -4.595086
10251 152.7587 5.339843 0.952782 -4.595087
1440  189.6056 4.933151 0.952782 -4.595089

- Shouldn't this be equal to fit3 above?
- The P.Value are unreal!!

>   topTable(fit42,coef="Diff",adjust="fdr",number=5)
  M t   P.Value B
7724   302.6892  7.540195 0.4102211 -4.593201
1403   419.4962  6.805495 0.4102211 -4.593265
10251  270.5269  6.686796 0.4102211 -4.593277
3270   409.8391  6.414966 0.4192042 -4.593307
10960 -511.4711 -5.469247 0.9652171 -4.593435
> #
>
So the results I get from just pairwise comparisons are very significant, but
when I try the Anova way, the significance completely dissapears.
Am I doing something completely wrong?
This is data from Affimetrix mouse chips.
Thanks for any help
Heberto Ghezzo
Ph.D.
Meakins-Christie Labs
McGill University
Montreal - Canada

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listi

RE: [R] Memory problem with jpeg() and wide jpegs

2004-12-20 Thread michael watson \(IAH-C\)
Surprisingly, Internet Explorer (which due to it's browser dominance will be 
the main, but not sole, purveyor of the images I create) loads this image up in 
a few seconds and allows the user to scroll along it very nicely.  The image is 
really for demonstration purposes only, and many people who use the package I 
am writing (if there are any) will create much smaller images of the object in 
question.  However, I like the fact that R can draw a whole genome in about 10 
seconds, don't you? ;-)

Mick


-Original Message-
From:   Prof Brian Ripley [mailto:[EMAIL PROTECTED]
Sent:   Mon 12/20/2004 5:37 PM
To: Uwe Ligges
Cc:     michael watson (IAH-C); [EMAIL PROTECTED]
Subject:Re: [R] Memory problem with jpeg() and wide jpegs
It is also several times greater than the limit of human perception, being 
several feet long at printing resolutions that need a magnifying glass 
to see.

This is Windows and the limit is in the graphics card: mine is able to do 
this but I suspect you need a 128Mb card (that jpeg is of itself about 
90Mb).  However, most viewers (including PhotoShop) will barf on such a 
large jpeg.


On Mon, 20 Dec 2004, Uwe Ligges wrote:

> michael watson (IAH-C) wrote:
>
>> Hi
>> 
>> I have been creating very, very long jpeg images for the last two weeks
>> using jpeg().  All of a sudden, and I mean that, it's stopped working -
>> I've not changed a thing!  The error message I get is:
>> 
>> 
>>> jpeg("out.jpg",width=5,height=480, quality=100)
>> 
>> Error in devga(paste("jpeg:", quality, ":", filename, sep = ""), width,
>> : unable to start device devga
>> In addition: Warning message: Unable to allocate bitmap 
>> I have plenty of disk space in the place I want to create the jpeg, and
>> if I reduce it from "width=5" to "width=5000", then it works no
>> problem, which suggests it is a memory problem.  If I close R and
>> re-open R the problem does not go away.  And as I said above, I have
>> been using this code for weeks with no problem, then I change nothing,
>> and start getting this error message.
>
> I don't believe it has worked. Such a huge one does not work for me even on a 
> rather big machine.
> If it had worked: On the same platform, OS, R version?
> I think you have to contribute a patch in order to get such a huge jpeg.
>
> Uwe Ligges
>
>
>> I'm running R 2.0.1 on Windows XP.  I'm going to restart Windows and see
>> if that helps, but if re-starting windows does help, is there an
>> explanation as to where all the memory R used to be able to get at
>> disappeared to in the current session?
>>
>> Cheers
>> Mick
>> 
>> __
>> [EMAIL PROTECTED] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide! 
>> http://www.R-project.org/posting-guide.html
>
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Memory problem with jpeg() and wide jpegs

2004-12-20 Thread michael watson \(IAH-C\)
Uwe, I had to smile at your comments - the code works on my 512Mb laptop


-Original Message-
From:   Uwe Ligges [mailto:[EMAIL PROTECTED]
Sent:   Mon 12/20/2004 2:23 PM
To: michael watson (IAH-C)
Cc: [EMAIL PROTECTED]
Subject:Re: [R] Memory problem with jpeg() and wide jpegs
michael watson (IAH-C) wrote:

> Hi
> 
> I have been creating very, very long jpeg images for the last two weeks
> using jpeg().  All of a sudden, and I mean that, it's stopped working -
> I've not changed a thing!  The error message I get is:
> 
> 
>>jpeg("out.jpg",width=5,height=480, quality=100)
> 
> Error in devga(paste("jpeg:", quality, ":", filename, sep = ""), width,
> : 
> unable to start device devga
> In addition: Warning message: 
> Unable to allocate bitmap 
> 
> I have plenty of disk space in the place I want to create the jpeg, and
> if I reduce it from "width=5" to "width=5000", then it works no
> problem, which suggests it is a memory problem.  If I close R and
> re-open R the problem does not go away.  And as I said above, I have
> been using this code for weeks with no problem, then I change nothing,
> and start getting this error message.

I don't believe it has worked. Such a huge one does not work for me even 
on a rather big machine.
If it had worked: On the same platform, OS, R version?
I think you have to contribute a patch in order to get such a huge jpeg.

Uwe Ligges


> I'm running R 2.0.1 on Windows XP.  I'm going to restart Windows and see
> if that helps, but if re-starting windows does help, is there an
> explanation as to where all the memory R used to be able to get at
> disappeared to in the current session?
 >
> Cheers
> Mick
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Memory problem with jpeg() and wide jpegs

2004-12-20 Thread michael watson \(IAH-C\)
Hi

I have been creating very, very long jpeg images for the last two weeks
using jpeg().  All of a sudden, and I mean that, it's stopped working -
I've not changed a thing!  The error message I get is:

> jpeg("out.jpg",width=5,height=480, quality=100)
Error in devga(paste("jpeg:", quality, ":", filename, sep = ""), width,
: 
unable to start device devga
In addition: Warning message: 
Unable to allocate bitmap 

I have plenty of disk space in the place I want to create the jpeg, and
if I reduce it from "width=5" to "width=5000", then it works no
problem, which suggests it is a memory problem.  If I close R and
re-open R the problem does not go away.  And as I said above, I have
been using this code for weeks with no problem, then I change nothing,
and start getting this error message.

I'm running R 2.0.1 on Windows XP.  I'm going to restart Windows and see
if that helps, but if re-starting windows does help, is there an
explanation as to where all the memory R used to be able to get at
disappeared to in the current session?

Cheers
Mick

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] If it's not a data.frame, matrix or vector, what is it?

2004-12-17 Thread michael watson \(IAH-C\)
OK I'm definitely being a bit ignorant (so please accept my apologies)
of R and it's internal data storage.

When I created the data.frame, I did use I() with this column - the
original data being a vector created simply with "vector()".  It's clear
now that I didn't realise exactly what this was doing (all I wanted was
for it to NOT be converted to a factor).  

> str(submin[,display.gname])
Class 'AsIs'  chr [1:4622] "" "" "" "" ...
> is.array(submin[,display.gname])
[1] FALSE
> class(submin[,display.gname])
[1] "AsIs"

But I am still confused; I program mainly in perl and java, and this
"thing" - it's not a vector, an array, a matrix or a data.frame - so
what is "it"? :-S

Thanks 

Mick


-Original Message-
From: Liaw, Andy [mailto:[EMAIL PROTECTED] 
Sent: 17 December 2004 15:55
To: michael watson (IAH-C); [EMAIL PROTECTED]
Subject: RE: [R] If it's not a data.frame, matrix or vector, what is it?


What does str(submin$display.gname) say?

Andy

> From: michael watson (IAH-C)
> 
> Hi
> 
> Forgive my ignorance.  I am selecting a column of a
> data.frame using the
> column name, and I want to know what the resulting column 
> "is".  My data
> frame is called "submin" and the column name is held in a variable
> called "display.gname" Eg:
> 
> > is.data.frame(submin)
> [1] TRUE
> > is.data.frame(submin[,display.gname])
> [1] FALSE
> > is.matrix(submin[,display.gname])
> [1] FALSE
> > is.vector(submin[,display.gname])
> [1] FALSE
> > length(submin[,display.gname])
> [1] 4622
> 
> So if it's not a data.frame, a matrix or a vector, what is "it"?
> 
> Thanks (and sorry if this is in the FAQ)
> 
> Mick
> 
> __
> [EMAIL PROTECTED] mailing list 
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> 
> 



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

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


  1   2   >