Re: [R] graphic of hierachical clustering

2003-09-08 Thread Gavin Simpson
Hi Martin,

try ?plot.default

which states:

frame.plot: a logical indicating whether a box should be drawn around
  the plot.
So the following:

postscript(file = "hc605.ps")
plot(as.dendrogram(reshc), horiz = TRUE, ylab = "", main = " ",
frame.plot = FALSE)
dev.off()
should get you what you want.

plot.dendrogram doesn't explicitly mention frame.plot, but the ... 
allows you to pass plotting parameters to other methods:

..., xlab, ylab: graphical parameters, or arguments for other methods.

As for the postscript -> gif - I'm not qualified to explain this, except 
that it must have something to do with the fact that by doing 
box(col="white") you aren't actually *deleting* the box, you are just 
overplotting on it.

HTH

Gav

Martin Olivier wrote:

Hi all,

I would like to save the dendrogram of a hierarchical clustering.
Let reshc the result of the fucntion hclust(). To save the dendrogram,
I can use the function postscript:
postscript(file="hc605.ps")
plot(as.dendrogram(reshc),horiz=T,ylab="",main=" ")
dev.off()
Using the functions plot and as.dendrogram, it is possible to obtain an 
horizontal tree with option horiz=T.
The problem is there is a box around the tree...this box looks like the 
result of the function box() and it is possible
to delete it with box(col="white"). But when I convert the postscript 
file in gif or tiff file, this box  is not deleted.

Could you explain me why this box appear after the conversion of my 
postscript file and a solution
to delete this box in a gif or tiff format? (I know I can use 
plot(reshc) but the tree is vertical   in this case)

Regards,
Olivier.
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] insert eps into microsft word

2003-09-10 Thread Gavin Simpson
Depending on your version of Word that simply is *not* true!

I can't test this here (I now have Word XP/2002) but my colleagues have 
Word 97 on their college-supplied service (yes, really!) and despite not 
being able to see a preview, they can quite happily import eps files I 
have produced during the course of my work. Admitedly a blank box in 
word is not the most user-friendly thing to work with, but this old 
version of Word will happily deal with the postscript produced.

Having used Word 2000 and XP during the course of writing a PhD thesis 
that used R-generated plots extensively, I know first hand how easy it 
is to deal with eps files from R in Word.

My setup involves using Ghostscript/GSView on Windows XP to view the eps 
plots I produce in R and then import them into Word XP (the eps filter 
now seems to add a preview for you), but if you have an earlier word 
version, GSView can easily add a preview for you.

Also, onefile = TRUE does *not* produce eps files.

I quote from ?postscript :

 onefile: logical: if true (the default) allow multiple figures in one
  file.  If false, generate a file name containing the page
  number and use an EPSF header and no `DocumentMedia' comment.
It is a bit confusing, but onefile = TRUE is for producing multi-page 
postscript documents, i.e. put all the plots to follow into a single 
postscript doc with (possibly) more than a single page.

I know a number of people have suggested using a windows metafile. 
Whilst this might offer a solution to your problem, unless you are using 
a very-out-of-date version of Word I cannot see the advantages of using 
metafiles over postscript.

HTH

Gavin

Karim Elsawy wrote:

it seems that word can not read encapsupalted postscripts generated by R
I used this command
postscript("output.eps",horizontal=F,onefile=TRUE)
since onefile=TRUE produces an encapsualted postscript
actually what I'm trying to do is to insert the postsript file into a
word document
since other formats like jpeg and bmp do not reproduce the same quality
like postscript
formats
any suggestions are very much appreciated
Karim
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Plotting of the lm

2003-09-23 Thread Gavin Simpson
Try this:

plot(x, y)
abline(lm(y ~ x)) #plots the fitted line
or this if you need the model results elsewhere:

mod.lm <- lm(y ~ x)   # store the model
plot(x, y)# plot the data
abline(mod.lm)# plot the fitted line
see ?plot.lm and ?abline

HTH

Gav

[EMAIL PROTECTED] wrote:

Hi,

I would like to enquire if by typing plot (lm(y~x)) would this show me the
plot of the fitted line? I tried this function previously but I was only
able to get the last 4 plots starting with Residuals vs fitted. 

Thank You.

Melissa


JLT Risk Solutions Ltd
6 Crutched Friars, London EC3N 2PH. Co Reg No 1536540
Tel: (44) (0)20 7528 4000   Fax: (44) (0)20 7528 4500
http://www.jltgroup.com
Lloyd's Broker.  Regulated by the General Insurance
Standards Council

The content of this e-mail (including any attachments) as 
received may not be the same as sent. If you consider that 
the content is material to the formation or performance of 
a contract or you are otherwise relying upon its accuracy, 
you should consider requesting a copy be sent by facsimile 
or normal mail.  The information in this e-mail is 
confidential and may be legally privileged. If you are not 
the intended recipient, please notify the sender immediately 
and then delete this e-mail entirely - you must not retain, 
copy, distribute or use this e-mail for any purpose or 
disclose any of its content to others.

Opinions, conclusions and other information in this e-mail 
that do not relate to the official business of JLT Risk 
Solutions Ltd shall be understood as neither given nor 
endorsed by it.  Please note we intercept and monitor 
incoming / outgoing e-mail and therefore you should neither 
expect nor intend any e-mail to be private in nature.

We have checked this e-mail for viruses and other harmful 
components and believe but not guarantee it virus-free prior 
to leaving our computer system.  However, you should satisfy 
yourself that it is free from harmful components, as we do 
not accept responsibility for any loss or damage it may 
cause to your computer systems.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] lda source code

2003-10-01 Thread Gavin Simpson
Wei Geng wrote:
Does anyone know where to find out lda source code ?
Try typing lda.default at the prompt. That should get you started. Also see:

> methods(lda)

as lda.default isn't the only bit of code used in lda()

Alternatively, grab the source from CRAN and read it at your leisure.

HTH

Gav

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] lda source code

2003-10-01 Thread Gavin Simpson
Wei Geng wrote:

Hi Jason, Spencer,

Thanks for the prompt response. The strange thing about MASS is that it's
not in "Package Sources" as most of other R packages are. It seems to come
with the binary R installation. I checked out the Rxx/library/MASS on my
laptop, there are source code (script) for Venables & Ripley's book but no
source code for lda().
Wei, MASS is actually distributed in a bundle called VR, which is on 
CRAN. VR as in Venables and Ripley, the authors of MASS (the book). The 
VR bundle contains MASS, nnet, spatial and class packages.

The reason MASS comes with your binary installation is that the VR 
bundle has Recommended status - and should therefore be available in all 
binary distributions.

HTH,

G
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] plotting results from leaps library

2003-10-08 Thread Gavin Simpson
Anne Piotet wrote:
Hi In trying to fit a linear model , I use the leaps() function to 
determine wich predictors I should include in my model. I would like 
to plot the Mallow's Cp criteria against p with the indexes of 
selected model variates as points labels

Is there already such a function? (I could not find it)

Thanks Anne

[[alternative HTML version deleted]]

__ 
[EMAIL PROTECTED] mailing list 
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


try subsets() in John Fox's car package. You need to use regsubsets() in 
package leaps, not leaps(), but the plot.subsets() function in car would 
appear to produce what you want.

HTH

Gav

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Getting rows from a dataframe

2003-10-09 Thread Gavin Simpson
Mark Lee wrote:

Sorry if this is a silly question. I'm trying to extract all elements
of a dataframe at a particular row. I can find no mention of this in
any documentation and it may be naivety of dataframe on my part as I'm
very green at this. Thankyou,
Mark

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

dat <- data.frame(var1 = c(1:10), var2 = c(31:40), var3 = c(6:15))

dat[1, ] #extract 1st row

dat[1:4, ] #extract rows 1 through 4

dat[c(1,3,5,7,9), ] #extract named non-consecutive rows

dat[ ,1] # extract 1st column

... etc

It's in 'An Introduction to R' that should have come with your 
distribution, or in the manuals section of the r website:

http://www.r-project.org

HTH
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] problem using do.call and substitute for predict.glm using poly()

2003-10-27 Thread Gavin Simpson
Hi

I am having a particular problem with some glm models I am running. I 
have been adapting code from Bill Venables 'Programmers niche' in RNews 
Vol 2/2 to fit ca. 1000 glm models to a combination of species 0/1 data 
(as Y) and related physicochemical data (X), to automate the process of 
fitting this many models. I have successfully managed to fit all the 
models and have stored the results in a list, each list has 47 main 
'branches' (one for each species) and each branch has 23 'leaves' that 
each contain a glm object

But R throws up the following error:

Error in poly(Alk1, degree = 2, coefs = structure(list(alpha = 
c(37.7515662650602,  :
Object "Alk1" not found

When trying to evaluate the following code:

pAsgn <- paste("predList[[i]][[n]] <- try(predict(resList$Y$X, newdata 
= 	data.frame(X = predData$X), type = 'response', se = TRUE))")
pAsgn <- parse(text = pAsgn)[[1]]
for (i in namY) {
for (n in namX) {
TAsgn <- do.call("substitute", list(pAsgn, list(n = n, i 
= i, X 			= as.name(n), Y = as.name(i
eval(TAsgn)
}
}

Alk1 is used above as an example, all 23 predictors are 'not found' 
depending on which part of the loop I'm in. Investigation of the 
predList object after this has run shows for example:

$Unk.nown$NCR
[1] "Error in poly(NCR, degree = 2, coefs = structure(list(alpha = 
c(218.156626506024,  : \nObject \"NCR\" not found\n"
attr(,"class")
[1] "try-error"

pAsgn contains a parsed R expression:

predList[[i]][[n]] <- try(predict(resList$Y$X, newdata = 
data.frame(X = 		predData$X), type = "response", se = TRUE))

I think I have narrowed the problem down to the fact that the first X in 
newdata = data.frame(X = predData$X)... is not being substitute with the 
variable in question, where as all the other X and Y's are being 
substituted:
(n and i would be supplied by for loops (see above) so I have 
substituted  two values below as if they had been in the loop)

> do.call("substitute", list(pAsgn, list(n = namX[1], i = 
namY[1], X = 			as.name(n), Y = as.name(i
predList[["Acr.harp"]][["Alk1"]] <- try(predict(resList$Unk.nown$NCR,
newdata = data.frame(X = predData$NCR), type = "response",
se = TRUE))^^ problem here

If i supply the values I want for one of the runs, such as:

> predList[[1]][[1]] <- try(predict(resList$Acr.harp$Alk1, newdata = 
data.frame(Alk1 = predData$Alk1), type = "response", se = TRUE))

Then this works, so the question is, how to I get X to be substituted in 
the above call? Perhaps this is not the cause of the error, so if anyone 
else has other suggestions.

Thank you for help.

Gav

ps: version
platform i386-pc-mingw32
arch i386
os   mingw32
system   i386, mingw32
status
major1
minor8.0
year 2003
month10
day  08
language R
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] problem using do.call and substitute for predict.glm using poly()

2003-10-27 Thread Gavin Simpson
Dear List,

I think I have found the source of my problem in a reply from Thomas 
Lumley to a previous question on R-Help: 
http://www.r-project.org/nocvs/mail/r-help/2002/0586.html

My code is not working because substitute() does not substitute formal 
arguments to functions, and I guess the first X in data.frame(X = 
predData$X) is a formal argument to data.frame().

The recommended options are to use formals() or parse(deparse()) to 
achieve the required effect, but here I get a somewhat stuck.

I was wondering if anyone on the list could show my how to modify my 
existing code:

pAsgn <- paste("predList[[i]][[n]] <- try(predict(resList$Y$X, newdata 
= 	data.frame(X = predData$X), type = 'response', se = TRUE))")
pAsgn <- parse(text = pAsgn)[[1]]
for (i in namY) {
for (n in namX) {
TAsgn <- do.call("substitute", list(pAsgn, list(n = n, i = i, X
		= as.name(n), Y = as.name(i
eval(TAsgn)
}
}

so that data.frame(X = predData$X) is replaced with the value of X such 
that the output from do.call in the loop is something like:

predList[["Acr.harp"]][["Alk1"]] <- try(predict(resList$Acr.harp$Alk1,
newdata = data.frame(Alk1 = predData$Alk1), type = "response",
se = TRUE))
If anyone could point me in the right direction it would be most 
appreciated.

All the best

Gav

Gavin Simpson wrote:

Hi

I am having a particular problem with some glm models I am running. I 
have been adapting code from Bill Venables 'Programmers niche' in RNews 
Vol 2/2 to fit ca. 1000 glm models to a combination of species 0/1 data 
(as Y) and related physicochemical data (X), to automate the process of 
fitting this many models. I have successfully managed to fit all the 
models and have stored the results in a list, each list has 47 main 
'branches' (one for each species) and each branch has 23 'leaves' that 
each contain a glm object

But R throws up the following error:

Error in poly(Alk1, degree = 2, coefs = structure(list(alpha = 
c(37.7515662650602,  :
Object "Alk1" not found

When trying to evaluate the following code:

pAsgn <- paste("predList[[i]][[n]] <- try(predict(resList$Y$X, newdata 
= data.frame(X = predData$X), type = 'response', se = TRUE))")
pAsgn <- parse(text = pAsgn)[[1]]
for (i in namY) {
for (n in namX) {
TAsgn <- do.call("substitute", list(pAsgn, list(n = n, i = i, 
X = as.name(n), Y = as.name(i
eval(TAsgn)
}
}

Alk1 is used above as an example, all 23 predictors are 'not found' 
depending on which part of the loop I'm in. Investigation of the 
predList object after this has run shows for example:

$Unk.nown$NCR
[1] "Error in poly(NCR, degree = 2, coefs = structure(list(alpha = 
c(218.156626506024,  : \nObject \"NCR\" not found\n"
attr(,"class")
[1] "try-error"

pAsgn contains a parsed R expression:

predList[[i]][[n]] <- try(predict(resList$Y$X, newdata = data.frame(X 
= predData$X), type = "response", se = TRUE))

I think I have narrowed the problem down to the fact that the first X in 
newdata = data.frame(X = predData$X)... is not being substitute with the 
variable in question, where as all the other X and Y's are being 
substituted:
(n and i would be supplied by for loops (see above) so I have 
substituted  two values below as if they had been in the loop)

 > do.call("substitute", list(pAsgn, list(n = namX[1], i = namY[1], X 
= as.name(n), Y = as.name(i
predList[["Acr.harp"]][["Alk1"]] <- try(predict(resList$Unk.nown$NCR,
newdata = data.frame(X = predData$NCR), type = "response",
se = TRUE))^^ problem here

If i supply the values I want for one of the runs, such as:

 > predList[[1]][[1]] <- try(predict(resList$Acr.harp$Alk1, newdata = 
data.frame(Alk1 = predData$Alk1), type = "response", se = TRUE))

Then this works, so the question is, how to I get X to be substituted in 
the above call? Perhaps this is not the cause of the error, so if anyone 
else has other suggestions.

Thank you for help.

Gav

ps: version
platform i386-pc-mingw32
arch i386
os   mingw32
system   i386, mingw32
status
major1
minor8.0
year 2003
month10
day  08
language R
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] problem using do.call and substitute for predict.glm using poly()

2003-10-27 Thread Gavin Simpson
Dear Thomas,

Thank you for you reply and solution - it works perfectly! It hadn't 
occurred to me that a 1 column subset of a data frame was still a data 
frame and that therefore I didn't need to use data.frame() at all!

To the list as well, please ignore my second mail on this thread. I was 
trying to clarify my particular problem by focussing on what the problem 
actually was, without all the confusing information in the first post. 
It was not my intention to 'hassle' the list until someone provided me 
with an answer. As always, peoples' time and effort that goes into 
helping posters to this list solve their R-related problems is very much 
appreciated, and I for one am extremely grateful for the help I have 
received from the list over the past few years.

Many thanks,

Gav

Thomas Lumley wrote:

On Mon, 27 Oct 2003, Gavin Simpson wrote:


But R throws up the following error:

Error in poly(Alk1, degree = 2, coefs = structure(list(alpha =
c(37.7515662650602,  :
Object "Alk1" not found
When trying to evaluate the following code:

pAsgn <- paste("predList[[i]][[n]] <- try(predict(resList$Y$X, newdata
=   data.frame(X = predData$X), type = 'response', se = TRUE))")
pAsgn <- parse(text = pAsgn)[[1]]
for (i in namY) {
for (n in namX) {
TAsgn <- do.call("substitute", list(pAsgn, list(n = n, i
= i, X  = as.name(n), Y = as.name(i
eval(TAsgn)
}
}
Alk1 is used above as an example, all 23 predictors are 'not found'
depending on which part of the loop I'm in. Investigation of the
predList object after this has run shows for example:
$Unk.nown$NCR
[1] "Error in poly(NCR, degree = 2, coefs = structure(list(alpha =
c(218.156626506024,  : \nObject \"NCR\" not found\n"
attr(,"class")
[1] "try-error"
pAsgn contains a parsed R expression:

predList[[i]][[n]] <- try(predict(resList$Y$X, newdata =
data.frame(X =  predData$X), type = "response", se = TRUE))
I think I have narrowed the problem down to the fact that the first X in
newdata = data.frame(X = predData$X)... is not being substitute with the
variable in question, where as all the other X and Y's are being
substituted:


Yes, that's right.


(n and i would be supplied by for loops (see above) so I have
substituted  two values below as if they had been in the loop)
> do.call("substitute", list(pAsgn, list(n = namX[1], i =
namY[1], X =as.name(n), Y = as.name(i
predList[["Acr.harp"]][["Alk1"]] <- try(predict(resList$Unk.nown$NCR,
newdata = data.frame(X = predData$NCR), type = "response",
se = TRUE))^^ problem here
If i supply the values I want for one of the runs, such as:

> predList[[1]][[1]] <- try(predict(resList$Acr.harp$Alk1, newdata =
data.frame(Alk1 = predData$Alk1), type = "response", se = TRUE))
Then this works, so the question is, how to I get X to be substituted in
the above call? Perhaps this is not the cause of the error, so if anyone
else has other suggestions.


You should be able to use
   newdata=predData[n]
which would substitute to
   newdata=predData["Alk1"]
or even just
   newdata=predData
If you actually needed to substitute the tags you would (I think) need to
work with the parsed expression directly, which is possible but icky:

names(pAsgn[[3]][[2]][[3]])[2]<-"Alk1"
pAsgn
predList[[i]][[n]] <- try(predict(resList$Y$X, newdata = data.frame(Alk1 = 
predData$X),
type = "response", se = TRUE))
	-thomas


--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] more barplot presentation questions

2003-11-05 Thread Gavin Simpson
Hi Paul,

for the first question try ?grid

as in:

> barplot(1:10)
> grid(nx = NA, ny = NULL, col = "red")
nx = NA sets no lines on x-axis. ny = NULL draws lines from all tick 
marks on the y-axis.

HTH

Gav

Paul Sorenson wrote:

Thanks to those who pointed me at the solutions to the legend
overprinting the bars.  I took the "easy" way of rescaling the y
axis, picking the scaling factor for stacked bars is somewhat
problematic but sufficient for my application.
I have another couple of barplot questions:

- Can I extend the major ticks on the Y axis across the page?  Or
both axes to form a grid?
- A really neat graph for me would be a combination of side-by-side
and stacked bars in a single plot to display an additional category.
The background on the second problem is that I am displaying software
defect metrics.  For each month (the bins) the categories of interest
are: - new/fixed/closed - numeric severity (1 - 5)
I am currently displaying 5 separate graphs (6 when you take the
aggregate into account) with new/fixed/closed side-by-side.  If
within the side-by-side graphs I could show the severity stacked that
would be very neat.
Cheers

__ 
[EMAIL PROTECTED] mailing list 
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] with for objects

2003-12-02 Thread Gavin Simpson
Hadley Wickham wrote:
Yes, that is a (big) problem.  What do you suggest as an alternative?
I am experimenting visualising microarray data using trellis.  I end up 
with a whole lot of calls like xyplot(maA(swirl[,1]) ~ maM(swirl[,1]) | 
maPrintTip(swirl[,1])) and then if I want to plot the same thing for 
array 2, I need xyplot(maA(swirl[,2]) ~ maM(swirl[,2]) | 
maPrintTip(swirl[,2]))...  I don't want to limit myself to a fixed set 
of plots because I'm still exploring different ways to look at the data, 
but I would like to save myself some typing.

Could you not build the functions in a loop, using combinations of 
paste, eval and do.call ? I tried this method recently to fit a few 
thousand response curves to my species data using glm() [yes, most were 
completely uninteresting].

There is an excellent example of building function calls in RNews Vol2 
Issue 2 by Bill Venables (Programmer's Niche pages 24--26):

http://cran.r-project.org/doc/Rnews/Rnews_2002-2.pdf

This has the advantage of using the variable names in your plots/calls 
rather than the swirl[,1] format you have used.

Alternatively, grab the number of columns in swirl and then loop over 
your call replacing swirl[,1] with swirl[,i] e.g. [not tried]:

for (i in 1:length(swirl))
{
  xyplot(maA(swirl[,i]) ~ maM(swirl[,i]) | maPrintTip(swirl[,i]))
}
Wrap the whole thing in postscript() or pdf() so all the plots end up in 
a file you can look at later. Not sure whether you need to wrap the 
xyplot() in print() to get lattice to produce the plot in a loop (you do 
in a function for example) as I haven't used lattice much yet, but I'm 
sure someone on the list will correct/advise if needed.

HTH

Gav
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] RWinEdt

2003-12-02 Thread Gavin Simpson
Hi Luke,

Did you install the RWinEdt library as well? You don't say so, and the 
error message would suggest you didn't (or that the installation did not 
work)

Error in library(WinEdt) : there is no package called 'RWinEdt'
 

HTH

Gav

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] R GUI dies using postcript() in Windows XP Pro

2003-12-18 Thread Gavin Simpson
Dear List,

My colleague has been having a problem with the following data and 
plotting commands. The example below is part of a larger set of plots, 
but I've isolated the problem to this example using this small dataset 
(below), which kills rgui consistently. My version info

> version
 _
platform i386-pc-mingw32
arch i386
os   mingw32
system   i386, mingw32
status
major1
minor8.0
year 2003
month10
day  08
language R
But this also happens in 1.8.1 on Windows XP Pro

The code seems to stop at the call to plot() in the code below, and then 
MS's error reporting window pops up and informs us that rgui has been 
closed.

Note that the same code, but without the postcript() and dev.off() 
commands works as expected to produce the plot on a windows device.

Any ideas as to what is going on?

All the best,

Gav

#code to run to reproduce the problem
year <- c(1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 
1998, 1999, 2000, 2001, 2002)

avgMsr <- c(10.80, 7.00, 6.20, 9.571429, 10.80, 
11.60, 10.20, 11.40, 7.20, 9.40, 11.20, 
11.60, 11.60, 8.00, 7.60)

totMsr <- c(19, 17, 13, 24, 17, 17, 21, 18, 13, 15, 19, 18, 21, 15, 11)

postscript(file="invert.eps", onefile=FALSE, horizontal = FALSE, 
pointsize = 8)

op <- par(mar = c(3,4,1.5,1)+0.1,font.main=16,tcl=-0.2)
plot(x = year, y = avgMsr, ylab = "Species richness", main = "Loch Coire 
nan Arr", axes = FALSE, ylim = c(0,25), xlim = c(1988,2002))
axis(2, las=1)
axis(1)
lines(x = year, y = avgMsr)
points(x = year, y = totMsr , col = "black", pch = 19, type = "o")
lines(x = year, y = totMsr)
box()
par(op)
dev.off()
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] R GUI dies using postcript() in Windows XP Pro

2003-12-18 Thread Gavin Simpson
Dear Andy, Duncan and Brian

Cheers for your replies

That font.main thing is something I didn't pick up on when I cropped my 
colleagues code down to a small example.

font.main works fine with pointsize = 8, *if* you set font.main to one 
of the values given in the entry for font in ?par. The code example I 
posted works if I set font.main to 3 (for italics) for example, which is 
what was produced with font.main = 16 on a windows() device.

And Brian has confirmed that postcript devices have only 5 fonts in R.

Not really a /feature/ though, I'd expect an error message telling me to 
not be so stupid next time... ;-)

Once again, thank you all for your replies.

Gav
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Dynamic Linear Models for Times Series - Implemented?

2003-02-11 Thread Gavin Simpson
Hi,

I was wondering whether a package that can perform dynamic linear models on
times series data was available for R?

Many Thanks,

Gavin Simpson

%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   
26 Bedford Way
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



RE: [R] Dynamic Linear Models for Times Series - Implemented?

2003-02-12 Thread Gavin Simpson
Hi,

Following an off-list reply to my original post, I realised that I hadn't
really provided very much information for you to work with.  So here's a
second attempt:

Following West & Harrison (1989) and Pole et al. (1994) a DLM is defined as:

Y[t] = F'[t]theta[t] + v[t],v[t] ~ N[0,V] #Observation equation
theta[t] = G[t]theta[t-1] + w[t],  w[t] ~ N[0,W] #system equation

The system equation is a first order Markov process, where G[t] is a matrix
of known coefficients that defines the systematic evolution of the state
vector (theta[t]) across time, and w[t] is an unobservable stochastic error
term having a normal distribution with zero mean and covariance matrix.

Y[t] denotes the observation series at time t
F[t] is a vector of known constants (the regression vector)
theta[t] denotes the vector of model state parameters
v[t] is a stochastic error term having zero mean and variance V[t]

If I have understood Brockwell and Davis (1991) correctly, the DLM can be
considered from the point of view of State-space models (although I am
venturing some way out of my statistical depth here, all the papers I have
collected are applied examples and they all refer to dynamic Linear Models,
not State-space models).

It seems that some of this has been done in S (for S-Plus), as I found the
bts package by Harrison and Reed on StatLib
(http://lib.stat.cmu.edu/DOS/S/), 

"SPLUS for Windows functions and datasets for Bayesian forecasting based on
the algorithms in Bayesian Forecasting and Dynamic Linear Models by West and
Harrison"

So I was wondering whether anyone knew of existing R code that could fit
such models?

Many thanks

Gavin Simpson

Refs:
Brockwell and Davis (1991).  Time Series: Theory and Methods.  Springer
Pole, West and Harrison (1994).  Applied Bayesian Forecasting and Time
Series Analysis.  Chapman & Hall/CRC
West and Harrison (1989).  Bayesian Forecasting and Dynamic Models.
Springer

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
On Behalf Of Gavin Simpson
Sent: 11 February 2003 17:49
To: r-help
Subject: [R] Dynamic Linear Models for Times Series - Implemented?


Hi,

I was wondering whether a package that can perform dynamic linear models on
times series data was available for R?

Many Thanks,

Gavin Simpson

%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   
26 Bedford Way
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



[R] getting/storing the name of an object passed to a function

2003-02-19 Thread Gavin Simpson
Hi

I have a couple of functions that work on the object created by another R
command and then print out or summarise the results of this work.

The main function is defined as:

hotelling.t <- function(obj)
{
#internal commands
}

I then have print.hotelling.t() that takes the list returned by hotelling.t
and prints it with some extra significance calculations, formatting, etc.

I want to then use the named object in another calculation in
print.hotelling.t() , that only gets done/printed if you ask for it in the
call to print.hotelling.t()

How do I store the name of the object obj passed to hotelling.t in the
object returned by hotelling.t?

And how do I "paste" the name of that object into a call to another R
function within my print.hotelling.t()?

Perhaps this is not the best way to do things in R?  So any comments would
be most appreciated.

By the way, the object obj is of class lda (Package MASS), if that matters.
Functions appended below.  R 1.6.2 on windows XP.

Many Thanks

Gavin Simpson

Functions:  the commented line in print.hotelling.t (last line) is where I
want to use the name of obj, to replace picea.lda.  The code works if you
known the lda object, I now just want to grab it from the original call to
hotelling.t

hotelling.t <- function(obj)
{
if (is.null(class(obj))) {
stop("You must supply an object of class lda from lda()")
} else {
if (class(obj) != "lda") {
stop("You must supply an object of class lda from lda()")
}
}
group <- as.factor(eval(obj$call[[3]]))
fac.levels <- levels(group)
x <- eval(obj$call[[2]])
x1 <- subset(x, group==fac.levels[1])
x2 <- subset(x, group==fac.levels[2])
s1 <- cov(x1)
s2 <- cov(x2)
cor1 <- cor(x1)
cor2 <- cor(x2)
n1 <- nrow(x1)
n2 <- nrow(x2)
n.vars <- ncol(x)
V <- (1/(n1+n2-2))*(((n1-1)*s1)+((n2-1)*s2))
Vcor <- (1/(n1+n2-2))*(((n1-1)*cor1)+((n2-1)*cor2))
mu1 <- obj$means[1,]
mu2 <- obj$means[2,]
d2 <- mahalanobis(mu1, mu2, V)
d <- sqrt(d2)
t2 <- ((n1*n2)/(n1+n2)) * d2
F.stat <- ((n1 + n2 - ((n.vars)+1)) / ((n1 + n2 - 2) * (n.vars-1))) * t2
tmp <- list(s1 = s1, s2 = s2, V = V, Vcor = Vcor, d2 = d2, d = d, t2 =
t2, F.stat = F.stat, obj.call = obj$call, n.obs = obj$N, n1 = n1, n2 =
n2,
mu1 = mu1, mu2 = mu2)
return(tmp)
}

print.hotelling.t <- function(x, digits = max(3, getOption("digits") - 3),
na.print = "", 
...)
{
## Do the required calculations
df1 <- ncol(x$V)
df2 <- x$n.obs - (df1 + 1)
p.F.stat <- 1 - pf(x$F.stat, df1 = df1, df2 = df2)
inv.mat <- solve(x$V)
means.diff <- x$mu1 - x$mu2
lambda <- inv.mat %*% means.diff
colnames(lambda) <- "lambda"
rownames(lambda) <- colnames(x$V)

## Print the results
cat("\nCall: ", deparse(x$call), "\n\n")
cat("Pooled Variance-Covariance Matrix:", "\n\n")
print.default(x$V, digits = digits)
cat("\n")
cat("Covariance Matrices:", "\n\n")
cat("Group 1:", "\n")
print.default(x$s1, digits = digits)
cat("\n")
cat("Group 2:", "\n")
print.default(x$s2, digits = digits)
cat("\n")
cat("Pooled correlation matrix:", "\n\n")
print.default(x$Vcor, digits = digits)
cat("\n")
cat("Mahanalobis Generalised distance \(d^2\):", x$d2, "\n")
cat("Square root of Mahalanobis Distance:", x$d, "\n")
cat("Hotelling's T^2:", x$t2, "\n")
cat("F-value:", x$F.stat, "on", df1, "and", df2, "degrees of freedom\n")
cat("p-value:", p.F.stat, "\n\n")
cat("Variable means for Group 1:\n")
print.default(x$mu1, digits = digits)
cat("\nVariable means for Group 2:\n")
print.default(x$mu2, digits = digits)
cat("\n")
cat("Coefficients of discriminant function:\n")
print.default(lambda, digits=digits)
cat("\nClassification success:\n")
#print(table(predict(picea.lda)$class, picea[,1],
dnn=c("Actual", "Predicted")))
}

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



RE: [R] getting/storing the name of an object passed to a function

2003-02-19 Thread Gavin Simpson
Dear List,

Thanks to Patrick Burns I have now have the answer to my problem.

getting the name and storing it in a variable is done by:

obj.nam <- deparse(substitute(obj))

getting the object back out using its name is done by:

get(obj.nam)

To actually use the entity that is described by obj.nam I then wrapped get()
in eval().  The final line of code now looks like this:

print(table(predict(get(x$obj.nam))$class, eval(get(x$obj.nam)$call[[3]]),
dnn=c("Actual", "Predicted")))

Which does exactly what I wanted it to.

Many thanks

Gavin Simpson

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
On Behalf Of Gavin Simpson
Sent: 19 February 2003 14:14
To: 'r-help'
Subject: [R] getting/storing the name of an object passed to a function


Hi

I have a couple of functions that work on the object created by another R
command and then print out or summarise the results of this work.

The main function is defined as:

hotelling.t <- function(obj)
{
#internal commands
}

I then have print.hotelling.t() that takes the list returned by hotelling.t
and prints it with some extra significance calculations, formatting, etc.

I want to then use the named object in another calculation in
print.hotelling.t() , that only gets done/printed if you ask for it in the
call to print.hotelling.t()

How do I store the name of the object obj passed to hotelling.t in the
object returned by hotelling.t?

And how do I "paste" the name of that object into a call to another R
function within my print.hotelling.t()?

Perhaps this is not the best way to do things in R?  So any comments would
be most appreciated.

By the way, the object obj is of class lda (Package MASS), if that matters.
Functions appended below.  R 1.6.2 on windows XP.

Many Thanks

Gavin Simpson

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



RE: [R] getting/storing the name of an object passed to a function

2003-02-19 Thread Gavin Simpson
Hi,

As usual Prof. Ripley has delved a little deeper into the question and
pointed out that whilst my functions might be doing/printing what I wanted
them to do, they might not do if the object was updated AFTER using
hotelling.t!  See Prof. Ripley's reply below.

This was something I wasn't even close to considering, so thank you for
pointing this out.  I'll opt for the safe option and pass the bits I
actually require between functions rather than just the name.

All the best,

Gavin

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: 19 February 2003 15:33
To: Gavin Simpson
Cc: 'r-help'
Subject: RE: [R] getting/storing the name of an object passed to a function


Here's a comment I wrote that has not come through yet (and there is an 
engineer working on my mail server so it may be delayed/lost):

Use  objname <- deparse(substitute(obj))

at the top of hotelling.t, and make objname part of the returned list.

Another way is to capture the call by

Call <- match.call()

pass that on and look at it in the print function.

However, if you really want the object and not its name, it is better to
pass the object.  Otherwise I could do

fit.lda <- lda(...)
hT <- hotelling.t(fit.lda)
fit.lda <- update(fit.lda, )
hT

and that would I suspect not be what you want.


More generally, get() is dangerous, and I am pretty sure you don't want to
start the get() search inside your function nor do you want to eval()
there.  There is a real danger of getting the wrong objects.



On Wed, 19 Feb 2003, Gavin Simpson wrote:

> Dear List,
> 
> Thanks to Patrick Burns I have now have the answer to my problem.
> 
> getting the name and storing it in a variable is done by:
> 
> obj.nam <- deparse(substitute(obj))
> 
> getting the object back out using its name is done by:
> 
> get(obj.nam)
> 
> To actually use the entity that is described by obj.nam I then wrapped
get()
> in eval().  The final line of code now looks like this:
> 
> print(table(predict(get(x$obj.nam))$class, eval(get(x$obj.nam)$call[[3]]),
> dnn=c("Actual", "Predicted")))
> 
> Which does exactly what I wanted it to.
> 
> Many thanks
> 
> Gavin Simpson
> 
> -Original Message-
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
> On Behalf Of Gavin Simpson
> Sent: 19 February 2003 14:14
> To: 'r-help'
> Subject: [R] getting/storing the name of an object passed to a function
> 
> 
> Hi
> 
> I have a couple of functions that work on the object created by another R
> command and then print out or summarise the results of this work.
> 
> The main function is defined as:
> 
> hotelling.t <- function(obj)
> {
>   #internal commands
> }
> 
> I then have print.hotelling.t() that takes the list returned by
hotelling.t
> and prints it with some extra significance calculations, formatting, etc.
> 
> I want to then use the named object in another calculation in
> print.hotelling.t() , that only gets done/printed if you ask for it in the
> call to print.hotelling.t()
> 
> How do I store the name of the object obj passed to hotelling.t in the
> object returned by hotelling.t?
> 
> And how do I "paste" the name of that object into a call to another R
> function within my print.hotelling.t()?
> 
> Perhaps this is not the best way to do things in R?  So any comments would
> be most appreciated.
> 
> By the way, the object obj is of class lda (Package MASS), if that
matters.
> Functions appended below.  R 1.6.2 on windows XP.
> 
> Many Thanks
> 
> Gavin Simpson
> 
> __
> [EMAIL PROTECTED] mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
> __
> [EMAIL PROTECTED] mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 

-- 
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
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



RE: [R] ClustPlots part3

2003-02-20 Thread Gavin Simpson
Hi Mark

Does this help?

plot(clara.obj, which.plots = 1)

This was buried a bit in the documentation for cluster.  plot.partition() is
the function used to do the plotting.  See its help page

You need to tell it to do plot 1 or 2 or NULL.  1 gets you a clusplot, 2
gets a silhouette plot, NULL gets both.  In the above command, the
which.plots gets passed though to plot.partition and only produces the one
diagram.

All the best,

Gavin

%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
On Behalf Of Mark Marques
Sent: 20 February 2003 16:36
To: R-help Mailing list.
Subject: [R] ClustPlots part3


I am using the library(cluster), and (mva)
Clustering function clara()

sometihng like this:

cdata <- clara(vdata,6)
plot(cdata)
savePlot(filename="c:\\clara1",type=c("png"),2)

But for my surprise the after the plot I get :

   "Hit  to see next plot:"
if i do something like :
   plot(cdata,3)

I get:
  Make a plot selection (or 0 to exit):
 
  1:plot  All
  2:plot  Clusplot
  3:plot  Silhouette Plot
  Selection:

As   far   I   know  calling  plot  is using clusPlot() by reading the
"clara" object.
How can I avoid that interaction ?

Thanks in advance

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



[R] summary.glm() print problem(?) with cor = TRUE

2003-02-28 Thread Gavin Simpson
Hi,

I've had a look the bug list and searched though the R documentation, email
lists etc. but didn't see anything on this:

when I do:

summary(species.glm1, correlation = TRUE)

I get a correlation matrix like this:

Correlation of Coefficients:
( p I(H C
pH  * 1  
I(pH^2) * B 1
Ca. .   1
I(Ca^2)   . .   B
attr(,"legend")
[1] 0 ` ' 0.3 `.' 0.6 `,' 0.8 `+' 0.9 `*' 0.95 `B' 1

I'm not worried about the symbolic representation, but should the columns be
labelled this way?  I can work out which is which, but it isn't immediately
clear and doesn't look "nice".  Is this printing intended?

Because when I do:

print(summary(species.glm3, correlation = TRUE), symbolic.cor = FALSE)

I get a much more nicely formatted correlation matrix:

Correlation of Coefficients:
(Intercept)  pH I(pH^2)  Ca
pH  -0.9321
I(pH^2)  0.9233 -0.9968
Ca   0.1442 -0.4893  0.4950
I(Ca^2) -0.1619  0.5009 -0.5162 -0.9876

> version
 _  
platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major1  
minor6.2
year 2003   
month01 
day  10 
language R 

Cheers

Gav

%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] show numbers not rounded

2003-02-28 Thread Gavin Simpson
format.pval() as in:

format.pval(1-pf(((RSSred-RSSful)/2)/(RSSful/(34-3)),2,34-3),digits = 5)

see ?format for more information

Gav

%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Christoph Lehmann
Sent: 28 February 2003 13:18
To: [EMAIL PROTECTED]
Subject: [R] show numbers not rounded


how can I show an number not rounded, but in the format, eg. x. 

e.g. 
> signif(1-pf(((RSSred-RSSful)/2)/(RSSful/(34-3)),2,34-3),digits = 5)

shows
[1] 0

but I need something like

[1] 2.2e-16


thanks
christoph
-- 
Christoph LehmannPhone:  ++41 31 930 93 83 
Department of Psychiatric NeurophysiologyMobile: ++41 76 570 28 00
University Hospital of Clinical Psychiatry   Fax:++41 31 930 99 61 
Waldau[EMAIL PROTECTED] 
CH-3000 Bern 60http://www.puk.unibe.ch/cl/pn_ni_cv_cl.html

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] summary.glm() print problem(?) with cor = TRUE

2003-02-28 Thread Gavin Simpson
Dear Martin,

Thanks for explaining this.

One thing that might be considered IMHO could be to replace the named column
heads (or both column and row head if so desired) with a number
corresponding to the position of the term in the printed table.

1 2 3 4
pH  * 1  
I(pH^2) * B 1
Ca. . 1
I(Ca^2)   . . B

or even

1 2 3 4
1   * 1  
2   * B 1
3 . . 1
4 . . B

That keeps the property of square formatting of the table, well almost.
Then a line under the correlation table explaining the 1, 2, 3, etc. as well
and the legend for the symbolic characters.

Also printing the legend attribute as it is presented for the regression
terms (i.e. without attr(,"legend") and [1]) would also improve the look of
the thing.

All the best,

Gavin

%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

-Original Message-
From: Martin Maechler [mailto:[EMAIL PROTECTED] 
Sent: 28 February 2003 14:44
To: gavin.simpson
Cc: 'r-help'
Subject: Re: [R] summary.glm() print problem(?) with cor = TRUE


>>>>> "GS" == Gavin Simpson <[EMAIL PROTECTED]>
>>>>> on Fri, 28 Feb 2003 13:07:55 - writes:

GS> Hi,
GS> I've had a look the bug list and searched though the R
documentation, email
GS> lists etc. but didn't see anything on this:

GS> when I do:

GS> summary(species.glm1, correlation = TRUE)

GS> I get a correlation matrix like this:

GS> Correlation of Coefficients:

GS> ( p I(H C
GS> pH  * 1  
GS> I(pH^2) * B 1
GS> Ca. .   1
GS> I(Ca^2)   . .   B

GS> attr(,"legend")
GS> [1] 0 ` ' 0.3 `.' 0.6 `,' 0.8 `+' 0.9 `*' 0.95 `B' 1

GS> I'm not worried about the symbolic representation, but
GS> should the columns be labelled this way?  I can work out
GS> which is which, but it isn't immediately clear and
GS> doesn't look "nice".  Is this printing intended?

[we are talking about the print method for class "summary.lm",
 i.e. print.summary.glm() , and *.*.lm() ]

Yes, these column labels have been critized before and rightly so.
Currently, for R-devel, the default has even been changed from
 `symbolic.cor = p > 4' to  `symbolic.cor = FALSE' -- mostly
because of this, AFAIR -- and against my own opinion. 
I would have voted to change it to `symbolic.cor = p > 6' or so
(*and* to improve the column labels, too, see below).

As the original implementor I can tell you:
I've liked the idea of graphical correlation matrices which
motivated the "symbolic.cor" option to print.summary.* and the
underlying symnum() function.  
Since this is ASCII graphic, and showing (the lower triangle of)
a square matrix, I've felt the matrix should remain close to
``square'', also in its graphical form. 
Hence, the row labels were kept and the column labels
abbreviated "as much as possible" using R's internal abbreviate().
And this has given the very ugly "(" for "(Intercept)".
One easy possibility was to use more customized version of abbreviate()
either inside symnum() or by postprocessing ..

Given the topic, I'm really interested about your opinions on
the symbolic printing of correlation matrices.


GS> Because when I do:

GS> print(summary(species.glm3, correlation = TRUE), symbolic.cor =
FALSE)

GS> I get a much more nicely formatted correlation matrix:

GS> Correlation of Coefficients:
GS> (Intercept)  pH I(pH^2)  Ca
GS> pH  -0.9321
GS> I(pH^2)  0.9233 -0.9968
GS> Ca   0.1442 -0.4893  0.4950
GS> I(Ca^2) -0.1619  0.5009 -0.5162 -0.9876

It nicer only as long as it stays small, IMHO.
no longer for a 10 x 10 case; look at the examples in
help(symnum) !

Note that you can always say
 sglm <- summary(species.glm3, correlation = TRUE)
 sglm$corr
to see the matrix in its usual form

Martin Maechler <[EMAIL PROTECTED]>
http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16Leonhardstr. 27
ETH (Federal Inst. Technology)  8092 Zurich SWITZERLAND
phone: x-41-1-632-3408  fax: ...-1228   <><

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] How to write the output of a function into a file?

2003-03-26 Thread Gavin Simpson
does sink()

do what you want?

see ?sink for more

> #divert printed results to file
> sink(file = output.txt)
> #commands here
> chisq.test(x,p=probs)
> #turn off sink
> sink(file = NULL)

If you are not typing the commands at the prompt but are using an external
editor or text file for your commands via source() then you need to wrap
chisq.test(x,p=probs) in print() eg:

print(chisq.test(x,p=probs))

Hope this helps

Gavin

%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: 25 March 2003 23:59
To: r-help
Subject: [R] How to write the output of a function into a file?


I cannot find the solutions in the mannual about "import and export of
data".
For example, I run 
>chisq.test(x,p=probs)
chi-squared.

.

How can I write the output into a file? Is there some file operations in R?
Actually, I only want to save the P-value. But I don't know how I can
extract the P-value field only from the output
of chisq.test. So, I think I would better save all the output. I tried
cat/writeThey cannot do this.

Thanks in advance.

[[alternate HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Plot of Canonical Correlation Analysis

2003-03-28 Thread Gavin Simpson
If the original poster actually meant output from cancor() in library(mva)
then I don't think Jari's vegan package will necessarily work "out of the
box" for objects created using cancor().

Quoting the help file on scores() :

Currently the function seems to work at least for `isoMDS', `prcomp',
`princomp', `ca', `pca'.  It may work for other cases, or fail mysteriously.


I've just looked at the code for scores() in vegan (which is used to plot
non-vegan-created ordination results) and it does not know about the values
returned in a cancor object (cor, xcoef, ycoef, xcenter, ycenter etc.).

There has been confusion over the use of three letter acronyms for methods
in community ecology with some people using CCA for canonical correlation
analysis, and others, like Jari and in the limnology/ecology field, using
CCA to mean Canonical Correspondence Analysis.  The two methods are very
different.  (I prefer CCA = Canonical Correspondence Analysis myself - but
that how I learned the method!)

Hope this helps.

Gav

%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Anon.
Sent: 28 March 2003 11:29
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [R] Plot of Canonical Correlation Analysis


[EMAIL PROTECTED] wrote:
> Dear all,
> 
> I didn't find any graphical solution in the package "mva" to plot the
> canonical scores from a CCA (canonical correlation analysis).
> Does anybody knows how to plot or has anybody already programmed :
>   - the map of the canonical scores,
>   - the graph of the canonical weights,
>   - the correlation circle i.e. the canonical loadings ?
> Thank you for help ...
> 
Have a look at Jari Oksanen's vegan package.  It's on CRAN, but it also 
has its own page: <http://cc.oulu.fi/~jarioksa/softhelp/vegan.html>

Bob

-- 
Bob O'Hara

Rolf Nevanlinna Institute
P.O. Box 4 (Yliopistonkatu 5)
FIN-00014 University of Helsinki
Finland
Telephone: +358-9-191 23743
Mobile: +358 50 599 0540
Fax:  +358-9-191 22 779
WWW:  http://www.RNI.Helsinki.FI/~boh/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Multivariate Time series

2003-04-03 Thread Gavin Simpson
Hi Erin,

Paul Gilbert's package bundle is dse.  It is on CRAN under Package Sources.

Gavin

%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Erin Hodgess
Sent: 02 April 2003 21:46
To: [EMAIL PROTECTED]
Subject: [R] Multivariate Time series


Dear R People:

Is there a library for Multivariate time series, please?

For some reason, I'm thinking that Dr. Paul Gilbert may have one?

R Version 1.6.2 (i've updated!) for Windows

Thanks so much!

Sincerely,
Erin Hodgess
University of Houston - Downtown
mailto: [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] ts function

2003-04-04 Thread Gavin Simpson
Hi Martin,

I guess you didn't get to Chapter 9 or the Preface ;-)

Yes, you need some further commands.  Get the files from:

http://www.uea.ac.uk/~gj/tsbook.html

The two commands you are having trouble with are both part of the commands
written by the authors for the book.  These are not packaged nicely in a
package that you can load with library().  Instead, you need to get the
files from the web site and then use source to read them into the working
environment.

Hope it helps,

Gavin

%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Martin Wegmann
Sent: 03 April 2003 12:20
To: R-help
Subject: [R] ts function


hello

I read "Practical Time Series" (Gareth Janacek; 2001) and they presented
e.g the
smoothing functions msmooth(x,k) or the bivariate function
crosscorr(x,y,k),
but both didn't work on my machine.  I only load the ts library, is
another
library necessary or did this function change since 2001? Is there a
more recent and detailed manual for ts?

thanks, cheers Martin


--
Martin Wegmann
Department of Animal Ecology and Tropical Biology
Zoology III, Biocenter
Am Hubland
97074 WĂ¼rzburg
Germany
0931/888-4378
[EMAIL PROTECTED]
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Update VR_7.1-6

2003-06-04 Thread Gavin Simpson
Hi Dirk,

dse and VR are bundles or packages.  There is a bug in rw1070 in the way 
it installs bundles.

Download the zip file directly and unzip it to the library directory in 
wherever R is installed on your system.

This has been discussed recently (this morning) on the list.  Search the 
archives to read more.

G

Dirk Enzmann wrote:
The update of VR by downloading VR_7.1-6.zip and using install.packages
(from local zip files) fails with the following error message:
Error in file(file, "r") : unable to open connection
In addition: Warning message:
cannot open file `VR/DESCRIPTION'
Other packages can be installed without problems, except of dse_2003.4-1
with a similar error message.
Why?

Operating System: Windows NT (4.0)
R Version: R 1.7.0
*
Dr. Dirk Enzmann
Criminological Research Institute of Lower Saxony
Luetzerodestr. 9
D-30161 Hannover
Germany
phone: +49-511-348.36.32
fax:   +49-511-348.36.10
email: [EMAIL PROTECTED]
http://www.kfn.de

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] cook distance

2003-06-05 Thread Gavin Simpson
Michele,

Did you use the search tools in R?

Within R:

> apropos("cooks")
[1] "cooks.distance" "cooks.distance.glm" "cooks.distance.lm"
and a similar search using the html help facility returned a single 
entry for the functions influence.measures() in base, under which the 
above three functions are documented.

HTH

Gav

Michele Grassi wrote:
where is the cook-distance in R? i can't find it!please 
help me!

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] 3d scatter plot

2003-06-05 Thread Gavin Simpson
Michele

get the scatterplot3d package by Uwe Ligges off CRAN:

scatterplot3d: 3D Scatter Plot

Plots a three dimensional (3D) point cloud.
Version:0.3-13
Depends:R (>= 1.1.0)
Date:   2003-01-16
etc...
Gav

Michele Grassi wrote:
how can i draw a 3d scatter plot? thank you.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Warning message in scatter.smooth (modreg)

2003-07-01 Thread Gavin Simpson
Dear list,

In using the scatter.smooth() function (modreg) on a small data set (100 
obs) the following error was produced:

> scatter.smooth(Na, S)
Warning message:
k-d tree limited by memory. ncmax= 200
I haven't used scatter.smooth much but when I have, I haven't seen this 
message before.

gc() returns

> gc()
 used (Mb) gc trigger (Mb)
Ncells 417693 11.2 667722 17.9
Vcells 103949  0.8 786432  6.0
This is on a Win XP box with 512 MB RAM, with plenty of space still 
available (Task Manager Reports 216 MB of RAM and pagefile in use).

I have looked through the help files for loess and loess.control but 
didn't see anything about ncmax.  Can someone explain why I might be 
getting this warning?

Many thanks,

Gavin

> version
 _
platform i386-pc-mingw32
arch i386
os   mingw32
system   i386, mingw32
status
major1
minor7.1
year 2003
month06
day  16
language R
I can send the data if required.
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] strange error message

2003-07-01 Thread Gavin Simpson
Michael

1) Those are not errors, but warnings.  You need to use warnings() (with 
the brackets) to see what they were.  By typing warnings (without the 
brackets) you are asking R to print out the source code for the 
warnings() function.

2) try ?options and see option digits in that help file

Hope that helps a bit,

Gavin

Michael Rennie wrote:
Hi, there

I have a loop that is producing data, but is also generating an error message 
that I can't understand.

Here's the loop and the error message:


bio<-matrix(NA, ncol=9, nrow=366)
W<-NULL
M<- length(Day) #number of days iterated
for (i in 1:M)
+ {
+ 
+ 
+ if (Day[i]==1) W[i] <- Wo else W[i] <- (W[i-1]+(Gr[i]/Ef))
+ 
+ 
+ C<- p*CA*(W^CB)*(((comp[,3])^Xc)*(exp(Xc*(1-(comp[,3])*Pc
+ 
+ ASMR<- ACT*RA*(W^RB)*(((comp[,4])^Xa)*(exp(Xa*(1-(comp[,4])
+ 
+ SMR<- (ASMR/ACT)
+ 
+ A<- (ASMR-SMR)
+ 
+ F<- (FA*((comp[,2])^FB)*(exp(FG*p))*C)
+ 
+ U<- (UA*((comp[,2])^UB)*(exp(UG*p))*(C-F))
+ 
+ SDA<- (S*(C-F))
+ 
+ Gr<- (C-(ASMR+F+U+SDA))
+ 
+ bio<- cbind(W, C, ASMR, SMR, A, F, U, SDA, Gr)
+ 
+ }
There were 50 or more warnings (use warnings() to see the first 50)

warnings
function (...) 
{
if (!(n <- length(last.warning))) 
return()
names <- names(last.warning)
cat("Warning message", if (n > 1) 
"s", ":\n", sep = "")
for (i in 1:n) {
out <- if (n == 1) 
names[i]
else paste(i, ": ", names[i], sep = "")
if (length(last.warning[[i]])) {
temp <- deparse(last.warning[[i]])
out <- paste(out, "in:", temp[1], if (length(temp) > 
1) 
" ...")
}
cat(out, ..., fill = TRUE)
}
}

dimnames (bio) <-list(NULL, c
("W", "C", "ASMR", "SMR", "A", "F", "U", "SDA", "Gr"))

bio
   WC ASMR   SMR AF U
  [1,]  9.20 233.6647 107.5640  64.50050  43.06345 31.93755 15.840142
Also, does anyone know why I might be getting differences in the same 
calculation between R and Excel?  Is there any way to keep R from rounding your 
numbers, or to specify the # of decimal places you want for an element? 


--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Characters and Numeric Values in One Matrix

2003-07-08 Thread Gavin Simpson
Hi Roland,

Try the following

> names <- c("Marge", "Lisa", "Homer", "Bart", "Maggie")
> ages <- c(38,10,41,8,1)
> simpsons <- data.frame(I(names), ages)
> simpsons
   names ages
1  Marge   38
2   Lisa   10
3  Homer   41
4   Bart8
5 Maggie1
> str(simpsons)
`data.frame':   5 obs. of  2 variables:
 $ names:Class 'AsIs'  chr [1:5] "Marge" "Lisa" "Homer" "Bart" ...
 $ ages : num  38 10 41 8 1
Note the use of I() to protect names from the implicit conversion from 
character to factor that data.frame() does.

See ?data.frame for more.

HTH

Gav

Rau, Roland wrote:

Dear R-Users,

I want to ask a question for a colleague of mine. He wants to put a
character vector and a numeric vector into one matrix and still have the old
character and numeric type for the respective columns.
Unfortunately, I am just starting using R and I could not help him.
Is there an easy and straightforward way to do this in R?

Maybe a little example facilitates understanding our problem:
names <- c("Marge", "Lisa", "Homer", "Bart", "Maggie")
ages <- c(38,10,41,8,1)
Now he wants to have 2 columns in a matrix which should look like this:
"Marge" 38
"Lisa"  10
"Homer" 41
"Bart"   8
"Maggie" 1
I thought about using either:
family1 <- matrix(c(names, ages), ncol=2, byrow=FALSE)
or
family2 <- data.frame(names,ages)
but this simply transformed either the numeric into character values
(family1) or the character values into factor levels (family2)
Anyone here who can give us some advice on this?
We are using R 1.7.0 on Windows NT.

Thanks,
Roland
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] How to plot a scatter-plot matrix?

2003-07-11 Thread Gavin Simpson
Fred,

[from help on pairs() ]:

...
Arguments:
   x: the coordinates of points given as columns of a matrix.

So yes, pairs will do what you ask.  See ?pairs for more info.

Also you might consider the alternative function from the lattice package:

> library(lattice)   #load lattice graphics package
> ?splom #help for splom()
Which is called differently using a formula interface.

HTH

G

Feng Zhang wrote:

Hey, R-listers

I am going to plot a scatter-plot matrix using R.
For example, give a matrix X=[x1, x2, ..., xn]
where each xi is a column vector, how to plot
all the pair scatter-plots between two different
xi and xj?
Is PAIRS able to achieve this function?

Thanks for your help.

Fred

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Boosting,bagging and bumping. Questions about R tools and predictions.

2003-07-23 Thread Gavin Simpson
Take a look at the randomForest package on CRAN:

randomForest: Breiman's random forest for classification and regression

Classification and regression based on a forest of trees using random 
inputs.
Version:	3.9-6
Depends:	R (>= 1.7.0)
Author:		Fortran original by Leo Breiman and Adele Cutler, R port 		by 
Andy Liaw and Matthew Wiener.
Maintainer:	Andy Liaw <[EMAIL PROTECTED]>

which has a predict function

HTH

Gav

monkeychump wrote:

I'm interested in further understanding the differences in using many
classification trees to improve classification rates. I'm also interested
in finding out what I can do in R and which methods will allow prediction.
Can anybody point me to a citation or discussion?
Specifically, I want to classify remotely sensed imagery where training
data is extracted on class membership by the user. That training data
(usually spectral bands and categorical data - e.g., soil type) is classified
(using rpart for instance) and then the resulting tree is applied to
the entire image. This results in a classified image that can then be
checked for accuracy. Classification trees are increasingly used by the
remote sensing folks but it seems like finding optimal trees is an active
area of research in computational statistics.
I've seen great claims made by baggers and boosters (and just what is
bumping?) of increasing classification accuracy but aside from TreeNet
by Salford Systems I'm not aware of tools that can grow forests of trees
that can then be used to make predictions.
Can anybody help?









Promote security and make money with the Hushmail Affiliate Program:

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] distance in the function kmeans

2004-05-28 Thread Gavin Simpson
Thomas Petzoldt wrote:
n.bouget wrote:
Hi,
I want to know which distance is using in the function kmeans
and if we can change this distance. Indeed, in the function pam, we 
can put a distance matrix in
parameter (by the line "pam<-pam(dist(matrixdata),k=7)" ) but
we can't do it in the function kmeans, we have to put the
matrix of data directly ...
Thanks in advance,
Nicolas BOUGET

One solution is to transform the data in a way, that the euclidean 
distance of the transformed values represents some other distance of the 
original values. This works at least for the Mahalanobis-Distance, when 
one applies a multivariate technique to a PCA transformed and re-scaled 
matrix, but I don't know if there are transformations for some other 
distance measures.

Thomas P.
Other solutions from an ecological paper are:
Chord distance
Chi square metric
Chi square distance
Hellinger Distance
Distance between species profiles
All these can be seen as Euclidean distances of some transformation of 
the data.

The paper "Ecologically meaningful transformations for ordination of 
species data" Pierre Legendre, and Eugene D. Gallagher (2001) Oecologia 
Vol. 129, Issue 2, 271-280, explains the concept and how to do the 
transformations.

An R example is given in the help file of decostand() in Jari Oksanen's 
vegan library for two of the transformations mentioned above.

Gav
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] distance in the function kmeans

2004-05-28 Thread Gavin Simpson
Gavin Simpson wrote:
...
An R example is given in the help file of decostand() in Jari Oksanen's 
vegan library for two of the transformations mentioned above.
^^^
Pre-empting the usual response about proper terminology, I of course 
meant package not library.

Gav
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] error during make of R-patched on Fedora core 2

2004-06-07 Thread Gavin Simpson
Dear list,
I've just upgraded to Fedora Core 2 and seeing as there wasn't an rpm 
for this OS on CRAN yet I thought it was about time I had a go at 
compiling R myself. Having run into the X11 problem I switched to trying 
to install R-patched. I followed the instructions in the R Installation 
& Admin manual to download the sources of the Recommended packages and 
place the files in R_HOME/src/library/Recommended. ./configure worked 
fine so I progressed to make, which has hit upon this error when the 
process arrived at the Recommended packages:

make[2]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
make[2]: Entering directory `/home/gavin/tmp/R-patched/src/library'
building/updating vignettes for package 'grid' ...
make[2]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
make[2]: Entering directory `/home/gavin/tmp/R-patched/src/library'
make[2]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
make[1]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
make[1]: Entering directory 
`/home/gavin/tmp/R-patched/src/library/Recommended'
make[2]: Entering directory 
`/home/gavin/tmp/R-patched/src/library/Recommended'
make[2]: Leaving directory 
`/home/gavin/tmp/R-patched/src/library/Recommended'
make[2]: Entering directory 
`/home/gavin/tmp/R-patched/src/library/Recommended'
make[2]: *** No rule to make target `survival.ts', needed by 
`stamp-recommended'.  Stop.
make[2]: Leaving directory 
`/home/gavin/tmp/R-patched/src/library/Recommended'
make[1]: *** [recommended-packages] Error 2
make[1]: Leaving directory 
`/home/gavin/tmp/R-patched/src/library/Recommended'
make: *** [stamp-recommended] Error 2

Being a relative newbie to Linux I have no-idea how to continue to solve 
this issue :-(

The only difference I can see between the /src/library/Recommended 
directories of R-1.9.0 and R-patched is that in R-1.9.0 it contains 
links to each of the tar.gz (excluding the version info) as well as the 
tar.gz themselves for each of the packages. Is this in some way related 
to my problem?

If anyone can help me solve this issue I'd be most grateful.
Thanks in advance,
Gavin
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] error during make of R-patched on Fedora core 2

2004-06-07 Thread Gavin Simpson
Roger Bivand wrote:
This feels like:
"After downloading the R sources you should also download the recommended 
packages by entering the R source tree and running

tools/rsync-recommended
from a shell command line."
from the R Sources page on CRAN - could you try that (I guess rsync is 
installed on most Linux standard distributions)?

On Mon, 7 Jun 2004, Gavin Simpson wrote:

Thanks Roger and Marc, for suggesting I use ./tools/rsync-recommended 
from within the R-patched directory.

This seems to have done the trick as make completed without errors this 
time round. The Recommended directory also contained the links to the 
actual tar.gz files after doing the rsync command, so I guess this was 
the problem (or at least related to it.) I'm off home now with the 
laptop to see if I can finish make check-all and make install R.

I have re-read the section describing the installation process for 
R-patched or R-devel in the R Installation and Administration manual 
(from R.1.9.0) just in case I missed something. Section 1.2 of this 
manual indicates that one can proceed *either* by downloading R-patched 
and then the Recommended packages from CRAN and placing the tar.gz files 
in R_HOME/src/library/Recommended, or by using rsync to download 
R-patched, and then to get the Recommended packages. The two are quite 
separately documented in the manual, and do seem to be in disagreement 
with the R-sources page on the CRAN website, which doesn't mention the 
manual download method (for Recommended) at all.

Is there something wrong with the current Recommended files on CRAN, or 
is the section in the R Installation & Admin manual out-of-date or in 
error, or am I missing something vital here? This isn't a complaint: I'm 
just pointing this out in case this is something that needs updating in 
the documentation.

All the best,
Gavin
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] error during make of R-patched on Fedora core 2

2004-06-08 Thread Gavin Simpson
Marc Schwartz wrote:
On Mon, 2004-06-07 at 15:51, Gavin Simpson wrote:
snip

Thanks Roger and Marc, for suggesting I use ./tools/rsync-recommended 
from within the R-patched directory.

This seems to have done the trick as make completed without errors this 
time round. The Recommended directory also contained the links to the 
actual tar.gz files after doing the rsync command, so I guess this was 
the problem (or at least related to it.) I'm off home now with the 
laptop to see if I can finish make check-all and make install R.

I have re-read the section describing the installation process for 
R-patched or R-devel in the R Installation and Administration manual 
(from R.1.9.0) just in case I missed something. Section 1.2 of this 
manual indicates that one can proceed *either* by downloading R-patched 
and then the Recommended packages from CRAN and placing the tar.gz files 
in R_HOME/src/library/Recommended, or by using rsync to download 
R-patched, and then to get the Recommended packages. The two are quite 
separately documented in the manual, and do seem to be in disagreement 
with the R-sources page on the CRAN website, which doesn't mention the 
manual download method (for Recommended) at all.

Is there something wrong with the current Recommended files on CRAN, or 
is the section in the R Installation & Admin manual out-of-date or in 
error, or am I missing something vital here? This isn't a complaint: I'm 
just pointing this out in case this is something that needs updating in 
the documentation.

All the best,
Gavin

Perhaps I am being dense, but in reviewing the two documents (R Admin
and the CRAN sources page), I think that the only thing lacking is a
description on the CRAN page of the manual download option for the Rec
packages.
You would need to go here now for 1.9.1 Alpha/Beta which is where the
current r-patched is:
http://www.cran.mirrors.pair.com/src/contrib/1.9.1/Recommended/
The standard links on CRAN are for the current 'released' version, which
is still 1.9.0 for the moment.
Yes, but having downloaded the contents of that directory (as VERSION 
indicated that R-patched was 1.9.1 alpha), the links to the source files 
for the Recommended packages or not present (obviously). And make 
doesn't seem to work without these links. The rsync approach places the 
package sources *and* the links in the correct directory.

So the instructions in the Admin manual are lacking a statement that you 
need to create links to each of the package sources in the following 
form name-of-package.tgz which links to name-of-package_version.tar.gz. 
As it stands, the instructions in the Installation & Admin manual are 
not sufficient to get the manual download method to work.

Procedurally, I think that the rsync approach is substantially easier
(one step instead of multiple downloads) and certainly less error prone.
Also the ./tools/rsync-recommended script is set up to pick up the
proper package versions, which also helps to avoid conflicts.
I agree - being a bit of a Linux newbie, I hadn't used rsync before. 
Seeing how easy it was to use this method of getting the required 
sources I will be using this method in future.

HTH,
Marc
Cheers
Gavin
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Computting statistics on a matrix with 2 factor column

2004-06-08 Thread Gavin Simpson
Marc Mamin wrote:
Hello,
I suppose this is a basic question but couldn't find a solution.:
I have a large matrix with let say 3 columns:
V1  V2  V3
a   x   2
a   x   4
a   y   8
b   z   16
and I want to compute some statistics based on 
the levels resulting form the combination of the two first columns

e.g.:
SUM->
V1  V2  V3
a   x   6
a   y   8
b   z   16
Thanks for your hints .
Marc
?tapply and ?aggregate are two ways, with aggregate giving you something 
that more closely resembles what you asked for:

> a <- factor(c("a","a","a","b"))
> b <- factor(c("x","x","y","x"))
> c <- c(2,4,8,16)
> abc <- data.frame(a, b, c)
> abc
  a b  c
1 a x  2
2 a x  4
3 a y  8
4 b x 16
> tapply(abc$c, list(abc$a, abc$b), sum)
   x  y
a  6  8
b 16 NA
> aggregate(abc$c, list(abc$a, abc$b), sum)
  Group.1 Group.2  x
1   a   x  6
2   b   x 16
3   a   y  8
HTH
Gavin
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Sweave and multiple graphs

2004-06-11 Thread Gavin Simpson
Dear list,
I am using Sweave to build a small report. I want to produce a series of 
figures, each figure containing a number of plots and then have them 
included in the Sweave file.

An example would be to :
postscript(file = "ANCbwplot%03d.eps", onefile = FALSE, other options...)
oldpar <- par(mfrow = c(2,2))

do lots of plots to produce a number of eps files

par(oldpar)
dev.off()
The example in the Sweave FAQ shows how to do something similar for 
cases where you know how many figures there are, but I do not know how 
many figures will be produced so want to produce a more generic solution.

I thought of doing the above code in Sweave, and because I named the 
plots in a unique way, I now want to read all the files in the current 
directory that match "ANCbwplot001.eps" or "ANCbwplot002.eps" or 
"ANCbwplot003.eps" an so on. If I have this as a vector in R, then I can 
loop over this vector and do something like:

<>=
file.vec <- all files in directory that match name
for(i in seq(along=file.vec))
{
  cat("\\includegraphics{", file.vec[i], "}\n\n", sep"")
}
@
in Sweave.
I'm not sure about getting a list of file names from the current working 
directory that match a given string that I can then loop over and print 
out using cat as shown above. If anyone has any suggestions as to how to 
go about doing this that they are willing to share I would be most grateful.

Thanks in advance,
Gavin
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Sweave and multiple graphs

2004-06-11 Thread Gavin Simpson
[EMAIL PROTECTED] wrote:
Use list.files(). It has a path argument (to specify the directory)
and a pattern argument to put the regular expression.
mygraphs <- list.files(path="./mygraphs", pattern="^ANCbwplot.*\\.eps")
See ?list.files and maybe ?regex
HTH,
Tobias
Hi Tobias.
Thanks for the reply. I just found list.files() but was struggling with 
specifying the pattern argument. I have this working very well now for 
my application like so in a Sweave file:

<>=
postscript(file = "ANCbwplot%03d.eps", onefile = FALSE,
   paper = "special", width = 4, height = 6,
   horizontal = FALSE)
oldpar <- par(mfrow = c(4,3))
for (i in seq(along = g1865.w.res99))
  {
multplot(g1865.w.res99[[i]], m.title = names(g1865.w.res99[i]))
  }
par(oldpar)
invisible(dev.off())
graphs <- list.files(pattern = "^ANCbwplot.*\\.eps")
for (i in seq(along = graphs))
  {
cat("\\includegraphics{", graphs[i], "}\n\n", sep = "")
  }
@
multplot() is just a helper function that extracts the relevant 
information from the list g1865.w.res99 and plots a boxplot

Many thanks for your help,
Gavin
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to determine the number of dominant eigenvalues in PCA

2004-06-28 Thread Gavin Simpson
Fred wrote:
Dear All,
I want to know if there is some easy and reliable way to estimate the
number of dominant eigenvalues when applying PCA on sample covariance
matrix.
Assume x-axis is the number of eigenvalues (1, 2, ,n), and y-axis
is the corresponding eigenvalues (a1,a2,..., an) arranged in
desceding order. So this x-y plot will be a decreasing curve. Someone
mentioned using the elbow (knee) method to find the point that the
maximal curvature of this curve occurs. The number at this point
would be the number of dominant eigenvalues.
But I could not find any reference papers on this idea. Does anyone
has tried this method or knows more details on this?
Thanks for your point.
Fred
Try this reference from the field of ecology:
@Article{571,
  Author = {D. A. Jackson},
  Title  = {Stopping rules in principal components analysis: a
   comparison of heuristic and statistical approaches},
  Journal= {Ecology},
  Volume = {74},
  Number = {8},
  Pages  = {2204--2214},
  month  = {},
  year   = 1993
}
Gav
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] density(x)

2004-07-05 Thread Gavin Simpson
Christoph Hanck wrote:
Hello and thanks for your reply
Hopefully, my answer arrives at the correct place like that (if not,
I am sorry for bothering you, but please let me know...)
To sum up my procedure (sp is exactly the same thing as spr, I had
just tinkered with the names while trying sth. to solve this problem)
sp<-read.table("c:/ratsdata/sp3.txt", col.names="sp") 
xd<-density(sp)
Error in density(sp) : argument must be numeric
The suggested remedies yield the following
str(sp)
`data.frame':   195 obs. of  1 variable: $ sp: int  11 10 10 12 25 22
12 23 13 15 ...
xd<-density(as.numeric(sp))
Error in as.double.default(sp) : (list) object cannot be coerced to
double
It is telling you that it cannot convert a list into a numeric object. A 
data frame is a list so it is telling you that you cannot convert the 
data frame into a numeric vector.

Hence, it does not seem to be a factor. Declaring it as numeric gives
another error message, on which I haven't yet found any help in
Google/the archive.
You want the sp column of the data frame sp not the data frame sp itself 
(perhaps you should choose a name for the data frame that is different 
to a column name)

> sp <- data.frame(sp = rnorm(100))
> density(sp)
Error in density(sp) : argument must be numeric
> density(sp$sp)
Call:
density(x = sp$sp)
Data: sp$sp (100 obs.); Bandwidth 'bw' = 0.3007
   x  y
 Min.   :-3.37457   Min.   :0.0001983
 1st Qu.:-1.73138   1st Qu.:0.0389884
 Median :-0.08819   Median :0.1157180
 Mean   :-0.08819   Mean   :0.1519886
 3rd Qu.: 1.55500   3rd Qu.:0.2227940
 Max.   : 3.19818   Max.   :0.4766640
Does this help?
with(sp, density(sp)) would also do what you want, see ?with, and there 
are other ways.

Gavin
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] biplot & identify

2004-07-23 Thread Gavin Simpson
Wolski wrote:
Hi!
Is there a way to get biplot and identify to work togheter.
Having the output of prcomp I would like to draw a biplot that. 
Instead of plotting the sample (row-names) names plots some "pch"
symbols. (thats easy with xlabs)

But now I would like to add using identify the names to only some of
the points. I have noticed that both biplot.prcomp and biplot.default
does a lot of scaling.
So has anyone a function like identify.prcomp please?
Is it possible?
Yes, take a look at Jari Oksanen's vegan package
http://cc.oulu.fi/~jarioksa/softhelp/vegan.html and on CRAN.
The ordiplot function can be used to plot ordination diagrams including
those from prcomp. There is an identify method for ordiplot that allows
you to label points - you need to store the ordiplot object before using
identify, e.g.:
exmp.pc <- prcomp(some.data)
exmp.ord <- ordiplot(exmp.pc)
identify(exemp.ord, what = "sites")
see ?ordiplot and the example which includes the use of identify.
Sincerely Eryk
HTH
Gav
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to put multiple plots in the same window? (not par(mfrow=))

2004-07-30 Thread Gavin Simpson
F Duan wrote:
Dear All,
I am sorry if this question has been asked before. Below is my Question:
I want to put several plots in the same window, but I don’t want the blank 
space between plots (like par(mfrow=)) --- that makes the plots too small. 
Could anyone tell me how to do it?

Thanks a lot.
Frank
?split.screen
?layout
are alternatives to par(mfrow = c()), but I think you need to look at 
the margins of the plots and reduce them to suit your purposes. See ?par 
and argument mar. For example:

oldpar <- par(mfrow = c(2,2), mar = c(3,3,1,1) + 0.1)
plot(1:10)
plot(1:10)
plot(1:10)
plot(1:10)
par(oldpar)
# or
layout(matrix(c(1,2,3,4), 2, 2, byrow = TRUE))
layout.show(4)
oldpar <- par(mar=c(3,3,1,1) + 0.1)
plot(1:10)
plot(1:10)
plot(1:10)
plot(1:10)
par(oldpar)
There is no room for labels/titles but adjust the mar to suit your 
requirements.

Gav
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to add a common title (or xlab, ylab) for multi-plots in the same window?

2004-08-02 Thread Gavin Simpson
F Duan wrote:
Dear R people,
I am using par(mfrow=c()) to plot multi-figures in the same window. And I like 
to put a common title (and xlab, ylab) for all of plots. I have already left 
some margin by resetting omi values in par() and hided all (xlab, ylab) for 
each sub-plot. Could anyone tell me how to do that?

Thanks a lot,
Frank
see ?title
argument outer is used to place titles in the outer margin.
HTH
Gavin
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] plot(my.procrustes.model) from library {vegan}

2004-02-23 Thread Gavin Simpson
Federico Calboli wrote:
Dear All,

I would like to ask how to customize the graph corresponding to a
procrustes analysis.


The object returned by procrustes() contains Yrot and X, the rotated 
matrix and the target matrix respectively. You could plot both of these 
using standard plotting tools. You'll need to make the axes have the 
same scale.

plot(mod.pro$Yrot, asp = 1)
points(mod.pro$X, col = "red", pch = 16)
Which seems to get you a similar plot to the one plot(mod.pro) produces.

Regards,

Federico Calboli 
HTH

Gavin

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


Re: [R] Values in horizontal versus vertical position on 'y' axe

2007-08-13 Thread Gavin Simpson
On Mon, 2007-08-13 at 13:37 +0200, akki wrote:
> hi,
> When I do a graph. the values on y axe are vertical position. How can I put
> the values in horizontal position?
> 
> thanks

If you mean "How do I rotate the tick labels?" then look at ?par and
parameter 'las'. E.g. this shows the options available:

opar <- par(mfrow = c(2,2))
plot(1:10, main = expression(las == 0)) ## las = 0, default
plot(1:10, las = 1, main = expression(las == 1))
plot(1:10, las = 2, main = expression(las == 2))
plot(1:10, las = 3, main = expression(las == 3))
par(opar)

If not, try rephrasing your question, and provide an example of what you
can plot at the moment and what is wrong with it that you'd like to
change.

HTH

G

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

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


Re: [R] RFclustering - is it available in R?

2007-08-15 Thread Gavin Simpson
On Wed, 2007-08-15 at 09:44 -0700, David Katz wrote:
> Several searches turned up nothing. Perhaps I will try to implement it if
> nobody else has. Thanks.

You can do this with Andy Liaw's randomForest package can do this and
the first hit on a Google search (on term "RFclustering") was this:

http://www.genetics.ucla.edu/labs/horvath/RFclustering/RFclustering.htm

which shows how one might go about this with some helper functions.

G

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

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


Re: [R] Question about unicode characters in tcltk

2007-08-18 Thread Gavin Simpson
On Sat, 2007-08-18 at 14:40 +0200, Peter Dalgaard wrote:
> R Help wrote:
> > hello list,
> >
> > Can someone help me figure out why the following code doesn't work?
> > I'm trying to but both Greek letters and subscripts into a tcltk menu.
> >  The code creates all the mu's, and the 1 and 2 subscripts, but it
> > won't create the 0.  Is there a certain set of characters that R won't
> > recognize the unicode for?  Or am I input the \u2080 incorrectly?
> >
> > library(tcltk)
> > m <-tktoplevel()
> > frame1 <- tkframe(m)
> > frame2 <- tkframe(m)
> > frame3 <- tkframe(m)
> > entry1 <- tkentry(frame1,width=5,bg='white')
> > entry2 <- tkentry(frame2,width=5,bg='white')
> > entry3 <- tkentry(frame3,width=5,bg='white')
> >
> > tkpack(tklabel(frame1,text='\u03bc\u2080'),side='left')
> > tkpack(tklabel(frame2,text='\u03bc\u2081'),side='left')
> > tkpack(tklabel(frame3,text='\u03bc\u2082'),side='left')
> >
> > tkpack(frame1,entry1,side='top')
> > tkpack(frame2,entry2,side='top')
> > tkpack(frame3,entry3,side='top')
> >
> > thanks
> > -- Sam
> >
> >   
> Which OS was this? I can reproduce the issue on SuSE, but NOT Fedora 7.

I can reproduce this on Fedora 7 in that the \u2080 is reproduced as is
and not as a subscript, unlike the other \u which appear as
subscripted characters,

> sessionInfo()
R version 2.5.1 Patched (2007-08-02 r42389) 
i686-pc-linux-gnu 

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

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

If there is something specific to my Fedora installation that is
different to Peter's that I can ascertain from installed packages/fonts
etc, then let me know and I can provide the output from my laptop.

G

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

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


Re: [R] R GUI for Linux?

2005-05-31 Thread Gavin Simpson

White, Charles E WRAIR-Wash DC wrote:

John:

Thank you for your interest. After more investigation I see that my
problem is with linking tcltk to R. tcl 8.4.7-2 and tk 8.4.7-2 are
tuned to fc3 (Fedora Core 3) and part of the standard installation.
However, required file locations are different than what is expected
by R. I set the locations for tclConfig.sh and tkConfig.sh using
./configure but R tells me something to the effect that Tcl and Tk
major or minor versions disagree. Your help or the help of others on
the R-List would be appreciated. FYI, I am also including the
locations of important files and directories.

tclConfig.sh: /usr/lib tkConfig.sh:  /usr/lib tcl library:
/usr/lib/tcl8.4 (symbolically linked from /usr/share/tcl8.4) tk
library:   /usr/lib/tk8.4 (separate copy in /usr/share/tk8.4) tcl.h:
I can't find it with full drive search tk.h: I can't find it
with full drive search


You need to install the devel packages for tcl and tk to get those 
header files.


on FC3, the preferred updater is yum so in a terminal:

su -c "yum install tcl-devel tk-devel"

Should install the *.h files for you.

HTH

Gav

__
R-help@stat.math.ethz.ch 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 GUI for Linux?

2005-05-31 Thread Gavin Simpson

White, Charles E WRAIR-Wash DC wrote:

Thanks for the tip. I thought that 'Base' files were installed already
but I know better now. Unfortunately, I'm still not up and running yet.
Since I don't have access to the subject machine at the moment, I'll be
even more vague than usual.


Base refers to the repository in which the packages reside. Unless you 
did a Full/Complete installation of FC3 from the CD's/DVD then you will 
*not* have all of Base installed.



I installed the development versions of tcltk and specified the
locations for the *.sh files, the *.h files, and both of the individual
directories in /usr/lib. Based on my reading of one of the *.sh files,
it looks like I can specify multiple directories for a configuration
variable by putting them in quotes and leaving a space in between like
'path1 path2'. My reward was that ./configure didn't complain about
searching for any tcltk files and I got the clear message that R
couldn't compile/link to tcltk. Hmph. 

Next steps when I get home tonight:
(a) Replace library locations in /usr/lib with those in /usr/share
(b) Include all four library locations
(c) Wait until Fedora Core 4 comes out in a couple of weeks, wipe my
drive, and start all over again.

Any other suggestions? Thanks again.

Chuck


How are you specifying the locations of the *.sh and *.h files?

I've done very little to my FC boxes and as long as tcl tk, tcl-devel 
and tk-devel packages are installed, ./configure picks up the locations 
just fine. You shouldn't have to do anything. Perhaps undo you what did 
after installing the tcl/tk and devel packages and try it again as this 
most definitely works for me (almost) out of the box.


If that doesn't work, wait till you get back to your 'subject' machine 
and post back exactly what messages you are receiving that indicate R 
couldn't compile/link to tcl/tk


G

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] Increasing Console "Paste Buffer"

2005-05-31 Thread Gavin Simpson

Manuel Morales wrote:

Hello list.

I'm using R from the gnome-terminal in Fedora. My preference is to write
programs in VIM, and then source the file from R, or copy and paste the
lines into the console. I'm wondering if there is a way to increase the
"paste buffer" as an alternative to "sourcing" large analyses. As was
mentioned in a recent thread on Linux GUI's, I find that if I paste in a
large amount of text, the lines end up getting cut off at some point. I
wonder if this is an R restriction, because it seems like I am able to
paste substantially more text in other console-based programs. Is there
any way to increase the amount of text that I can paste into an R
session?

Thanks!

Manuel



Manuel,

Maybe I misunderstand what you mean by "lines end up getting cut off at 
some point" so correct me if I got it wrong, but I assume you mean that 
after a certain number of lines entered you can no longer scroll back up 
and view the earlier lines?


If this is the case, then, and again I assume you are using Gnome 
(default in FC) as the desktop system, then open a terminal. The  Edit > 
Current Profile in the menu bar for the terminal. Select the Scrolling 
Tab. Alter Scrollback lines and kilobytes accordingly to suit. You only 
need to do one, not both - I find it easier to think  in numbers of 
lines so I changed that. You'll have to modify this if you use KDE or 
another window manager with FC3.


HTH

Gavin

__
R-help@stat.math.ethz.ch 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] Increasing Console "Paste Buffer"

2005-06-01 Thread Gavin Simpson

Jan T. Kim wrote:

On Tue, May 31, 2005 at 11:47:05PM +0100, Gavin Simpson wrote:


Manuel Morales wrote:


Hello list.

I'm using R from the gnome-terminal in Fedora. My preference is to write
programs in VIM, and then source the file from R, or copy and paste the
lines into the console. I'm wondering if there is a way to increase the
"paste buffer" as an alternative to "sourcing" large analyses. As was
mentioned in a recent thread on Linux GUI's, I find that if I paste in a
large amount of text, the lines end up getting cut off at some point. I
wonder if this is an R restriction, because it seems like I am able to
paste substantially more text in other console-based programs. Is there
any way to increase the amount of text that I can paste into an R
session?

Thanks!

Manuel



Manuel,

Maybe I misunderstand what you mean by "lines end up getting cut off at 
some point" so correct me if I got it wrong, but I assume you mean that 
after a certain number of lines entered you can no longer scroll back up 
and view the earlier lines?



I think that this is not an issue of the scroll buffer, but of buffers
internal to the terminal program or the shell, which are designed to hold
keyboard input and which can be overwhelmed by the rate of input when
large text selections are pasted in, as this appears as though thousands
of keys had been typed almost instantaneously from their view, so to speak.


I did say I was guessing :-)



For these reasons, I generally strongly recommend against pasting into
terminals.


Thanks for this Jan. I haven't noticed this myself but then again I hate 
copy/paste and rarely use R outside emacs/ess these days.



In R, use the source() instead...  ;-)


Agreed. source("filename", echo = TRUE) will sort of replicate the 
behaviour the original poster would get if they like to see the commands 
printed among the results. But if he is pasting in that much data, 
Manuel will still have to increase the buffer on the terminal, 
especially if he is using one of the defaults in FC3 as the output will 
quickly get lost.



Best regards, Jan


All the best,

Gav

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] histogramm?

2005-06-01 Thread Gavin Simpson

Martin Klaffenboeck wrote:

Hello there!

When I do freq=F on hist, I get on the left a small number, what exactly
does that mean?

Thanks,
Martin

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




Did you look at ?hist, which states:

freq: logical; if 'TRUE', the histogram graphic is a representation
  of frequencies, the 'counts' component of the result; if
  'FALSE', _relative_ frequencies ("probabilities"), component
  'density', are plotted.   Defaults to 'TRUE' _iff_ 'breaks'
  are equidistant (and 'probability' is not specified).

So freq = FALSE plots relative frequencies (probabilities).

Please read the posting guide and look at the help for the function you 
are using and trying to understand.


HTH

Gav

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] StructTS and arima and missing values

2005-06-01 Thread Gavin Simpson

Dear List,

I am thinking about ways in which I might analyse some stratigraphic 
data. The nature of the data series I have generates a number of issues:


1) The data I have in mind come from a sediment core sequence taken from 
the bottom of a lake. The sequence is sliced into a priori defined 
slices, in this case 0.2cm per slice. in this way a sequence of 0.2cm 
slices is produced for the entire core.
2) Each slice is assigned a date (plus some error) using radiometric 
dating techniques and a derived age/depth model (we age some of the 
samples and then interpolate/extrapolate for the other samples). This 
can be done in a variety of ways but effectively the end result is that 
each 0.2cm sediment slice has a date (year) attached to it (with some 
error). Changes in the lake system tend to result in changes in the 
accumulation rate of the sediment sequence, so what we end up with is 
say a 200 year core sequence that is irregularly sampled in time, but 
regularly in depth down core.


So for example in one core I end up with the following sequence of years 
sampled:


> dat
 [1] 2001 2000 1999 1998 1997 1996 1994 1993 1992 1990 1988 1986
[13] 1984 1982 1980 1977 1974 1972 1969 1966 1963 1960 1957 1953
[25] 1950 1946 1943 1940 1936 1931 1927 1922 1918 1914 1908 1902
[37] 1896 1890 1884 1878 1872

I am prepared to accept, for the sake of modelling, that these dates are 
known and ignore the errors in the dating if that helps.


Having read Brian Ripley's article on Time series in R News Vol 2(2) 
June 2002, I know that arima and StructTS can now handle missing values, 
and there is some discussion about the specifics of how these functions 
can handle missing values, but it is still not clear, in my mind at 
least, if it would be appropriate to use arima or StructTS on data of 
this nature -- I'm more interested in fitting a structured time series 
to this data.


Can StructTS cope with missing values in the sense that I have described 
them above? If anyone has any suggestions as to how I might approach 
these data using R they would be gratefully received.


Many thanks for your time,

Gavin
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] Reading biplot function's source code

2005-06-03 Thread Gavin Simpson

Hector Villalobos Ortiz wrote:

Hi everybody,

Excuse me for this silly question, but after searching the help archives 
I'm still unable to find my way to read the source code of the "biplot" 
function in R.


I have installed the mvbutils package, and tried:


fixr(biplot)



which only gives me:

function (x, ...)
UseMethod("biplot")

with no further details

I'd like to read the code to see if it is possible to display arrows 
only for some "significant" variables to avoid cluttering. Thank you in 
advance.




That is the code for biplot()! biplot() is a generic function, and 
biplot methods can be written to draw biplots of results produced by 
different functions.


> methods(biplot)
[1] biplot.default*  biplot.prcomp*   biplot.princomp*

Shows us that currently there are 3 methods for biplot in my 
environment. The * indicates that the code for those methods are not 
visible to users directly.


getAnywhere(biplot.prcomp) is one way of viewing the code.

HTH

Gav

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] Porting Matlab code to R

2005-06-06 Thread Gavin Simpson

[EMAIL PROTECTED] wrote:

Hello,

 

I'm looking at porting code written for Matlab to R. 


However, I don't have sufficient knowledge of Matlab to know whether
it's feasible or appropriate.

If there is anyone who has any experience in this and could provide some
advice, I'd be grateful.

 


TIA, Peter


I guess this depends on what the Matlab code is for and what it does, 
whether it uses any commercial toolboxes etc.


I recently ported some Matlab code fairly easily, with the exception of 
the parts of the Matlab code requiring a toolbox I didn't have access to.


You might find Rob Hankin's R and Octave contributed document, which 
lists many Octave (Matlab) functions and their R equivalents:


http://cran.r-project.org/doc/contrib/R-and-octave-2.txt

I found this very helpful.

HTH

Gavin

__
R-help@stat.math.ethz.ch 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] TaskView for ecological and environmental data

2005-06-11 Thread Gavin Simpson
Dear list,

Following off-list discussion with Graham Smith (who initiated the 
initial request for a task view on this topic) and Philippe Grosjean I 
have produced a Task View for ecological and environmental data 
analysis. Graham and Philippe commented on a earlier draft and it is now 
in a shape suitable for public scrutiny.

I have placed a mock-up of the html version of a task view page at the 
URI below and would welcome your comments and suggestions before I 
submit it to Achim Zeileis for inclusion in the ctv package.

http://ecrc3.geog.ucl.ac.uk/download/taskview/

I will now be out of the office for a week and am not sure what email 
availability I will have so it may take a little while for me to reply 
to and act on any suggestions you might make.

I would like to thank Graham and Philippe for encouraging me to maintain 
this view and for their helpful suggestions.

All the best,

Gavin

__
R-help@stat.math.ethz.ch 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] problem using evaluating a formula

2005-08-02 Thread Gavin Simpson
##data
y1 <- matrix(c(3,1,0,1,0,1,1,0,0,0,1,0,0,0,1,1,0,1,1,1),
 nrow = 5, byrow = TRUE)
y2 <- matrix(c
(3,0,10,3,3,0,0,1,1,0,0,0,0,0,1,0,1,0,0,2,1,0,1,1,0,2,1,1,4,1),
 nrow = 5, byrow = TRUE)
y1 <- as.data.frame(y1)
y2 <- as.data.frame(y2)
rownames(y1) <- rownames(y2) <- paste("site", 1:5, sep = "")
colnames(y1) <- paste("spp", 1:4, sep = "")
colnames(y2) <- paste("spp", 1:6, sep = "")

##code
coca.formula <- function(formula, data, ...)
  {
##cat("\nusing formula method\n")
##browser()
if (missing(data)) {
data <- parent.frame()
}
m <- match.call(expand.dots = FALSE)
m$... <- NULL
m[[1]] <- as.name("model.frame")
## the next line fails
m <- eval(m, sys.parent())
Terms <- attr(m, "terms")
Response <- model.extract(m, "response")
attr(Terms, "intercept") <- 0
Predictor <- model.matrix(Terms, m)
retval <- list(m = m, Terms = Terms, Response = Response,
   Predictor = Predictor)
return(retval)
  }

coca(y1 ~ y2, method = "symmetric", symmetric= TRUE)

gives:

Error in model.frame(formula, rownames, variables, varnames, extras,
extranames,  : 
invalid variable type

when executing the indicated line

now both y1 and y2 are data.frames - this is the natural way of
specifying the model I have in mind - and I think this is the problem as
it seems to be the rhs of the formula that is causing the error.

Is there an alternative way of handling and evaling formulae if the rhs
is a data.frame (if my assumption is correct of course)? I would like,
eventually, to have the option of specifying the predictors as either a
data.frame or via named variables found in the variable passed to data.

A simple alternative would be to do the following:

predictor <- get(as.character(formula[[3]]))
response <- get(as.character(formula[[2]]))

Would I be missing something vital that I'm not appreciating if I used
this simple method?

Any other suggestions gratefully received.

Many thanks in advance,

Gav
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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 using evaluating a formula

2005-08-02 Thread Gavin Simpson
On Tue, 2005-08-02 at 18:27 +0100, Gavin Simpson wrote:
> ##data

> 
> coca(y1 ~ y2, method = "symmetric", symmetric= TRUE)

sorry, this should have been:

coca.formula(y1 ~ y2, method = "symmetric", symmetric= TRUE)

> gives:
> 
> Error in model.frame(formula, rownames, variables, varnames, extras,
> extranames,  : 
>   invalid variable type


G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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 configuring R-patched

2005-08-04 Thread Gavin Simpson
On Thu, 2005-08-04 at 14:57 -0400, Kevin E. Thorpe wrote:
> I downloaded R-patched (2005-08-04) from CRAN today.
> I ran ./configure --enable-R-shlib
> 
> I received the error message:
> 
> checking for recommended packages... no
> configure: error: Some of the recommended packages are missing
>Use --without-recommended-packages if this was intentional
 ^^
So was this intentional?

> I built a previous version of R-patched successfully on my system
> which is running the SuSE 9,2 Pro Linux distribution.  I untarred the
> tar ball into the same directory I did my last build on in case that's
> important.
> 
> The only other differences between this attempt and my successful build
> are:
> 
> 1. I did not use --enable-R-shlib last time.
> 2. I found and installed the blas libraries for this build.
> 
> Have I messed up or made an erroneous assumption along the way?

Yes and No. You obviously haven't compiled R recently. If you haven't
got the recommended packages in the source you are compiling, configure
now gives an error, which quite clearly states (and you've quoted it in
your email!) that it cannot find (some of) the recommended packages.

A solution - again given by the error message you quote! - is:

./configure --enable-R-shlib --without-recommended-packages
  ^

That should clear things up.

Other wise you need to cd to the R directory (where you have the source
code), and then execute ./tools/rsync-recommended and then run your
configure command.

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] Computing sums of the columns of an array

2005-08-05 Thread Gavin Simpson
On Fri, 2005-08-05 at 12:16 -0400, Martin C. Martin wrote:
> Hi,
> 
> I have a 5x731 array A, and I want to compute the sums of the columns.  
> Currently I do:
> 
> apply(A, 2, sum)
> 
> But it turns out, this is slow: 70% of my CPU time is spent here, even 
> though there are many complicated steps in my computation.
> 
> Is there a faster way?

Yes, colSums()

e.g.:

> set.seed(1234)
> dat <- matrix(runif(5*731), ncol = 731)
> system.time(for(i in 1:1000) apply(dat, 2, sum), gcFirst = TRUE)
[1] 8.05 0.00 9.89 0.00 0.00
> system.time(for(i in 1:1000) colSums(dat), gcFirst = TRUE)
[1] 0.09 0.01 0.09 0.00 0.00

But neither is that slow on my system. What is A?

HTH

Gav
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] Fwd: Documenting data sets with many variables

2005-08-16 Thread Gavin Simpson
On Tue, 2005-08-16 at 17:11 +0200, Arne Henningsen wrote:
> On Tuesday 16 August 2005 14:49, Roger D. Peng wrote:
> > Have you tried using 'promptData()' on the data frame and then
> > just using the resulting documentation file?
> 
> Thank you, Roger, for bringing 'promptData()' to my mind. This is really a 
> useful tool. However, in my special case my aim is to reduce the extent and 
> increase the comprehensibility of the documentation rather than to reduce my 
> effort to write the documentation. 
> 
> Any further hints are welcome!
> 
> Thanks,
> Arne

Would it not be expedient then to ignore the \format{} section and just
provide the information on the variables say in the \description{},
e.g.:

This example taken from package vegan describing 2 data.frames with 44
and 14 columns. Admittedly, none of the variables in the species dataset
are explicitly and individually described in this example, but it is
sufficient in this case I think.

\name{varespec}
\alias{varechem}
\alias{varespec}
\docType{data}
\title{Vegetation and environment in lichen pastures}
\usage{
   data(varechem)
   data(varespec)
}
\description{
  The \code{varespec} data frame has 24 rows and 44 columns.  Columns
  are estimated cover values of 44 species.  The variable names are
  formed from the scientific names, and are self explanatory for anybody
  familiar with the vegetation type.
The \code{varechem} data frame has 24 rows and 14 columns, giving the
soil characteristics of the very same sites as in the \code{varespec}
data frame. The chemical measurements have obvious names.
\code{Baresoil} gives the estimated cover of bare soil, \code{Humpdepth}
the thickness of the humus layer.

}


HTH

G

> 
> > -roger
> >
> > Arne Henningsen wrote:
> > > Hi,
> > >
> > > since nobody answered to my first message, I try to explain my problem
> > > more clearly and more general this time:
> > >
> > > I have a data set in my R package "micEcon", which has many variables
> > > (82). Therefore, I would like to avoid to describe all variables in the
> > > "\format" section of the documentation (.Rd file). However, doing this
> > > lets "R CMD check" complain about "data codoc mismatches" (details see
> > > below). Is there a way to avoid the description of all variables without
> > > getting a complaint from "R CMD check"?
> > >
> > > Thanks,
> > > Arne
> > >
> > >
> > > --  Forwarded Message  --
> > >
> > > Subject: Documenting data sets with many variables
> > > Date: Friday 05 August 2005 14:03
> > > From: Arne Henningsen <[EMAIL PROTECTED]>
> > > To: R-help@stat.math.ethz.ch
> > >
> > > Hi,
> > >
> > > I extended the data set "Blanciforti86" that is included in my R package
> > > "micEcon". For instance, I added consumer prices, annual consumption
> > > expenditures and expenditure shares of eleven aggregate commodity groups.
> > > The corresponding variables in the data frame are called "pAgg1",
> > > "pAgg2", ..., "pAgg11", "xAgg1", "xAgg2", ..., "xAgg11", "wAgg1",
> > > "wAgg2", ..., "wAgg11". To avoid to describe all 33 items in the
> > > "\format" section of the documentation (.Rd file) I wrote something like
> > >
> > > \format{
> > >This data frame contains the following columns:
> > >\describe{
> > >   [ . . . ]
> > >   \item{xAggX}{Expenditure on the aggregate commodity group X
> > >  (in Millions of US-Dollars).}
> > >   \item{pAggX}{Price index for the aggregate commodity group X
> > >  (1972 = 100).}
> > >   \item{wAggX}{Expenditure share of the aggregate commodity group X.}
> > >   [ . . . ]
> > >}
> > > }
> > >
> > > and explained the 11 aggregate commodity groups only once in a different
> > > section (1=food, 2=clothing, ... ). However, "R CMD check" now complains
> > > about "data codoc mismatches", e.g.
> > >   Code: [...] pAgg1pAgg2 pAgg3  [...]
> > >   Docs: [...] pAggX [...]
> > >
> > > Is there a way to avoid the description of all 33 items without getting a
> > > complaint from "R CMD check"?
> > >
> > > Thanks,
> > > Arne
> > >
> > > ---
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] Dots in models formulae

2005-08-16 Thread Gavin Simpson
On Tue, 2005-08-16 at 18:43 +0200, Laurent Valdes wrote:
> I have seen, several times, dots (like this: "y ~." ) in formula  
> descriptions, noticeably in R help.
> 
> I am unable to see what it does correspond to.
> 
> Any ideas ?

The "." is a short cut to mean all variables specified in the data
argument. E.g.:

> dat <- data.frame(y = 1:10, x = 1:10, z = 1:10)
> model.frame(y ~ ., data = dat)
y  x  z
1   1  1  1
2   2  2  2
3   3  3  3
4   4  4  4
5   5  5  5
6   6  6  6
7   7  7  7
8   8  8  8
9   9  9  9
10 10 10 10

If the response is also found on the rhs (right-hand-side) of the
formula (i.e via using ".") then it is silently droppped from the rhs.

So this is equivalent to the above formula

> model.frame(y ~ x + y + z, data = dat)
y  x  z
1   1  1  1
2   2  2  2
3   3  3  3
4   4  4  4
5   5  5  5
6   6  6  6
7   7  7  7
8   8  8  8
9   9  9  9
10 10 10 10

Here y isn't the response but is included as it is in ".", i.e. dat.
> a <- 1:10
> model.frame(a ~ ., data = dat)
a  y  x  z
1   1  1  1  1
2   2  2  2  2
3   3  3  3  3
4   4  4  4  4
5   5  5  5  5
6   6  6  6  6
7   7  7  7  7
8   8  8  8  8
9   9  9  9  9
10 10 10 10 10

If we don't specify data and we don't have an object named "." (which
may be impossible - I don't know) you get an error:

> model.frame(a ~ .)
Error in eval(expr, envir, enclos) : Object "." not found

I couldn't find "." documented for use in forumla (only for update(),
where it means something slightly different) but I remember seeing this
somewhere.

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] Dots in models formulae

2005-08-16 Thread Gavin Simpson
On Tue, 2005-08-16 at 12:24 -0500, Sundar Dorai-Raj wrote:
> 
> Uwe Ligges wrote:
> > Laurent Valdes wrote:
> > 
> > 
> >>I have seen, several times, dots (like this: "y ~." ) in formula  
> >>descriptions, noticeably in R help.
> >>
> >>I am unable to see what it does correspond to.
> >>
> >>Any ideas ?
> > 
> > 
> > All other variables (except y) from the given data.frame...
> > 
> > Uwe Ligges
> > 
> 
> Hi, Uwe,
> 
> Doesn't this depend on the context? For example,
> 
> z <- data.frame(y = rnorm(10), x = rnorm(10))
> fit <- lm(y ~ ., z)
> update(fit, y ~ . + I(x^2))
> 
> The original poster did not say where he saw this formula. However, I 
> think the reference in ?formula has the most authorative explanation.

Not for "." in a formula in ?formula, at least in 

platform i686-pc-linux-gnu
arch i686
os   linux-gnu
system   i686, linux-gnu
status   Patched
major2
minor1.1
year 2005
month08
day  15
language R

I still can't find this documented for a formula (I found
update.formula, but the meaning of "." is different there, slightly, as
you indicate) - but it must be as I didn't imagine seeing it - or maybe
I did...

G

> Thanks,
> 
> --sundar
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] as.character and a formula

2005-08-16 Thread Gavin Simpson
Dear list,

given this formula: 

> fmla <- formula(y1 ~ spp1 + spp2 + spp3 + spp5)
> fmla[[3]]
spp1 + spp2 + spp3 + spp5

is this the intended behaviour of as.character:

> as.character(fmla[[3]])
[1] "+"  "spp1 + spp2 + spp3" "spp5"

? Where does the extra "+" come from?

> as.character(fmla)
[1] "~" "y1"   
[3] "spp1 + spp2 + spp3 + spp5"

Thanks in advance,

Gav
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] as.character and a formula

2005-08-16 Thread Gavin Simpson
On Tue, 2005-08-16 at 21:44 +0200, Peter Dalgaard wrote:
> Gavin Simpson <[EMAIL PROTECTED]> writes:
> 
> > Dear list,
> > 
> > given this formula: 
> > 
> > > fmla <- formula(y1 ~ spp1 + spp2 + spp3 + spp5)
> > > fmla[[3]]
> > spp1 + spp2 + spp3 + spp5
> > 
> > is this the intended behaviour of as.character:
> > 
> > > as.character(fmla[[3]])
> > [1] "+"  "spp1 + spp2 + spp3" "spp5"
> 
> Yes.

Thanks Uwe, Brian and Peter for setting me straight. Being unobservant,
forgetful and stupid, all in one day, is some going, even for me.

All the best,

Gav

> > ? Where does the extra "+" come from?
> 
> What extra "+" ? There are three of them in fmla[[3]] and three in
> as.character().
> 
> as.character of an object of mode call is obtained by converting it to
> a list and deparsing each term (modulo some details regarding
> backquotes). This is somewhat peculiar, but quite a bit of legacy code
> is depending on it. Things like testing for as.character(e)[1] == "~"
> 
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] do glm with two data sets

2005-08-17 Thread Gavin Simpson
On Wed, 2005-08-17 at 17:22 -0500, Sundar Dorai-Raj wrote:
> 
> Hu, Ying (NIH/NCI) wrote:
> > I have two data sets:
> > File1.txt: 
> > Name id1   id2   id3   ...
> > N10 1 0 ...
> > N20 1 1 ...
> > N31 1 -1...
> > ...
> >  
> > File2.txt:
> > Group id1   id2   id3   ...
> > G1   1.22 1.34 2.44 ...
> > G2   2.33 2.56 2.56 ...
> > G3   1.56 1.99 1.46 ...
> > ...
> > I like to do:
> > x1<-c(0,1,0,...)
> > y1<-c(1.22,1.34, 2.44, ...)
> > z1<-data.frame(x,y)
> > summary(glm(y1~x1,data=z1)
> >  
> > But I do the same thing by inputting the data sets from the two files
> > e <- read.table("file1.txt", header=TRUE,row.names=1)
> > g <- read.table("file2.txt", header=TRUE,row.names=1)
> > e1<-exp[1,]
> > g1<-geno[1,]
> > d1<-data.frame(g, e)
> > summary(glm(e1 ~ g1, data=d1))
> >  
> > the error message is 
> > Error in model.frame(formula, rownames, variables, varnames, extras,
> > extranames,  : 
> > invalid variable type
> > Execution halted
> >  
> > Thanks in advance,
> >  
> > Ying

Hi Ying,

That error message is likely caused by having a data.frame on the right
hand side (rhs) of the formula. You can't have a data.frame on the rhs
of a formula and g1 is still a data frame even if you only choose the
first row, e.g.:

dat <- as.data.frame(matrix(100, 10, 10))
class(dat[1, ])
[1] "data.frame"

You could try:

glm(e1 ~ ., data=g1[1, ])

and see if that works, but as Sundar notes, your post is a little
difficult to follow, so this may not do what you were trying to achieve.

HTH

Gav

> 
> You have several inconsistencies in your example, so it will be 
> difficult to figure out what you are trying to accomplish.
> 
>  > e <- read.table("file1.txt", header=TRUE,row.names=1)
>  > g <- read.table("file2.txt", header=TRUE,row.names=1)
>  > e1<-exp[1,]
> 
> What's "exp"? Also it's dangerous to use an R function as a variable 
> name. Most of the time R can tell the difference, but in some cases it 
> cannot.
> 
>  > g1<-geno[1,]
> 
> What's "geno"?
> 
>  > d1<-data.frame(g, e)
> 
> d1 is now e and g cbind'ed together?
> 
>  > summary(glm(e1 ~ g1, data=d1))
> 
> Are "e1" and "g1" elements of "d1"? From what you've told us, I don't 
> know where the error is occurring. Also, if you are having errors, you 
> can more easily isolate the problem by doing:
> 
> fit <- glm(e1 ~ g1, data = d1)
> summary(fit)
> 
> This will at least tell you the problem is in your call to "glm" and not 
> "summary.glm".
> 
> --sundar
> 
> P.S. Please (re-)read the POSTING GUIDE. Most of the time you will 
> figure out problems such as these on your own during the process of 
> creating a reproducible example.
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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 when installing R in Fedora core 4

2005-08-18 Thread Gavin Simpson
On Thu, 2005-08-18 at 09:31 -0400, Peter Yang wrote:
> Hi, I got a problem when installing R in Fedora core 4. When I ran
> .configure, it gave the following error message:
> 
> configure: error: --with-x=yes (default) and X11 headers/libs are not 
> available
> 
> Could anyone tell me what's wrong? Am I missing some package in Fedora?
> 
> Thanks a lot for your help.
> 
> Peter

Yes, the development headers for X11.

If you use YUM, do the following in a shell:

su -c "yum install xorg-x11-devel"

Enter your root password and it will download and install the relevant
headers.

As an aside, are you aware of Martyn Plummer's R rpm binary? You can get
it from here: http://www.stats.bris.ac.uk/R/bin/linux/redhat/fc4/

HTH

Gav

> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] do glm with two data sets

2005-08-18 Thread Gavin Simpson
On Thu, 2005-08-18 at 10:38 -0400, Hu, Ying (NIH/NCI) wrote:
> Thanks for your help.
> 
> # read the two data sets
> e <- as.matrix(read.table("file1.txt", header=TRUE,row.names=1))
> g <- as.matrix(read.table("file2.txt", header=TRUE,row.names=1))
> # solution 
> d1<-data.frame(g[1,], e[1,])

This is redundant, as:

> fit<-glm(e[1,] ~ g[1,], data=d1)

and:

fit <- glm(e[1, ] ~ g[1, ])

are equivalent - you don't need data = d1 in this case, e.g:

e <- matrix(c(0, 1, 0, 0, 1, 1, 1, 1, -1), ncol = 3, byrow = TRUE)
e
g <- matrix(c(1.22, 1.34, 2.44, 2.33, 2.56, 2.56, 1.56, 1.99, 1.46),
ncol = 3, byrow = TRUE)
g
fit <- glm(e[1, ] ~ g[1, ])
fit

works fine.

> summary(fit)
> 
> I am not sure that is the best solution.

This seems a strange way of doing this. Why not:

pred <- g[1, ]
resp <- e[1, ]
fit <- glm(resp ~ pred)
fit

and do your subsetting outside the glm call - makes things clearer no?
Unless you plan to do many glm()s one per row of your two matrices. If
that is the case, then there are better ways of approaching this.

> Thanks again,
> 
> Ying

HTH

G

> 
> -Original Message-
> From: Gavin Simpson [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, August 17, 2005 7:01 PM
> To: Sundar Dorai-Raj
> Cc: Hu, Ying (NIH/NCI); r-help@stat.math.ethz.ch
> Subject: Re: [R] do glm with two data sets
> 
> On Wed, 2005-08-17 at 17:22 -0500, Sundar Dorai-Raj wrote:
> > 
> > Hu, Ying (NIH/NCI) wrote:
> > > I have two data sets:
> > > File1.txt: 
> > > Name id1   id2   id3   ...
> > > N10 1 0 ...
> > > N20 1 1 ...
> > > N31 1 -1...
> > > ...
> > >  
> > > File2.txt:
> > > Group id1   id2   id3   ...
> > > G1   1.22 1.34 2.44 ...
> > > G2   2.33 2.56 2.56 ...
> > > G3   1.56 1.99 1.46 ...
> > > ...
> > > I like to do:
> > > x1<-c(0,1,0,...)
> > > y1<-c(1.22,1.34, 2.44, ...)
> > > z1<-data.frame(x,y)
> > > summary(glm(y1~x1,data=z1)
> > >  
> > > But I do the same thing by inputting the data sets from the two files
> > > e <- read.table("file1.txt", header=TRUE,row.names=1)
> > > g <- read.table("file2.txt", header=TRUE,row.names=1)
> > > e1<-exp[1,]
> > > g1<-geno[1,]
> > > d1<-data.frame(g, e)
> > > summary(glm(e1 ~ g1, data=d1))
> > >  
> > > the error message is 
> > > Error in model.frame(formula, rownames, variables, varnames, extras,
> > > extranames,  : 
> > > invalid variable type
> > > Execution halted
> > >  
> > > Thanks in advance,
> > >  
> > > Ying
> 
> Hi Ying,
> 
> That error message is likely caused by having a data.frame on the right
> hand side (rhs) of the formula. You can't have a data.frame on the rhs
> of a formula and g1 is still a data frame even if you only choose the
> first row, e.g.:
> 
> dat <- as.data.frame(matrix(100, 10, 10))
> class(dat[1, ])
> [1] "data.frame"
> 
> You could try:
> 
> glm(e1 ~ ., data=g1[1, ])
> 
> and see if that works, but as Sundar notes, your post is a little
> difficult to follow, so this may not do what you were trying to achieve.
> 
> HTH
> 
> Gav
> 
> > 
> > You have several inconsistencies in your example, so it will be 
> > difficult to figure out what you are trying to accomplish.
> > 
> >  > e <- read.table("file1.txt", header=TRUE,row.names=1)
> >  > g <- read.table("file2.txt", header=TRUE,row.names=1)
> >  > e1<-exp[1,]
> > 
> > What's "exp"? Also it's dangerous to use an R function as a variable 
> > name. Most of the time R can tell the difference, but in some cases it 
> > cannot.
> > 
> >  > g1<-geno[1,]
> > 
> > What's "geno"?
> > 
> >  > d1<-data.frame(g, e)
> > 
> > d1 is now e and g cbind'ed together?
> > 
> >  > summary(glm(e1 ~ g1, data=d1))
> > 
> > Are "e1" and "g1" elements of "d1"? From what you've told us, I don't 
> > know where the error is occurring. Also, if you are having errors, you 
> > can more easily isolate the problem by doing:
> > 
> > fit <- glm(e1 ~ g1, data = d1)
> > summary(fit)
> > 
> > This will at least tell you t

Re: [R] plot and legend

2005-08-19 Thread Gavin Simpson
On Thu, 2005-08-18 at 18:19 +0200, [EMAIL PROTECTED] wrote:
> Hello,
> 
> I would like make a plot with a legend. How can I take the legend
> outside of the plot frame?
> 

Does this do what you want?

## change the plotting parameters and store defaults
## mar sets 2 more lines in the margin than default at the top
## xpd = TRUE stops clipping to the plot region only
oldpar <- par(mar = c(5, 4, 6, 2) + 0.1, xpd = TRUE)

## do a plot
plot(1:10)

## now build a legend, the y co-ordinate pushes the legend outside the
## plotting region - x & y are on same scale as your axes
## xjust = 0.5 centres the legend on the x coordinate
legend(x = 5.5, y = 11.5, "legend text", pch = 1, xjust = 0.5)

##restore the defaults
par(oldpar)

It would be nice if legend allowed the use of "top" etc. to relate to
the device if the user wanted. It would simplify this kind plot
arrangement.

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] Installing R in Fedora Core 4

2005-08-19 Thread Gavin Simpson
On Fri, 2005-08-19 at 09:59 -0400, White, Charles E WRAIR-Wash DC wrote:
> R is included in Fedora Extras. You can skip downloading Extras and
> updating the packages on the CD by using:
> 
> yum index | grep R
> 
> and installing the half dozen or so individual packages that will be
> listed.  The number of packages may be mildly annoying but if you
> install this way you will be notified of R updates along with all of
> your other security and application updates through the Red Hat
> Network.
> 
> Chuck
> 

Peter Dalgaard has noted, on the R-Devel list (sorry I can't provide the
link to the mail - the link from the R site to the mail archives wasn't
working when I tried), that there are problems with the R rpm from
Fedora Extras, including a strange printing bug. I believe Peter now
thinks this is a bug in R (seem to have deleted that post - doh) exposed
by the compilation flags used by the maintainer of the Fedora Extras
rpm.

If you want and rpm to install, then Martyn Plummer provides R binaries
for Red Hat / Fedora systems that are available from CRAN e.g: for FC4
http://www.stats.bris.ac.uk/R/bin/linux/redhat/fc4/

Martyn has also made these available via a yum-compatible repository, so
the benefits you note of auto-notification of updates etc. apply here as
well.

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] Installing R in Fedora Core 4

2005-08-19 Thread Gavin Simpson
On Fri, 2005-08-19 at 11:07 -0400, White, Charles E WRAIR-Wash DC wrote:
> -Original Message-
> On Fri, 8/19, Gavin Simpson wrote:
> Peter Dalgaard has noted, on the R-Devel list (sorry I can't provide the
> link to the mail - the link from the R site to the mail archives wasn't
> working when I tried), that there are problems with the R rpm from
> Fedora Extras, including a strange printing bug. I believe Peter now
> thinks this is a bug in R (seem to have deleted that post - doh) exposed
> by the compilation flags used by the maintainer of the Fedora Extras
> rpm.
> 
> If you want and rpm to install, then Martyn Plummer provides R binaries
> for Red Hat / Fedora systems that are available from CRAN e.g: for FC4
> http://www.stats.bris.ac.uk/R/bin/linux/redhat/fc4/
> 
> Martyn has also made these available via a yum-compatible repository, so
> the benefits you note of auto-notification of updates etc. apply here as
> well.
> 
> HTH
> 
> G
> -End Original Message-
> 
> The last time I tried to use the Martyn Plummer RPMs they were compiled
> without enabling shared libraries and I ended up compiling R myself so
> that I could use JGR. Messages describing the problem with the version
> actually on the Extras CD were my other unstated reason for describing
> yum instead of downloading the CD. I haven't heard there is a problem
> with Fedora's new RPMs but that doesn't prove that there aren't any. I
> fully agree with Martyn Plummer's readme notice that describes Fedora
> Core as bleeding edge technology not to be trusted for production use.
> Fedora Core describes itself that way.

Do you mean the shared library libR.so? If so, the README in the FC3
section indicates that these rpms now include the functionality you
require. The absence of a README in the FC4 section means it is not
clear from there if these rpms are also compiled with the shared
library.

>From Peter's email, it would seem that the maintainer of the R rpm for
Extras continues to use the compiler flags that cause the problems
previously described (I haven't confirmed that this is still the case
mind you).

Although FC4 is bleeding edge, I've had very few problems with in on my
new laptop or my home desktop - after initial gcc v4.0.0 and gfortran
teething troubles that is.

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch 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] How to remove similar successive objects from a vector?

2006-08-16 Thread Gavin Simpson
On Wed, 2006-08-16 at 10:42 +0300, Atte Tenkanen wrote:
> Is there some (much) more efficient way to do this?
> 
> VECTOR=c(3,2,4,5,5,3,3,5,1,6,6);
> NEWVECTOR=VECTOR[1];
> 
> for(i in 1:(length(VECTOR)-1))
> {
>   if((identical(VECTOR[i], VECTOR[i+1]))==FALSE){
>   NEWVECTOR=c(NEWVECTOR,VECTOR[i+1])}
> }
> 
> > VECTOR
>  [1] 3 2 4 5 5 3 3 5 1 6 6
> > NEWVECTOR
> [1] 3 2 4 5 3 5 1 6
> 
> ___
> Atte Tenkanen

Is this what you mean?

x <- c(3, 2, 4, 5, 5, 3, 3, 5, 1, 6, 6)
x.wanted <- c(3, 2, 4, 5, 3, 5, 1, 6)

X <- x[diff(x) != 0]

all.equal(x.wanted, X) # check it works

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 *Note new Address and Fax and Telephone numbers from 10th April 2006*
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [t] +44 (0)20 7679 0522
ECRC  [f] +44 (0)20 7679 0565
UCL Department of Geography
Pearson Building  [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street
London, UK[w] http://www.ucl.ac.uk/~ucfagls/cv/
WC1E 6BT  [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 remove similar successive objects from a vector?

2006-08-16 Thread Gavin Simpson
On Wed, 2006-08-16 at 13:01 +0300, Atte Tenkanen wrote:
> Thanks for all respondents!
> 
> I wasn't precise enough, when I enclosed my example. In fact, I need a
> version which works with all kinds of symbolic data, not only with
> numbers. So these versions
> 
> rle(VECTOR)$values
> 
> and
> 
> VECTOR=c(3,2,2,3,4,4,5,5,5,3,3,3,5,1,6,6)
> NEWVECTOR <- ifelse(VECTOR[-length(VECTOR)]==VECTOR[-1],NA,VECTOR)
> NEWVECTOR[!is.na(NEWVECTOR)]

Note that the above is not giving the same answer as
rle(VECTOR)$values :

> VECTOR=c(3,2,2,3,4,4,5,5,5,3,3,3,5,1,6,6)
> NEWVECTOR <- ifelse(VECTOR[-length(VECTOR)]==VECTOR[-1],NA,VECTOR)
> NEWVECTOR[!is.na(NEWVECTOR)]
[1] 3 2 3 4 5 3 5 1
> rle(VECTOR)$values
[1] 3 2 3 4 5 3 5 1 6
> all.equal(NEWVECTOR[!is.na(NEWVECTOR)], rle(VECTOR)$values)
[1] "Numeric: lengths (8, 9) differ"

So make sure you use the rle solution.

G

> 
> answered to my needs.
> 
> I made a test and the first version was 2.5x faster with my data, but
> both works enough fast.
> 
> Atte
> 
> On Wed, 2006-08-16 at 08:58 +0100, Patrick Burns wrote:
> > I think
> > 
> > rle(VECTOR)$values
> > 
> > will get you what you want.
> > 
> > Patrick Burns
> > [EMAIL PROTECTED]
> > +44 (0)20 8525 0696
> > http://www.burns-stat.com
> > (home of S Poetry and "A Guide for the Unwilling S User")
> > 
> > Atte Tenkanen wrote:
> > 
> > >Is there some (much) more efficient way to do this?
> > >
> > >VECTOR=c(3,2,4,5,5,3,3,5,1,6,6);
> > >NEWVECTOR=VECTOR[1];
> > >
> > >for(i in 1:(length(VECTOR)-1))
> > >{
> > >   if((identical(VECTOR[i], VECTOR[i+1]))==FALSE){
> > >   NEWVECTOR=c(NEWVECTOR,VECTOR[i+1])}
> > >}
> > >
> > >  
> > >
> > >>VECTOR
> > >>
> > >>
> > > [1] 3 2 4 5 5 3 3 5 1 6 6
> > >  
> > >
> > >>NEWVECTOR
> > >>
> > >>
> > >[1] 3 2 4 5 3 5 1 6
> > >
> > >___
> > >Atte Tenkanen
> > >University of Turku, Finland
> > >
> > >__
> > >R-help@stat.math.ethz.ch mailing list
> > >https://stat.ethz.ch/mailman/listinfo/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.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC & ENSIS, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/cv/
 UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


[R] How to draw a per mille symbol?

2006-09-19 Thread Gavin Simpson
Dear list,

Following advice posted to this list a while back by Prof Ripley [1], I
have been trying to draw a per mille character [2] in an axis label.

This should give the correct character:

plot(1:10, ylab = "\u2030")

but all I get is '"S'. I'm running linux (FC5) and have fonts installed
that have the correct character (viewed in the Gnome character map at
least).

I have also tried plotting to a pdf device with a font family that the
character map tool shows I have a per mille glyph for, e.g.:

pdf("~/tmp/test_per_mille.pdf", paper = "a4", family = "URWBookman")
plot(1:10, ylab = "\u2030")
dev.off()

But all I get here is a period or a dot-like symbol.

I've tried this in R 2.4.0 alpha [4] and R 2.5.0 to be [4] as my
self-compiled R 2.3.1-patched dies when plotting Unicode characters
(fixed in 2.4.0 alpha and above [3])

Can anyone point me in the right direction to get this working?

TIA,

G

[1] http://finzi.psych.upenn.edu/R/Rhelp02a/archive/48709.html
[2] like a "%" but with 2 circles at the bottom not one, see
http://en.wikipedia.org/wiki/Permille
[3] see thread at http://article.gmane.org/gmane.comp.lang.r.devel/9704
[4] R version 2.4.0 alpha (2006-09-19 r39410)
[5] R version 2.5.0 Under development (unstable) (2006-09-19 r39410)
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC & ENSIS, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [R] How to draw a per mille symbol?

2006-09-19 Thread Gavin Simpson
On Tue, 2006-09-19 at 17:29 +0100, Gavin Simpson wrote:
> Dear list,
> 
> Following advice posted to this list a while back by Prof Ripley [1], I
> have been trying to draw a per mille character [2] in an axis label.


Before I get asked for it, here's the sessionInfo() - apologies for not
supplying it originally.

> version
   _
platform   i686-pc-linux-gnu
arch   i686
os linux-gnu
system i686, linux-gnu
status alpha
major  2
minor  4.0
year   2006
month  09
day19
svn rev39410
language   R
version.string R version 2.4.0 alpha (2006-09-19 r39410)
> sessionInfo()
R version 2.4.0 alpha (2006-09-19 r39410)
i686-pc-linux-gnu

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

attached base packages:
[1] "methods"   "stats" "graphics"  "grDevices" "utils"
"datasets"
[7] "base"
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC & ENSIS, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [R] How to draw a per mille symbol?

2006-09-20 Thread Gavin Simpson
On Tue, 2006-09-19 at 17:53 +0100, Prof Brian Ripley wrote:
> On Tue, 19 Sep 2006, Gavin Simpson wrote:
> 
> > Dear list,
> >
> > Following advice posted to this list a while back by Prof Ripley [1], I
> > have been trying to draw a per mille character [2] in an axis label.
> >
> > This should give the correct character:
> >
> > plot(1:10, ylab = "\u2030")
> >
> > but all I get is '"S'. I'm running linux (FC5) and have fonts installed
> > that have the correct character (viewed in the Gnome character map at
> > least).
> 
> On what device?  If X11, this is almost always a font selection issue.
> Unicode support in X11 fonts is a complex issue that seems to vary with 
> every minor update.

Yes, this was an X11 device.

> 
> > I have also tried plotting to a pdf device with a font family that the
> > character map tool shows I have a per mille glyph for, e.g.:
> 
> What does character map have to do with postscript fonts?

Given your comment, nothing. You've probably guessed I know very little
about fonts, and had naively assumed that a font of the same name as a
name displayed by postscriptFonts() or pdfFonts(), which showed a per
mille sign in the character map tool in Gnome, were one and the same
thing.

> 
> > pdf("~/tmp/test_per_mille.pdf", paper = "a4", family = "URWBookman")
> > plot(1:10, ylab = "\u2030")
> > dev.off()
> >
> > But all I get here is a period or a dot-like symbol.
> 
> But see the article in R-news 2006-2 about this.  All we can do for PDF is 
> to use an appropriate 8-bit font map, or a CJK font.  It seems that e.g.
> encoding="CP1251" works, even for Helvetica.
> 

Ok, thanks for this - I've now read this and think I understand the
issues and how to work with fonts in R a bit better now.

The ultimate aim was to be able to include relevant code in a Sweave
document. I'm not aware of a way to pass extra instructions to the pdf
generator code in Sweave, so the solution will involve generating the
pdf within embedded R code directly and inserting the figure manually
into the the document. Is my thinking correct here?

Thanks again for answering my questions, Prof. Ripley.

G

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

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


Re: [R] How to draw a per mille symbol?

2006-09-20 Thread Gavin Simpson
On Wed, 2006-09-20 at 15:28 +1200, Paul Murrell wrote:
> Hi
> 
> 
> Gavin Simpson wrote:
> > Dear list,
> > 
> > Following advice posted to this list a while back by Prof Ripley [1], I
> > have been trying to draw a per mille character [2] in an axis label.
> > 
> > This should give the correct character:
> > 
> > plot(1:10, ylab = "\u2030")
> > 
> > but all I get is '"S'. I'm running linux (FC5) and have fonts installed
> > that have the correct character (viewed in the Gnome character map at
> > least).

Thanks for your reply Paul, and also to Andrew Robinson for his earlier
reply. I had initially avoided trying to use the encoding argument and
pdf() as I had planned to include the code to produce the graphics in a
Sweave document and AFAICS there is no way to pass extra arguments to
the code generating the pdf figures in Sweave? Of course, my original
plan was ignorant of the details of font encodings and mappings to
single byte encodings in pdf and postscript devices and wouldn't have
worked anyway.

> 
> 
> I get the same thing (and using xfd I see the per mille character in the 
> font I'm using).  I'm afraid I'm not sure why this is happening;  I can 
> get a number of other "unusual" characters to work (e.g., \u20ac), but 
> there appear to be some characters that do not draw correctly.  I used 
> the following code to explore the default Helvetica font I've got and I 
> can't see a rational pattern in the misbehaviour.
> 
> x11(width=5, height=5)
> grid.prompt(TRUE)
> digits <- c(0:9, letters[1:6])
> for (i in c("00", "01", "02", "03", "1e", "20", "21", "22")) {
>  grid.newpage()
>  for (j in 1:16) {
>  for (k in 1:16) {
>  pushViewport(viewport(x=j/16, y=1-k/16,
>width=1/16, height=1/16,
>just=c("right", "bottom")))
>  eval(parse(text=paste('grid.text("\\u',
>   i, digits[k], digits[j], '")', sep="")))
>  popViewport()
>  }
>  }
> }
> 

That is a nice tool for looking at the font glyphs, which I can see
being very useful in working out which unicode number matches the
character you want to display. I'm not too clued up on grid graphics
yet, would it be easy to modify the above to print out the \u code
above each glyph?

> 
> > I have also tried plotting to a pdf device with a font family that the
> > character map tool shows I have a per mille glyph for, e.g.:
> > 
> > pdf("~/tmp/test_per_mille.pdf", paper = "a4", family = "URWBookman")
> > plot(1:10, ylab = "\u2030")
> > dev.off()
> > 
> > But all I get here is a period or a dot-like symbol.
> 
> 
> This is an encoding problem I think.  For producing PDF output, the 
> character string gets converted to a single-byte encoding.   If your 
> default locale is ISOLatin1 like mine then you won't see the per mille 
> because that character (called perthousand in the Adobe afm's) is not in 
> the ISOLatin1 encoding.  If you explicitly use an encoding that does 
> include perthousand (like WinAnsi) then the conversion to single-byte 
> encoding works.  For example, this works (for me at least) ...
> 
> pdf("WinAnsi_per_mille.pdf", encoding="WinAnsi")
> plot(1:10, ylab = "\u2030")
> dev.off()
> 
> Paul

Thanks for this, which works fine for me also.

All the best,

G

> 
> 
> > I've tried this in R 2.4.0 alpha [4] and R 2.5.0 to be [4] as my
> > self-compiled R 2.3.1-patched dies when plotting Unicode characters
> > (fixed in 2.4.0 alpha and above [3])
> > 
> > Can anyone point me in the right direction to get this working?
> > 
> > TIA,
> > 
> > G
> > 
> > [1] http://finzi.psych.upenn.edu/R/Rhelp02a/archive/48709.html
> > [2] like a "%" but with 2 circles at the bottom not one, see
> > http://en.wikipedia.org/wiki/Permille
> > [3] see thread at http://article.gmane.org/gmane.comp.lang.r.devel/9704
> > [4] R version 2.4.0 alpha (2006-09-19 r39410)
> > [5] R version 2.5.0 Under development (unstable) (2006-09-19 r39410)
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC & ENSIS, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [R] local intallation of MSBVAR_0.2.0.tar.gz

2006-09-20 Thread Gavin Simpson
On Wed, 2006-09-20 at 11:12 -0400, [EMAIL PROTECTED] wrote:
> Hello, 
> 
> can someone tell me how to install a package 
> like "MSBVAR_0.2.0.tar.gz" locllay ?
> 
> thanks

Unix/Linux or Windows? If Windows, forget the tar.gz file (unless you
are set up to compile source code), you'd probably be better off with
the zip binary. Download it instead and then look at the menus in R-GUI
for the option to install from local zip file - I rarely use Windows
these days so forget which menu it is in now.

If Unix/linux, then:

R CMD INSTALL MSBVAR_0.2.0tar.gz

or

R CMD INSTALL -l /path/to/lib MSBVAR_0.2.0tar.gz

will do what you want, the -l /path thingy allows you to install to a
specified library.

All this is explained in the R Installation and Administration manual,
that you can find here (html):

http://cran.r-project.org/doc/manuals/R-admin.html

HTH

G

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

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


Re: [R] Statitics Textbook - any recommendation?

2006-09-20 Thread Gavin Simpson
On Wed, 2006-09-20 at 18:56 -0400, Charles Annis, P.E. wrote:
> Recommending a good book on statistics is like recommending a good book on
> sports:  Which sports?
> 
> A good book for learning statistical concepts (and learning R at the same
> time), one that assumes you understand algebra but are new to statistics, is
> Peter Dalgaard's _Introductory Statistics with R_ (Springer 2002).  The
> writing is relaxed and succinct, not condescending as some texts might
> appear to a newcomer.  It's just a good book.

I couldn't agree more. A number of my colleagues have bought Peter
Dalgaard's book to a) learn some R and b) learn some statistics. They
have found it very useful indeed.

G

> 
> Charles Annis, P.E.
> 
> [EMAIL PROTECTED]
> phone: 561-352-9699
> eFax:  614-455-3265
> http://www.StatisticalEngineering.com
>  
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Mike Nielsen
> Sent: Wednesday, September 20, 2006 6:36 PM
> To: Berton Gunter
> Cc: r-help@stat.math.ethz.ch
> Subject: Re: [R] Statitics Textbook - any recommendation?
> 
> Excellent characterization.
> 
> MASS is a very good book, but I'm not sure I would describe it as a
> statistics textbook, much less one of the "basic" variety.  While I
> certainly wouldn't presume to speak for Prof. Ripley and Dr. Venables,
> it seems unlikely their intent in writing MASS was to teach
> statistics, but rather, as the name of the book might suggest, to
> explain how S+ (and R) can be applied to modern statistical
> techniques.  My experience with this book is that it assumes
> considerable background knowledge.
> 
> By all means, buy MASS, but if you need guidance on the how and why of
> statistical techniques, you may wish to shop Amazon to find a
> supplement.
> 
> Regards,
> 
> Mike
> 
> On 9/20/06, Berton Gunter <[EMAIL PROTECTED]> wrote:
> > Not withstanding Prof. Heiberger's admirable enthusiasm, I think the
> > canonical answer is probably MASS (Modern Applied Statistics with S) by
> > Venables and Ripley. It is very comprehensive, but depending on your
> > background, you may find it too telegraphic.
> >
> > -- Bert Gunter
> > Genentech Non-Clinical Statistics
> > South San Francisco, CA
> >
> > "The business of the statistician is to catalyze the scientific learning
> > process."  - George E. P. Box
> >
> >
> >
> > > -Original Message-
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] On Behalf Of Iuri Gavronski
> > > Sent: Wednesday, September 20, 2006 1:22 PM
> > > To: r-help@stat.math.ethz.ch
> > > Subject: [R] Statitics Textbook - any recommendation?
> > >
> > > I would like to buy a basic statistics book (experimental design,
> > > sampling, ANOVA, regression, etc.) with examples in R. Or
> > > download it
> > > in PDF or html format.
> > > I went to the CRAN contributed documentation, but there were only R
> > > textbooks, that is, textbooks where R is the focus, not the
> > > statistics. And I would like to find the opposite.
> > > Other text I am trying to find is multivariate data analysis (EFA,
> > > cluster, mult regression, MANOVA, etc.) with examples with R.
> > > Any recommendation?
> > >
> > > Thank you in advance,
> > >
> > > Iuri.
> > >
> > > __
> > > R-help@stat.math.ethz.ch mailing list
> > > https://stat.ethz.ch/mailman/listinfo/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.
> >
> 
> 
> 
> -- 
> Regards,
> 
> Mike Nielsen
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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 po

Re: [R] Command area in SciViews 0.8.9 - second try

2006-09-21 Thread Gavin Simpson
On Thu, 2006-09-21 at 13:58 +0200, [EMAIL PROTECTED] wrote:
> Dear all
> 
> I am writing again with a question I posted a few weeks ago (to no
> avail).

STG

Perhaps the main reason you received no replies is that you failed to
read to the posting guide and act appropriately. Sciviews is *not* part
of R, it is a contributed package. As such you are asked to contact the
maintainer directly. Please do so.

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

Sorry I can't be any more help - I have never used Sciviews.

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

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


Re: [R] how to ignore "NA" or replace it by another value

2006-09-21 Thread Gavin Simpson
On Thu, 2006-09-21 at 19:58 +0200, Thomas Preuth wrote:
> Hello,
> 
> I`m a newbie to R so maybe this question is boring, but I have a large 
> table with several empty missing values, which come out as "NA". How can 
> i ignore them or replace them by another number?
> 
> Greetings, Thomas
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Ignoring NAs depends on what functions you want to ignore them in.

As for replacing NAs with another number, this will replace all NAs with
0

# some example data
dat <- as.data.frame(matrix(rnorm(100), nrow = 10))
# add some NAs
dat[sample(1:10, 3), sample(1:10, 3)] <- NA
dat
# replace missing values with 0
dat <- sapply(dat, function(x) {x[is.na(x)] <- 0; x})
dat

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 *Note new Address and Fax and Telephone numbers from 10th April 2006*
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [t] +44 (0)20 7679 0522
ECRC  [f] +44 (0)20 7679 0565
UCL Department of Geography
Pearson Building  [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street
London, UK[w] http://www.ucl.ac.uk/~ucfagls/cv/
WC1E 6BT  [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] delete a entire vector of a dataframe

2006-09-21 Thread Gavin Simpson
On Thu, 2006-09-21 at 20:01 +0200, Thomas Preuth wrote:
> delete a entire vector of a dataframe
> 
> Hello,
> 
> i want to delete a vector and tried "rm (t.d$V712)". This did not work, 
> message was, could not find variable. I thought the $ defines the vectro 
> in a dataframe, when I just type "t.d$V712" the content of this vector 
> is displayed.
> 
> Greetings, Thomas

You can't do that, and that is not what the error message said exactly -
which should have told you something was wrong with your thinking as it
also said "1: remove: variable "$" was not found". Instead, copy over
the object, minus the column you want to delete:

dat <- as.data.frame(matrix(rnorm(100), nrow = 10))
names(dat) <- paste("Var", 1:10, sep = "_")
dat
# now we don't want column Var_6
dat <- dat[, -6]
# or if we don't know which column is Var_6 you could do
not.want <- which(names(dat) %in% "Var_7") # now don't want Var_7
dat <- dat[, -not.want]
dat

This can be extended to many variables:

not.want <- which(names(dat) %in% c("Var_10", "Var_2", "Var_8"))
dat <- dat[, -not.want]
dat # only 1, 3, 4, 5, 9 left

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 *Note new Address and Fax and Telephone numbers from 10th April 2006*
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [t] +44 (0)20 7679 0522
ECRC  [f] +44 (0)20 7679 0565
UCL Department of Geography
Pearson Building  [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street
London, UK[w] http://www.ucl.ac.uk/~ucfagls/cv/
WC1E 6BT  [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] venn diagram with more than three vectors

2006-09-26 Thread Gavin Simpson
On Tue, 2006-09-26 at 10:02 +0200, Oosting, J. (PATH) wrote:
> I am not aware of existing functions to draw venn diagrams with more
> than 3 sets, but you could have a look at
> http://en.wikipedia.org/wiki/Venn_diagram to see how these can be
> constructed.
> 
> Jan Oosting 

Package vegan has a function (varpart) and plot method that will draw
venn diagrams with up to 4 sets. It works on results from redundancy
analyses, but you could probably adapt it to your needs.

HTH

G

> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Pan Zheng
> Sent: dinsdag 26 september 2006 2:09
> To: r-help@stat.math.ethz.ch
> Subject: [R] venn diagram with more than three vectors
> 
> Hi,
>
>   I am using venn diagram function in AMDA to plot the venn diagram. But
> it seems in this function, it can only plot 3 or less vectors. Is there
> a way to plot the venn diagram with more than 3 vectors?
>
>   Please help.
>
>   Thanks.
>
>   Z
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 *Note new Address and Fax and Telephone numbers from 10th April 2006*
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [t] +44 (0)20 7679 0522
ECRC  [f] +44 (0)20 7679 0565
UCL Department of Geography
Pearson Building  [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street
London, UK[w] http://www.ucl.ac.uk/~ucfagls/cv/
WC1E 6BT  [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Some questions about plotting with R

2006-10-04 Thread Gavin Simpson
On Wed, 2006-10-04 at 09:10 +0100, Wee-Jin Goh wrote:
> On 4 Oct 2006, at 09:03, Robin Hankin wrote:
> 
> > Hi Wee-Jin
> >
> > check out R-and-octave.txt, on the contributed docs section of CRAN.
> >
> >
> > HTH
> >
> > Robin
> >
> > --
> > Robin Hankin
> > Uncertainty Analyst
> > National Oceanography Centre, Southampton
> > European Way, Southampton SO14 3ZH, UK
> >  tel  023-8059-7743
> >
> 
> Thanks for the response Robin, but that document doesn't help me with  
> either my quest for plot3, or multiple figures (i.e. the 'figure'  
> command in Octave/Matlab).
> 
> cheers,
> Wee-Jin

If you want three separate graphics windows (Devices) then,

X11() # not really needed as plot() will produce a new device if none is
  # open
plot(1:10)
X11()
plot(1:10)
X11()
plot(1:10)
...

Will create a new device. see ?Devices for a list of devices you can
open on your system or ?capabilities . It is so long since I used a
Windows version of R, that I forget if X11() opens a Windows graphics
device there as well.

As for 3D stuff, you might take a look at persp() (in base R) and the
scatterplot3D package. If you want to see what R's Graphics can do, then
the book R Graphics by Paul Murrell [1] will tell you all you need to
know, and the excellent, online R graphics gallery [2] has lots of
examples.

HTH

G

[1] http://www.stat.auckland.ac.nz/~paul/RGraphics/rgraphics.html
[2] http://addictedtor.free.fr/graphiques/
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 *Note new Address and Fax and Telephone numbers from 10th April 2006*
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [t] +44 (0)20 7679 0522
ECRC  [f] +44 (0)20 7679 0565
UCL Department of Geography
Pearson Building  [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street
London, UK[w] http://www.ucl.ac.uk/~ucfagls/cv/
WC1E 6BT  [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 convert all columns of a data frame into factors

2006-10-04 Thread Gavin Simpson
On Wed, 2006-10-04 at 11:33 -0400, Weiwei Shi wrote:
> Hi,
> 
> I use "apply"
> apply(x, 2, factor)
> 
> but it does not work. please help. thanks.
> 

In what sense does it not work? And how can you possibly expect anyone
on this list to help you as you neither supply the error message you
received nor provide us with x or a reproducible example, nor tell us
what you want to achieve.

E.g.

dat <- sample(LETTERS, 100, replace = TRUE)
dat <- matrix(dat, ncol = 10)
dat
apply(dat, 2, factor)

which appears to be converting a character vector into a factor, which
is then coerced to a numeric vector (as there are only numeric and
character matrices in R) - but I may be wrong:

as.numeric(factor(dat[,1]))
 [1] 7 7 2 5 8 1 4 7 3 6

which is the first column of the object returned by apply(dat, 2,
factor). Is this not what you wanted?

So perhaps you could provide the list with some further information as
you are asked to in the posting guide!

HTH

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

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


Re: [R] how to convert all columns of a data frame into factors

2006-10-04 Thread Gavin Simpson
On Wed, 2006-10-04 at 17:04 +0100, Gavin Simpson wrote:
> On Wed, 2006-10-04 at 11:33 -0400, Weiwei Shi wrote:
> > Hi,
> > 
> > I use "apply"
> > apply(x, 2, factor)
> > 
> > but it does not work. please help. thanks.
> > 

Ah, lesson one: read the email clearly before replying - just like my
old Geography teacher used to tell me!

This works

dat <- sample(LETTERS, 100, replace = TRUE)
# use a data. frame not a matrix
dat <- data.frame(matrix(dat, ncol = 10))
dat
lapply(dat, factor) # as a list
# or, as a data.frame
data.frame(lapply(dat, factor))

G

> 
> In what sense does it not work? And how can you possibly expect anyone
> on this list to help you as you neither supply the error message you
> received nor provide us with x or a reproducible example, nor tell us
> what you want to achieve.
> 
> E.g.
> 
> dat <- sample(LETTERS, 100, replace = TRUE)
> dat <- matrix(dat, ncol = 10)
> dat
> apply(dat, 2, factor)
> 
> which appears to be converting a character vector into a factor, which
> is then coerced to a numeric vector (as there are only numeric and
> character matrices in R) - but I may be wrong:
> 
> as.numeric(factor(dat[,1]))
>  [1] 7 7 2 5 8 1 4 7 3 6
> 
> which is the first column of the object returned by apply(dat, 2,
> factor). Is this not what you wanted?
> 
> So perhaps you could provide the list with some further information as
> you are asked to in the posting guide!
> 
> HTH
> 
> G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC & ENSIS, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [R] " Error in "names<-.default"

2006-10-04 Thread Gavin Simpson
On Wed, 2006-10-04 at 16:07 +0100, nalluri pratap wrote:
> Hi All,
>
>   Can some one explain me the following error-
>
>   " Error in "names<-.default"
>   'names' attribute [1199] must be the same length as the vector [17]".
>
>   Thanks,
>   Pratap

You haven't shown us what you did, but it looks like you tried to
replace the names of an object with a vector (of length 1199) when a
vector of length 17 was required. See this example:

dat <- as.data.frame(matrix(rnorm(100), ncol = 10))
names(dat) <- LETTERS[1:10]
names(dat)
 [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J"
names(dat) <- LETTERS
Error in `names<-.default`(`*tmp*`, value = c("A", "B", "C", "D", "E",  :
'names' attribute [26] must be the same length as the vector [10]

Where I have tried to replace names(dat) (which should be of length 10)
with a vector of length 26 (all the letters A-Z).

The error message above is not the same as the one you show though, so
this might not be the problem. As the posting guide asks, please give a
reproducible example or provide enough information for us to help you.

HTH

G

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

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


Re: [R] Tabulation and missing values

2006-10-04 Thread Gavin Simpson
On Thu, 2006-10-05 at 05:10 +1300, David Scott wrote:
> I think this is one for Gabor. I don't seem to be able to find my way to 
> an answer despite numerous rereadings of factor and table.
> 
> Here is a toy example:
> 
> 
> ### Some data
> EthnicCode <- c("European/Other", NA, "European/Other", "European/Other",
>  "Pacific", "European/Other", "European/Other",
>  "European/Other", "Maori", "Maori", "European/Other",
>  "European/Other", "Asian", "Pacific")
> ### I don't want the categories in the default order
> ### I also want to be able to include or exclude NA
> ### argument exclude controls inclusion of NA
> table(EthnicCode)
> table(EthnicCode,exclude=NULL)
> ### Creating a factor allows reordering
> EthnicFactor <- factor(EthnicCode, exclude="")
> levels(EthnicFactor) <- list("Maori"="Maori","Pacific"="Pacific",
>  "Asian"="Asian",
>  "Europ/Other"="European/Other",
>  is.na="NA")
   ^^^

Are you sure you want that last entry. You are basically creating a
level "is.na", for those entries that have character "NA" (not same as
NA). When you use

table(EthnicFactor[,drop=TRUE])

you are dropping empty levels, not dropping NAs which is why your
self-inflicted is.na disappears, but not when you use exclude=NULL,
which I don't get either, as ?table has exclude = c(NA, NaN) not NULL.

Just do:

table(factor(EthnicCode))

but that loses the NAs in the factor created (see ?factor and argument
exclude). Compare:

dat <- factor(EthnicCode)
dat
# preserves NAs as a level
dat2 <- factor(EthnicCode, exclude = "")
dat2

table(dat)
table(dat2) # NAs as a level & displayed
table(dat2, exclude = NA) # no NAs

Is that what you were looking for?

HTH

G

> ### I can tabulate with categories in the desired order
> table(EthnicFactor[,drop=TRUE])
> ### But I can't seem to include the missing observations
> table(EthnicFactor,exclude=NULL)
> 
> David Scott

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

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


Re: [R] convert vector to matrix

2006-10-04 Thread Gavin Simpson
On Wed, 2006-10-04 at 21:50 +0100, nalluri pratap wrote:
> Hi All,
>
>
>   I have vector containing 10 elements(odservations). I need to put
> this into a matrix, where the matrix should contain only one column.
> I need this to be done using the cbind command because in the final
> table I should have a column of attributes( from adifferent vector)
> and a column of vectors from the matrix above
> 
>   Please suggest me how this can be done
>
>   Thanks and Regards,
>   Pratap

Did you even try to use cbind on your vector? I guess not as,

> vec <- 1:10
> mat <- cbind(vec)
> mat
  vec
 [1,]   1
 [2,]   2
 [3,]   3
 [4,]   4
 [5,]   5
 [6,]   6
 [7,]   7
 [8,]   8
 [9,]   9
[10,]  10
> class(mat)
[1] "matrix"

clearly shows it is possible.

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 *Note new Address and Fax and Telephone numbers from 10th April 2006*
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [t] +44 (0)20 7679 0522
ECRC  [f] +44 (0)20 7679 0565
UCL Department of Geography
Pearson Building  [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street
London, UK[w] http://www.ucl.ac.uk/~ucfagls/cv/
WC1E 6BT  [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [R] convert vector to matrix

2006-10-04 Thread Gavin Simpson
On Wed, 2006-10-04 at 19:55 -0200, Alberto Monteiro wrote:
> Gavin Simpson wrote:
> > 
> > Did you even try to use cbind on your vector? I guess not as,
> > 
> > > vec <- 1:10
> > > mat <- cbind(vec)
> > > mat
> >
> Why does mat remain a matrix instead of "losing" one dimension?
> I am reading the FAQ at...
> http://cran.us.r-project.org/doc/FAQ/R-FAQ.html#Why-do-my-matrices-lose-
> dimensions_003f
> ... and it seems that anything you do to mat should turn it back
> into a one-dimensional vector.

Dear Alberto,

That FAQ is referring to subsetting a matrix, and as yet, the code above
has not subsetted mat at all - indeed, we have only created it and then
examined it's class, if we were to now look at rows 2:5, then we'd see
that mat loses a dimension and reverts to a vector:

> vec <- 1:10
> mat <- cbind(vec)
> mat
  vec
 [1,]   1
 [2,]   2
 [3,]   3
 [4,]   4
 [5,]   5
 [6,]   6
 [7,]   7
 [8,]   8
 [9,]   9
[10,]  10
> mat[2:5,]
[1] 2 3 4 5
> vec[2:5]
[1] 2 3 4 5
> class(mat[2:5,])
[1] "integer"
> class(vec[2:5])
[1] "integer"
> all.equal(mat[2:5,], vec[2:5])
[1] TRUE

To preserve dimensions, we use drop = FALSE, as discussed in the FAQ you
quote: 

> mat[2:5, , drop = FALSE]
 vec
[1,]   2
[2,]   3
[3,]   4
[4,]   5
> class(mat[2:5, , drop = FALSE])
[1] "matrix"

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 *Note new Address and Fax and Telephone numbers from 10th April 2006*
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [t] +44 (0)20 7679 0522
ECRC  [f] +44 (0)20 7679 0565
UCL Department of Geography
Pearson Building  [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street
London, UK[w] http://www.ucl.ac.uk/~ucfagls/cv/
WC1E 6BT  [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] VGAM Package ?

2006-10-05 Thread Gavin Simpson
On Thu, 2006-10-05 at 11:39 +0200, KOITA Lassana - STAC/ACE wrote:
> 
> 
> 
> Hi!  R users
> I would like to ask you where could we find the VGAM Package. I don't find
> it in the list of packages.
> 
> Thak you for your help
> 
> 
> Lassana KOITA

That's because it isn't on CRAN yet. You can find a link to VGAM on the
Environmetrics Task View:

http://www.stats.bris.ac.uk/R/src/contrib/Views/Environmetrics.html

HTH

G

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

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


Re: [R] "which" command

2006-10-05 Thread Gavin Simpson
On Thu, 2006-10-05 at 16:57 -0400, AgusSusanto wrote:
> I obtained error messages when I run these commands in UNIX, but I 
> obtained correct result when I run these command in WINDOWS.  Can 
> somebody point out the problem and give the solution. Thanks.

Not without Fall.dat I suspect. please read the posting guide and act
accordingly. (And why post twice?)

I suspect some of your data are missing in Fall.dat (or end up missing
because you didn't check what had been read in by R) and that this has
propagated warnings in say mean, when called within na.rm = TRUE. But
I'm guessing as you fail to provide a reproducible example.

Why this is different between Unix/windows versions of R, I don't know,
but are they running the same versions of R?

G

> 
>  > dt<-read.table(file="Fall.dat")
>  > dim(dt)
> [1] 19415
>  > table(dt$V2)
>   0   1   2   3
> 220 989 639  93
>  >
>  > Favg<-as.matrix(c(1:max(dt$V2)))
>  >
>  > for(i in 1:max(dt$V2)){Favg[i]<-mean(dt[which(dt[,2] == i),5])}
>  > Favg
>  [,1]
> [1,]   NA
> [2,]   NA
> [3,]   NA
> Warning messages:
> argument is not numeric or logical: returning NA (etc)
> 
> 
> 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
> and provide commented, minimal, self-contained, reproducible code.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 *Note new Address and Fax and Telephone numbers from 10th April 2006*
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [t] +44 (0)20 7679 0522
ECRC  [f] +44 (0)20 7679 0565
UCL Department of Geography
Pearson Building  [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street
London, UK[w] http://www.ucl.ac.uk/~ucfagls/cv/
WC1E 6BT  [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] [Mac OS X 10.4] object R_loess_raw not found

2006-10-09 Thread Gavin Simpson
On Mon, 2006-10-09 at 13:25 +0200, René J.V. Bertin wrote:
> Hello,
> 
> Since I (finally) upgraded to 10.4 "Tiger", I've been experiencing
> some strange behaviour with dynamic libraries.
> 
> When I now launch R, and try to use the loess() function from the
> stats package, I get the following:
> 
> > R

Seems you have a .RData lurking in he directory you started R from. This
might be causing the problem.

Try:

R --vanilla

example(loess)

and see if it works then. It works fine for me on Linux (FC5) for
example in a clean workspace. Apologies if this is a red herring and
works fine with --vanilla.

G

> 
> R version 2.4.0 (2006-10-03)
> Copyright (C) 2006 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
> 
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
> 
>   Natural language support but running in an English locale
> 
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
> 
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
> 
> [Previously saved workspace restored]
> 
> > example(loess)
> 
> loess> cars.lo <- loess(dist ~ speed, cars)
> Error: object "R_loess_raw" not found
> 
> 
> I saw this first with a self-built 2.3.1 version, that worked fine
> under 10.3 . Hoping that a Tiger build would solve matters, I
> installed the fresh 2.4.0 from the downloaded disk image. As you can
> see, the error message persists.
> 
> Curiously, the ppc/stats.so file somewhere deep in the 2.4 framework's
> bowels does contain a symbol loess_raw, but not R_loess_raw. I wrote a
> quick C app that dlopens a .so file and then tries to obtain a given
> symbol from it using dlsym. I can't seem to get any of the defined
> symbol from stats.so . I'd say my little loader is broken somewhere,
> BUT ...
> 
> This does remind me of a problem I had with a Python module
> (pygame/constants), where the expected init function (initconstants)
> was available but invisible to dlsym(). In that case, changing the
> module (and init function's) name solved the issue, I still don't
> understand why.
> 
> This is really annoying, so if anyone has an idea about what might be
> going on, I'd appreciate the feedback!
> 
> BTW, I did try building my own copy, but for some reason, the
> configure/build process ignores the optimised BLAS in the vecLib
> framework ...
> 
> 
> René Bertin
> (PS: please CC me via email if you reply)
> 
> ______
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC & ENSIS, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [R] Help on direction of axis in R needed

2006-10-11 Thread Gavin Simpson
On Wed, 2006-10-11 at 02:27 -0700, Silvia Lipski wrote:
> Hi!
> 
> I'd like to plot things with axes going from the
> highest to the lowest value, so that e.g. high values
> on the xaxis are plotted to the left and low values to
> the right.
> Could anyone tell me how this is done? I couldn't find
> anything in the documentation.
> 
> Thanks a lot!
> Silli

Look at ?plot.default and in particular argument 'xlim', which take two
settings, effectively from and to, (e.g. xlim = c(100, 1) will give x
axis drawn from 100 on left to 1 on right)

plot(1:100, 1:100, xlim = c(175, 0))

Where we don't know the range of data explicitly, we can use for example
range() to get the min and max of the data and then rev() to reverse
these, as the example below shows:

xdat <- rnorm(100)
ydat <- runif(100)
plot(ydat ~ xdat, xlim = rev(range(xdat)))

The See Also section of ?plot would have pointed you to ?plot.default...

HTH

G

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

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


  1   2   3   4   >