Re: [R] The gradient of a multivariate normal density with respect toits parameters

2009-06-24 Thread Karl Ove Hufthammer
Ravi Varadhan:

> You may want to look at the paper by Dwyer on "Some applications of matrix
> derivatives in multivariate analysis" (JASA 1967), especially the Table 2
> on p. 617.

Thanks! That’s a *very* useful paper. Note there also is a small corrigenda 
available:

Corrigenda: Some Applications of Matrix Derivatives in Multivariate Analysis
Paul S. Dwyer
Journal of the American Statistical Association, Vol. 62, No. 320 (Dec., 1967), 
p. 1518
Stable URL: http://www.jstor.org/stable/2283811

-- 
Karl Ove Hufthammer

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


[R] [R-pkgs] RImageJ initial release

2009-06-24 Thread Romain Francois

Hello,

I've uploaded the initial release (0.0-142) of the RImageJ package to CRAN.
The package allows R to use the facilities of the java based image 
processing and analysis platform ImageJ.


See also the announcement on my blog, with a very simple example showing 
how to use the package:
http://romainfrancois.blog.free.fr/index.php?post/2009/06/22/using-ImageJ-from-R%3A-the-RImageJ-package 



The package is currently very simple (5 lines of R code !) but 
additional features (such as an implementation of the java graphics 
device on top of imagej) are planned.


Romain

--
Romain Francois
Independent R Consultant
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr

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

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


Re: [R] Model fitting with GAM and "by" term

2009-06-24 Thread Gavin Simpson
On Tue, 2009-06-23 at 14:18 -0400, Paul Simonin wrote:
> Hello R Users,
>  I have a question regarding fitting a model with GAM{mgcv}. I have data 
> from several predictor (X) variables I wish to use to develop a model to 
> predict one Y variable. I am working with ecological data, so have data 
> collected many times (about 20) over the course of two years. Plotting 
> data independently for each date there appears to be relationships 
> between Y (fish density) and at least several X variables (temperature 
> and light). However, the actual value of X variables (e.g., temperature) 
> changes with date/season. In other words, fish distribution is likely 
> related to temperature, but available temperatures change through the 
> season. Thus, when data from all dates are combined to create a model 
> from the entire dataset, I think I need to include some type of 
> metric/variable/interaction term to account for this date relationship. 
> I have written the following code using a "by" term:

A by smooth like this will produce a varying coefficient model, where a
separate smooth is fitted to the levels of the by variable. As unique
datecodes becomes large, this may be inefficient for the purposes you
have in mind - which as per several of your recent emails appears, is to
fit an interaction.

In mgcv, interactions can be fitted using a bivariate smooth of the two
variables of interest. Without your data or information on the structure
of datecode, it is difficult to suggest exactly how to proceed (and
perhaps why you haven't received replies to your postings), but if
datecode represents the day-of-year or the month (expressed as a
numeric) in which sampling took place, then an interaction between
datecode and temperature could be achieved using a tensor product
smooth:

te(temperature, datecode, bs = c("cr","cc"))

I use a tensor product as we do not expect isotropy and the two
variables are on different scales. The bs species that temperature is a
cubic regression spline and that datecode is a cyclic cubic regression
spline so the end points join (i.e. you want smooth transition from
December to January). If your datecode variable does not got from month
1 (day-of-year 1) to month 12 (day-of-year 365(6)) then you might want
to specify the end-points so this smooth covers the full year. In your
call to gam, add argument 'knots'.

## for datecode === day-of-year one might use
knots = list(datecode = c(1, 365))
## for datecode === month, one might use
knots = list(datecode = c(1, 12))

i.e. with recent versions of mgcv (1.5-x branch) you can specify only
the start and end points of the smooth and gam fills in the knots up to
the chosen or default value of 'k' (the number of knots).

The te() smooth also needs version 1.5-5 of mgcv as there was a bug in
the code when setting up "cc" smooths in te() smooths that is fixed in
that version.

> 
> Distribution.s.temp.logwm2.deltaT<-gam(yoyras~s(temp,by=datecode)+s(logwm2,by=datecode)+s(DeltaT,by=datecode),data=AllData)
>  

This seems completely over-specified -  you are asking the model to
estimate separate smooths for each value of datecode for each of three
covariates. You'll need lots of data to fit such a model.

> 
>  However, I am not convinced this is the correct way to account for this 
> relationship. What do you think? Is there another way to include this in 
> my model? Maybe I should simply include date ("datecode") as another 
> term in the model?
> 
>  I also believe there may be an interaction between temperature and 
> light (logwm2), and based on what I have read the "by" method may be the 
> best way to include this. Correct?

In that case, temp, datecode and light will all be related via
interaction. te() smooths can take more than two covariates, so you
could try fitting a smooth on all three, but you are starting off with
quite a complicated model here.

I think, in general, interactions are fitted via multivariate smooths of
the variables of interest, not using by variables.

HTH

G

> 
>  Thank you for any input, tips, or advice you may be able to offer. I am 
> new to R, so especially grateful!
> 
> Thanks again,
> Paul Simonin
> (PhD student)
> 
> PS- If you would like additional information let me know. Also, if this 
> question is inappropriate for the help list please let me know.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%

Re: [R] gradually switching regression

2009-06-24 Thread Vito Muggeo (UniPa)

Hi,
Although Bacon&Watts (1971) assume a transition, the aim is to estimate 
the breakpoint where the linear relationship changes. The start- and 
end-point of the transition phase are not parameters to estimate ; it is 
a trick to estimate the model.


As a possible alternative, you could have a look to package segmented 
where pure piecewise straight-lines are fitted..


Hope this helps you..
vito

Benjamin Volland ha scritto:

Hello,
I'm trying to find an algorithm to estimate a switching regression model 
based on the 1990 Economics Letters paper by Ohtani/Kakimoto/Abe or the 
earlier version from 1985 (Ohtani/Katayama, Economic Studies Quarterly; 
assuming as a transition path a polynomial of order 1).


I found an idea for using nls here: 
http://www.biostat.wustl.edu/archives/html/s-news/2000-04/msg00223.html. 
Unfortunately it's based on the 1971 Bacon&Watts model, which does not 
allow obtaining explicitly both start- and end-point of the transition 
phase. If anyone stumbled across such a function or has suggestions on 
how to do it, I would greatly appreciate hearing about them.


Thanks so much
Ben Volland

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

and provide commented, minimal, self-contained, reproducible code.



--

Vito M.R. Muggeo
Dip.to Sc Statist e Matem `Vianelli'
Università di Palermo
viale delle Scienze, edificio 13
90128 Palermo - ITALY
tel: 091 6626240
fax: 091 485726/485612
http://dssm.unipa.it/vmuggeo

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


Re: [R] Customize axis labels in xyplot

2009-06-24 Thread nmset

I found indeed that there were no attachements yesterday and corrected the
mistake.

They are in my previous post.

Thanks.
-- 
View this message in context: 
http://www.nabble.com/Customize-axis-labels-in-xyplot-tp24126788p24180049.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Lempel—Ziv complexity

2009-06-24 Thread Thom_249

Hi

I'm lookoing for a R-plugin to compute the Lempel-Ziv complexity. Does
anyone have still heard about this algorithme?

Regards
-- 
View this message in context: 
http://www.nabble.com/Lempel%E2%80%94Ziv-complexity-tp24181807p24181807.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] vector size

2009-06-24 Thread ogbos okike
Hi,
I have a data of size 981.1MB(1028707715) and I intend to calculate the
length of the data using tapply function in R. I was able to read the data
into R but when I tried to use the factor function, I had an error message
"Error: cannot allocate vector of size 2.0 Gb".
Can anybody tell me what to do? I have tried to increase the size of the
memory but I am not sure if R recognizes it as the error message persists.
Is there any other thing I need to do for R to recognize the memory
increase?
Thank you so much for any help.
Ogbos

[[alternative HTML version deleted]]

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


[R] CRAN: 64 bit OS X Leopard build

2009-06-24 Thread Daniel Brewer
Hello,

I am after a stable 64 bit binary of R for OS X Leopard (i.e. 2.8).
There seems to be the siggestion that thery should be available from CRAN:
"leopardBinaries of universal (32-bit and 64-bit) package builds for
Mac OS X 10.5 or higher"

But when I follow the link there is only a contrib directory which seems
to contain libraries only.

Can anyone help?

Thanks

Dan

The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the a...{{dropped:2}}

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


Re: [R] vector size

2009-06-24 Thread Uwe Ligges



ogbos okike wrote:

Hi,
I have a data of size 981.1MB(1028707715) and I intend to calculate the
length of the data using tapply function in R. I was able to read the data
into R but when I tried to use the factor function, I had an error message
"Error: cannot allocate vector of size 2.0 Gb".
Can anybody tell me what to do? I have tried to increase the size of the
memory but I am not sure if R recognizes it as the error message persists.
Is there any other thing I need to do for R to recognize the memory
increase?



My guess is that this is a 32-bit version of R?
You need some 64-bit OS and 64-bit R or try to decrease the amount/size 
of objects that are in the same time in your memory.


Best,
Uwe Ligges



Thank you so much for any help.
Ogbos

[[alternative HTML version deleted]]

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


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


Re: [R] implementing Maximum Likelihood with distrMod when only the PDF is known

2009-06-24 Thread Matthias Kohl

Dear Guillaume,

retrospectively, I'm not sure if the decision to have spezial initialize 
methods is the optimal way to go. In distrMod and our other packages on 
robust statistics we don't introduce special initialize methods, but use 
so-called generating functions. This approach has the advantage that the 
default initialize method can be used for programming where I find it 
very useful.


I would say it is the canonical (and recommended) way to first define a 
function as generic (like mu) and then implement methods for it.


Choosing names for which there is already an existing definition for a 
generic function may also not be what you want in general. By defining 
new methods you have to respect the definition of the generic function; 
that is, your method definition has to be with respect to the arguments 
in the given generic function and also dispatching will be on these 
arguments (cf. scale in the distrMod example).


In defining our classes we decided that at least the slot "r" has to be 
filled (of class "function") whereas d, p and q are of class 
"OptionalFunction". Hence, there are functions to fill d, p and q for 
given r but, so far not for filling r, p and q given d.


A way to avoid implementing r is given in
http://www.stamats.de/distrModExample1.R

I also do not fill the slots p and q in this example. This avoids the 
simulation of a large random sample and speeds up the computation of the 
MLE.


However, this is rather a quick and dirty solution and it would of 
course be better to have a valid definition for r, d, p and q.


Best,
Matthias


guillaume.martin schrieb:

Dear Mathias,
That's pretty amazing, thanks a lot ! I'll have to look all this 
through because I don't easily understand why each part has to be set 
up, in particular the "initialize method" part seems crucial and is 
not easy to intuit. From what I get, the actual name we give to a 
parameter (my original "mu" for example) is important in itself, and 
if we introduce new variable names we have to define a new generic, 
right? The simplest option then is to re-use an existing variable name 
that has the same properties/range, right?


Another general question: my actual pdf is of the same type but not 
the exact same as the skew normal. In particular, I don't have a rule 
for building the slot r (eg the one borrowed from the sn package in 
your example); is it a problem? isn't it sufficient to give slot d, 
and then you have automatic methods implemented to get from d() to r() 
slots etc. is that right?


Thanks a lot for your help and time !

Best,

Guillaume


Matthias Kohl a écrit :

Dear Guillaume,

thanks for your interest in the distrMod package.

Regarding your question I took up your example and put a file under:

http://www.stamats.de/distrModExample.R

Hope that helps ...

Don't hesitate to contact me if you have further questions!

Best,
Matthias

guillaume.martin schrieb:

Dear R users and Dear authors of the distr package and sequels

I am trying to use the (very nice) package distrMod as I want to 
implement maximum likelihood (ML) fit of some univariate data for 
which I have derived a theoretical continuous density (pdf). As it 
is a parametric density, I guess that I should implement myself a 
new distribution of class AbscontDistributions (as stated in the pdf 
on "creating new distributions in distr"), and then use 
MLEstimator() from the distrMod package. Is that correct or is there 
a simpler way to go? Note that I want to use the distr package 
because it allows me to implement simply the convolution of my 
theoretical pdf with some noise distribution that I want to model in 
the data, this is more difficult with fitdistr or mle.
It proved rather difficult for me to implement the new class 
following all the steps provided in the example, so I am asking if 
someone has an example of code he wrote to implement a parametric 
distribution from its pdf alone and then used it with MLEstimator().


I am sorry for the post is a bit long but it is a complicate 
question to me and I am not at all skillful in the handling of such 
notions as "S4 - class", etc.. so I am a bit lost here..


As a simple example, suppose my theoretical pdf is the skew normal 
distribution (available in package sn):


#skew normal pdf (default values = the standard normal N(0,1)

fsn<-function(x,mu=0,sd=1,d=0) {u = (x-mu)/sd;  f = 
dnorm(u)*pnorm(d*u); return(f/sd)}


# d = shape parameter (any real), mu = location (any real), sd = 
scale (positive real)


#to see what it looks like try
x<-seq(-1,4,length=200);plot(fsn(x,d=3),type="l")

#Now I tried to create the classes "SkewNorm" and 
"SkewNormParameter" copying the example for the binomial

##Class:parameters
setClass("SkewNormParameter",
representation=representation(mu="numeric",sd="numeric",d="numeric"),
prototype=prototype(mu=0,sd=1,d=0,name=gettext("Parameter of the 
Skew Normal distribution")),

contains="Parameter"
)

##Class: distribution (created using the pdf

[R] Found the stable 64bit OS X leopard builds

2009-06-24 Thread Daniel Brewer
Hi,

I have found the stable 64bit OS X leopard builds here:
http://r.research.att.com/

Dan

-- 
**
Daniel Brewer, Ph.D.

Institute of Cancer Research
Molecular Carcinogenesis
Email: daniel.bre...@icr.ac.uk
**

The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the a...{{dropped:2}}

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


[R] nlme package - unbalanced data and Croissant (2008)

2009-06-24 Thread Millo Giovanni
Dear Anthony:

please please! I didn't say 'nlme' "[does] not produce sensible / accurate 
results", nor did I ever mean it. 

The sentence you quote is an unfortunate mistake on my part, and like most 
unfortunate mistakes it first went unnoticed and then ended up in a most 
visible part of the paper. I originally meant to say that 'nlme' doesn't want 
missing values, and ended up saying that it doesn't accept unbalanced panels, 
which is false but is also different from saying that it produces inaccurate 
results. Besides, in the remainder of the paper we use (and acknowledge) a lot 
of functionality from 'nlme' on unbalanced panels as well (e.g. the Baltagi and 
Li test).

For the reasons why there is a 'plm' package (simple models, semiparametric 
methods, LS-GLS based, sampling problems typical of econometrics) next to 
'nlme' (more complex specifications possible, parametric, ML-based) please see 
section 7 of the same paper. 

For an example of how an econometrician may misunderstand mixed models, well I 
think I just gave you one. I knew I was stepping into a minefield as I spoke of 
other people's work but I still consider this better than keeping panel data 
econometricians and mixed models statisticians on two separate tracks, ignoring 
all the functionality that was "on the other side".

My apologies to the authors of 'nlme' (and 'lme4' as well). I owe you a beer, 
payable at the useR! in two weeks if you like.

Best,
Giovanni

# original message ###

--

Message: 61
Date: Tue, 23 Jun 2009 11:06:54 -0400
From: "Anthony A. Pezzola" 
Subject: [R] nlme package - unbalanced data and Croissant (2008)
To: 
Message-ID: <965a9da1a12c41e7a0b4fd723b346...@usuario>
Content-Type: text/plain

Dear listserv members,



In Croissant (2008) "Panel Data Econometrics in R: The plm Package" the
authors seem to indicate that the nlme package for R cannot correctly handle
unbalanced panel data: "Moreover, economic panel datasets often happen to be
unbalanced (i.e., they have a different number of observations between
groups), which case needs some adaptation to the methods and is not
compatible with those in nlme" (pg. 2, Croissant 2008).  However in Pinhiero
and Bates (2000, pg 24) the authors state that the lme() does generate
sensible Ml and REML estimates for unbalanced data.  



I would greatly appreciate any insight into how and when the nlme package or
functions within it do not produce sensible / accurate results.



Sincerely,

Anthony Pezzola

---

Anthony A. Pezzola
apezz...@uc.cl
(02) 354-7823
Profesor de Ciencia Política
Instituto de Ciencia Política
Pontificia Universidad Católica de Chile
Santiago de Chile

 end original message ##

Giovanni Millo
Research Dept.,
Assicurazioni Generali SpA
Via Machiavelli 4, 
34132 Trieste (Italy)
tel. +39 040 671184 
fax  +39 040 671160

Ai sensi del D.Lgs. 196/2003 si precisa che le informazi...{{dropped:13}}

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


[R] lattice wireframe within a loop ???

2009-06-24 Thread Thomas Roth (geb. Kaliwe)

Hi,

I have the following problem. Calling wireframe within a loop results 
into an empty window(s)


#generate some data
temp = expand.grid(A = 1:3,B = 1:3)
temp = cbind(temp, y1 = rnorm(9))
temp = cbind(temp, y2 = runif(9))


#plot y1 and y2 in two different windows
for(i in 1:2)
{
wireframe(y1 ~ A*B, temp, shade =T)
windows()
wireframe(y2 ~ A*B, temp, shade =T)
}


#However, calling it twice outside a loop works?

wireframe(y1 ~ A*B, temp, shade =T)
windows()
wireframe(y2 ~ A*B, temp, shade =T)


Obviously i'm missing something. How can i call wireframe more than one 
time in a loop and get a wireframe?



Greetings

Thomas Roth

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


Re: [R] values in graph points

2009-06-24 Thread Jim Lemon

Hi Romildo,
thigmophobe.labels in the plotrix package might do what you want:

thigmophobe.labels(x,y,labels=y,...)

I have just had a bug report, so if you have any NA or NaN values in 
your x and y coordinates, wait for version 2.6-2


Jim

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



Re: [R] CRAN: 64 bit OS X Leopard build

2009-06-24 Thread Uwe Ligges



Daniel Brewer wrote:

Hello,

I am after a stable 64 bit binary of R for OS X Leopard (i.e. 2.8).
There seems to be the siggestion that thery should be available from CRAN:
"leopard   Binaries of universal (32-bit and 64-bit) package builds for
Mac OS X 10.5 or higher"


It says "package build" which means there are the contributed CRAN 
packages (roughly 1800 of them).
Not sure which libraries you have seen. We generally do not publish any 
library directories on CRAN (hence I suspect you are confusing libraries 
and packages).


The R for MacOS binaries are available from
CRAN-mirror/bin/macosx/

which has a link to the Leopard binary (ít says "This binary was tested 
on both Mac OS X 10.4 (Tiger) and Mac OS X 10.5 (Leopard).") at

CRAN-mirror/bin/macosx/R-2.9.0.dmg

Best,
Uwe Ligges





But when I follow the link there is only a contrib directory which seems
to contain libraries only.

Can anyone help?

Thanks

Dan

The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the a...{{dropped:2}}

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


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


Re: [R] lattice wireframe within a loop ???

2009-06-24 Thread ONKELINX, Thierry
You need to print() lattice plots inside a loop or a function. 




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

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey

-Oorspronkelijk bericht-
Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
Namens Thomas Roth (geb. Kaliwe)
Verzonden: woensdag 24 juni 2009 13:08
Aan: 'r-help@r-project.org'
Onderwerp: [R] lattice wireframe within a loop ???

Hi,

I have the following problem. Calling wireframe within a loop results
into an empty window(s)

#generate some data
temp = expand.grid(A = 1:3,B = 1:3)
temp = cbind(temp, y1 = rnorm(9))
temp = cbind(temp, y2 = runif(9))


#plot y1 and y2 in two different windows for(i in 1:2) {
wireframe(y1 ~ A*B, temp, shade =T)
windows()
wireframe(y2 ~ A*B, temp, shade =T)
}


#However, calling it twice outside a loop works?

wireframe(y1 ~ A*B, temp, shade =T)
windows()
wireframe(y2 ~ A*B, temp, shade =T)


Obviously i'm missing something. How can i call wireframe more than one
time in a loop and get a wireframe?


Greetings

Thomas Roth

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

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.

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


[R] vertical label on x-axis

2009-06-24 Thread Christian Schulz

Hi,

have anybody a hint how it's possible plot the labels in the x-axis  
vertical to get more space.
dotplot( value ~ 
abbreviate(attribute,minlength=3),data=tabstat10,ylim=c(0,1),col="blue",ylab="Value",type="p",par.settings=my.theme)


Many thanks,
Christian

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


Re: [R] CRAN: 64 bit OS X Leopard build

2009-06-24 Thread Prof Brian Ripley
This thread really belongs on R-sig-mac!  I am answering here since if 
people are going to ask here, some general information would be 
appropriate, but PLEASE follow up only on R-sig-mac.


The CRAN Mac OS X page is a little confusing.  The main CRAN 
distribution of R is for Mac OS X 10.4 and later and has i386 and ppc 
architectures.  That is what is in R-2.9.0.dmg, and the appropriate 
binary packages are in the subdirectory 'universal'.


Then there are builds on http://r.research.att.com/.  These include a 
'leopard build' at http://r.research.att.com/R-2.9.0.pkg, which has 
i386, x86_64, ppc and ppc64 architectures.  The confusion is that the 
'leopard' directory on CRAN has binary packages for *that* build. 
(Note that the r-release and r-devel links are outdated in that 
directory.)


Note that there are no distributed '64 bit builds': each build has a 
collection of architectures.


However, as far as I recall (I normally use my own builds, including 
for x86_64), you do not need to know where the binary packages are, 
since the R.app 'Package Installer' menu item and install.packages() 
have the correct repositories pre-set.  If that is not working, you 
need to set options(pkgType="mac.binary.leopard") (see ?options and 
?install.packages).


On Wed, 24 Jun 2009, Uwe Ligges wrote:




Daniel Brewer wrote:

Hello,

I am after a stable 64 bit binary of R for OS X Leopard (i.e. 2.8).
There seems to be the siggestion that thery should be available from CRAN:
"leopard   Binaries of universal (32-bit and 64-bit) package builds for
Mac OS X 10.5 or higher"


It says "package build" which means there are the contributed CRAN packages 
(roughly 1800 of them).
Not sure which libraries you have seen. We generally do not publish any 
library directories on CRAN (hence I suspect you are confusing libraries and 
packages).


The R for MacOS binaries are available from
CRAN-mirror/bin/macosx/

which has a link to the Leopard binary (ít says "This binary was tested on 
both Mac OS X 10.4 (Tiger) and Mac OS X 10.5 (Leopard).") at

CRAN-mirror/bin/macosx/R-2.9.0.dmg

Best,
Uwe Ligges





But when I follow the link there is only a contrib directory which seems
to contain libraries only.

Can anyone help?

Thanks

Dan

The Institute of Cancer Research: Royal Cancer Hospital, a charitable 
Company Limited by Guarantee, Registered in England under Company No. 
534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP.


This e-mail message is confidential and for use by the a...{{dropped:2}}

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

and provide commented, minimal, self-contained, reproducible code.


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



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] vertical label on x-axis

2009-06-24 Thread Christian Schulz

I get it :
scales=list(x=list(rot=90))
Cheers, Christian


Hi,

have anybody a hint how it's possible plot the labels in the x-axis  
vertical to get more space.
dotplot( value ~ 
abbreviate(attribute,minlength=3),data=tabstat10,ylim=c(0,1),col="blue",ylab="Value",type="p",par.settings=my.theme) 



Many thanks,
Christian




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


[R] subsetting data frame using a vector of column names / values

2009-06-24 Thread Blazej Krzeminski
Hello

I have a data frame d with columns "var1", "var2", "var3"

Then I have two vectors:
columns <- c("var2", "var3")
values <- c(0, 1)


Is there a compact way to subset the data frame
using these two vectors and get the result equivalent to:

select (d, var2==0 & var3==1)  ?

Thank You

Blazej

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


Re: [R] lattice wireframe within a loop ??? - solved

2009-06-24 Thread Thomas Roth (geb. Kaliwe)

Thank you.

ONKELINX, Thierry schrieb:
You need to print() lattice plots inside a loop or a function. 





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

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
 
-Oorspronkelijk bericht-

Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
Namens Thomas Roth (geb. Kaliwe)
Verzonden: woensdag 24 juni 2009 13:08
Aan: 'r-help@r-project.org'
Onderwerp: [R] lattice wireframe within a loop ???

Hi,

I have the following problem. Calling wireframe within a loop results
into an empty window(s)

#generate some data
temp = expand.grid(A = 1:3,B = 1:3)
temp = cbind(temp, y1 = rnorm(9))
temp = cbind(temp, y2 = runif(9))


#plot y1 and y2 in two different windows for(i in 1:2) {
wireframe(y1 ~ A*B, temp, shade =T)
windows()
wireframe(y2 ~ A*B, temp, shade =T)
}


#However, calling it twice outside a loop works?

wireframe(y1 ~ A*B, temp, shade =T)
windows()
wireframe(y2 ~ A*B, temp, shade =T)


Obviously i'm missing something. How can i call wireframe more than one
time in a loop and get a wireframe?


Greetings

Thomas Roth

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

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.





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


[R] lmList

2009-06-24 Thread Cecilia Carmo

Hi R-helpers:

I have a function f<-y~a+b.x and my data is an unbalanced 
panel data (a dataframe with columns: firm,year,y,x). I 
need to run that regression by year. I started to subset 
the data by year and run the lm () function, but I asked R 
help how to perform this regressions at once. One of the 
suggestions was to run lmList (y ~ a + b.x  | year, …) but 
the coefficients that I obtain are different from those I 
have before. Someone could explain me why?


Thank you,
Cecília Carmo (Universidade de Aveiro - Portugal)

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


[R] gnls : Rho

2009-06-24 Thread Mahbub Latif
Hello list:

How to extract the value of "Rho" from a gnls() object. I am using gnls()
function similar to

res <- gnls(y~SSmicmen(),correlation=corCompSymm(form~1|b),data=dat)

Thanks in advance,

Mahbub.

-- 
Mahbub  Latif
School of Mathematical Sciences
Queen Mary, University of London
United Kingdom

[[alternative HTML version deleted]]

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


Re: [R] curvedarrow (some graphics problem)

2009-06-24 Thread David Winsemius


On Jun 24, 2009, at 1:21 AM, casperyc wrote:



[quote]>  grid.text("t", x=0.3, y=unit(-1, "line"), vp=vp2)
Error in valid.units(units) : Invalid unit

grid.text("s", 0.8, unit(-1, "line"), gp=gpar(col="red"), vp=vp2)

Error in valid.units(units) : Invalid unit[/quote]

Hi,

I have loaded the [grid] package. It seems that I have to load another
package?

No. Such a need might have been suggested by a function not found  
error. In this case the details are in the help page for the unit  
function in grid. The unit parameter was mis-specified.


?unit

Try:

 grid.text("t", x=0.3, y=unit(-1, "lines"), vp=vp2)
--
 grid.text("s", 0.8, unit(-1, "lines"), gp=gpar(col="red"), vp=vp2)


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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


[R] bwimage

2009-06-24 Thread aliceduggan
Dear Sir/Madam,
I am using R-Image in an MSc statistics dissertation and have found, in various 
EBImage manuals a functions - bwimage, which I would like to use, however I 
can't find it within my version of R.
Could you tell me if the function has changed or what I need to do to be able 
to use it.
Many thanks
Alice
[[alternative HTML version deleted]]

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


[R] lda.cv help

2009-06-24 Thread Oludare Ariyo
i am a new user of R working on "Cost sensitivity for Classical classification 
functions"
i have codes for cross validation for both linear and quadratic classifier but 
i cant not very cost of missclassification. please any body with help should 
help me
thanks
 
 
 
 
ARIYO,OLUDARE SAMUEL
Statistician,
Planning and Budgeting Department,
National Horticultural Reesarch Institutes ,Ibadan
+234-2-2412230-1058(Ext) Office
+243-080-35206932 (Mobile)



 


  
[[alternative HTML version deleted]]

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


[R] bwlabel

2009-06-24 Thread alicemsc

I am using R-Image in an MSc statistics dissertation and have found, in
various EBImage manuals a functions - bwlabel, which I would like to use,
however I can't find it within my version of R.
Could you tell me if the function has changed or what I need to do to be
able to use it.

-- 
View this message in context: 
http://www.nabble.com/bwlabel-tp24183200p24183200.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] I meant bwlabel

2009-06-24 Thread aliceduggan
Sorry I meant bwlabel on this message
Alice

--- On Wed, 24/6/09, alicedug...@btopenworld.com  
wrote:


From: alicedug...@btopenworld.com 
Subject: bwimage
To: r-help@r-project.org
Date: Wednesday, 24 June, 2009, 12:34 PM







Dear Sir/Madam,
I am using R-Image in an MSc statistics dissertation and have found, in various 
EBImage manuals a functions - bwimage, which I would like to use, however I 
can't find it within my version of R.
Could you tell me if the function has changed or what I need to do to be able 
to use it.
Many thanks
Alice
[[alternative HTML version deleted]]

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


Re: [R] Using a variable for mysql/database Query

2009-06-24 Thread jorgusch

Hello, 

Thanks! Join is not possible, as the database is simply way to large. When
we exactly now, what we are looking for maybe, but not yet…

By now, I figured the paste command - not familiar with R…, however, it only
seems to work for one - the last - entry I am using. Unfortunately, the help
section for the command help is short.

Are there ways to paste several variables into one query? The table we are
looking at also changes so, it would be quite handy to do it once in a line
on top of it.

Thanks!
 jorgusch






Dieter Menne wrote:
> 
> jorgusch  web.de> writes:
> 
>> Collecting data I need to check in a mysql server. As the data are
>> dependent
>> on each other I have to filter first.
>> 
>> However, I have now the problem that I find a value and would like to
>> insert
>> it into a data query for the "real select" command. Obviously, typing 'x'
>> does not help as the database does not now this entry. Anyway to make it
>> work?
> 
> The usual way to handle these case is to construct an SQL command using
> the retrieved value by paste. 
> 
> More generally, your requirements smell like being a good use of an SQL
> join.
> 
> Dieter
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Using-a-variable-for-mysql-database-Query-tp24166250p24183823.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] subsetting data frame using a vector of column names / values

2009-06-24 Thread Henrique Dallazuanna
Try this:

subset(d, eval(parse(text = paste(paste(columns, values, sep = "=="),
collapse = " & "

On Wed, Jun 24, 2009 at 9:16 AM, Blazej Krzeminski  wrote:

> Hello
>
> I have a data frame d with columns "var1", "var2", "var3"
>
> Then I have two vectors:
> columns <- c("var2", "var3")
> values <- c(0, 1)
>
>
> Is there a compact way to subset the data frame
> using these two vectors and get the result equivalent to:
>
> select (d, var2==0 & var3==1)  ?
>
> Thank You
>
> Blazej
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

[[alternative HTML version deleted]]

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


[R] Test for Temporal autocorrelation in GPS obtained points

2009-06-24 Thread Paulo E. Cardoso
Hi,

 

I have data collected from PTT-GPS devices tagged to birds. These data
typically are delivery in time slots, comprising the day-light period for
example.

I'm interested in testing the temporal correlation of observations (points)
and eventually exclude locations falling below a given correlation value.

I don't know if time can be used with as x-variable in moran.test().

 

Thanks in advance



Paulo E. Cardoso

 


[[alternative HTML version deleted]]

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


Re: [R] bwimage

2009-06-24 Thread Gregoire Pau

Dear Alice,

EBImage is a general-purpose image processing package for R, able to 
read, write, process and analyze images, but is part of the Bioconductor 
project. Please post your future questions on the BioC mailing list (see 
http://www.bioconductor.org/docs/mailList.html).


There is no function called 'bwimage' in EBImage but maybe you are 
talking about 'bwlabel' ? 'bwlabel' is a fast method able to segment 
connected components from a binary image. To use it, you just have to 
install EBImage by downloading the package here:

http://www.bioconductor.org/packages/release/bioc/html/EBImage.html

More information can be found in the vignette:
http://www.bioconductor.org/packages/release/bioc/vignettes/EBImage/inst/doc/EBImage-introduction.pdf

Best regards,

Greg
---
Gregoire Pau
EMBL Research Officer
http://www.ebi.ac.uk/~gpau/


alicedug...@btopenworld.com wrote:

Dear Sir/Madam,
I am using R-Image in an MSc statistics dissertation and have found, in various 
EBImage manuals a functions - bwimage, which I would like to use, however I 
can't find it within my version of R.
Could you tell me if the function has changed or what I need to do to be able 
to use it.
Many thanks
Alice
[[alternative HTML version deleted]]

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


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


[R] Odp: subsetting data frame using a vector of column names / values

2009-06-24 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 24.06.2009 14:16:15:

> Hello
> 
> I have a data frame d with columns "var1", "var2", "var3"
> 
> Then I have two vectors:
> columns <- c("var2", "var3")
> values <- c(0, 1)
> 
> 
> Is there a compact way to subset the data frame
> using these two vectors and get the result equivalent to:
> 
> select (d, var2==0 & var3==1)  ?

The first part, to select columns seems to be straightforward

d[,columns]

the second part is a bit trickier e.g.

ind = which(rowSums(mapply("%in%", d[,columns], values))>1)
d[ind, columns]

shall give you the result

Regards
Petr


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

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


[R] parallel rotated strips with color gradient

2009-06-24 Thread Kexin Ji
Hi,
I want to produce two parallel rotated strips with color gradient. So  
far, the sample strip is something produced by this:

pushViewport(viewport(x = unit(0.638, "npc"), y =unit(0.386, "npc"),  
width=.62, height=0.006, angle=137.2))
grid.rect(y=100:1/100, just="top",
  gp=gpar(col=NA,
  fill=colorRampPalette(c("lightgray", "white"),
space="Lab")(200)))

I want a same one parallel to it to the right.

I've tried something like:

pushViewport(viewport(x = unit(c(0.638, 0.648), "npc"), y  
=unit(c(0.386, 0.386), "npc"), width=unit(c(.62, .62) , "npc"),  
height=unit(c(0.006, 0.006), "npc"),  angle=137.2, layout  
=grid.layout(1,2)))

grid.rect(y=100:1/100, just="top",
  gp=gpar(col=NA,
  fill=colorRampPalette(c("lightgray", "white"),
space="Lab")(200)))

grid.rect(y=100:1/100, just="top",
  gp=gpar(col=NA,
  fill=colorRampPalette(c("lightgray", "white"),
space="Lab")(200)))

Or

vpList(pushViewport(viewport(x = 0.638, y = 0.386, width=.62,  
height=0.006, angle=137.2)))

grid.rect(y=100:1/100, just="top",
  gp=gpar(col=NA,
  fill=colorRampPalette(c("lightgray", "white"),
space="Lab")(200)))

But kept getting error messages.

Would someone please give me some hint?

Thank you very much!!
Kexin


[[alternative HTML version deleted]]

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


[R] label sorting x-axis

2009-06-24 Thread Christian Schulz
Thanks, how is it possible  that the x-axis labels getting the row 
sorting  instead the alphabetically one?

Could i  just printed  only every n (i.e. 3rd) label?

Christian

df <- data.frame(value=runif(26),le=letters)
df <- df[order(df[,1]),]
dotplot(value ~ le,data=df)



Maybe you want to have a look at the las option under ?par nevertheless.
Not sure whether it works in your example, though.
HTH, Michael 


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Christian Schulz
Sent: Mittwoch, 24. Juni 2009 14:04
To: r-help@r-project.org
Subject: Re: [R] vertical label on x-axis

I get it :
scales=list(x=list(rot=90))
Cheers, Christian

  

Hi,

have anybody a hint how it's possible plot the labels in the x-axis 
vertical to get more space.

dotplot( value ~
abbreviate(attribute,minlength=3),data=tabstat10,ylim=c(0,1),col="blue
",ylab="Value",type="p",par.settings=my.theme)


Many thanks,
Christian





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




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


Re: [R] label sorting x-axis

2009-06-24 Thread Henrique Dallazuanna
Try this:

dotplot(value ~ factor(le, levels = le),data=df)

On Wed, Jun 24, 2009 at 10:24 AM, Christian Schulz wrote:

> Thanks, how is it possible  that the x-axis labels getting the row sorting
>  instead the alphabetically one?
> Could i  just printed  only every n (i.e. 3rd) label?
>
> Christian
>
> df <- data.frame(value=runif(26),le=letters)
> df <- df[order(df[,1]),]
> dotplot(value ~ le,data=df)
>
>
>  Maybe you want to have a look at the las option under ?par nevertheless.
>> Not sure whether it works in your example, though.
>> HTH, Michael
>> -Original Message-
>> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
>> On Behalf Of Christian Schulz
>> Sent: Mittwoch, 24. Juni 2009 14:04
>> To: r-help@r-project.org
>> Subject: Re: [R] vertical label on x-axis
>>
>> I get it :
>> scales=list(x=list(rot=90))
>> Cheers, Christian
>>
>>
>>
>>> Hi,
>>>
>>> have anybody a hint how it's possible plot the labels in the x-axis
>>> vertical to get more space.
>>> dotplot( value ~
>>> abbreviate(attribute,minlength=3),data=tabstat10,ylim=c(0,1),col="blue
>>> ",ylab="Value",type="p",par.settings=my.theme)
>>>
>>>
>>> Many thanks,
>>> Christian
>>>
>>>
>>>
>>>
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

[[alternative HTML version deleted]]

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


Re: [R] curvedarrow (some graphics problem)

2009-06-24 Thread baptiste auguie


You're right, I meant to write "lines"not "line". The strange thing is, 
although "line" isn't listed in ?unit, it doesn't return an error on my 
machine,


> unit(-1, "line")
[1] -1line
> unit(-1, "lines")
[1] -1lines

Reading from 
http://svn.r-project.org/R/trunk/src/library/grid/src/unit.c "line" is 
listed as a pseudonym, so I guess it is a valid unit after all.


sessionInfo()
R version 2.9.0 (2009-04-17)
i386-apple-darwin8.11.1

locale:
en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] datasets  stats grid ( 2.9.0 ) graphics  grDevices utils 
methods   base




Best,

baptiste





David Winsemius wrote:


On Jun 24, 2009, at 1:21 AM, casperyc wrote:



[quote]>  grid.text("t", x=0.3, y=unit(-1, "line"), vp=vp2)
Error in valid.units(units) : Invalid unit

grid.text("s", 0.8, unit(-1, "line"), gp=gpar(col="red"), vp=vp2)

Error in valid.units(units) : Invalid unit[/quote]

Hi,

I have loaded the [grid] package. It seems that I have to load another
package?

No. Such a need might have been suggested by a function not found 
error. In this case the details are in the help page for the unit 
function in grid. The unit parameter was mis-specified.


?unit

Try:

 grid.text("t", x=0.3, y=unit(-1, "lines"), vp=vp2)
--
 grid.text("s", 0.8, unit(-1, "lines"), gp=gpar(col="red"), vp=vp2)


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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

and provide commented, minimal, self-contained, reproducible code.




--
_

Baptiste Auguié

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

Phone: +44 1392 264187

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

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


[R] Boxplots: side-by-side

2009-06-24 Thread Santosh
Dear R-sians..

I am trying to plot boxplots with side-by-side option.. I tried some of the
posted suggestions and could not make it work due to unequal sizes of
categories...

e.g.
weekly measured water depth values are categorized into 5 levels based on
their values
such measurement is again categorized into dichotomous levels - based on the
result of a test

I would like generate boxplot of water depth, with side-by-side display at
dichotomous levels (0,1), for each category (1-5).

However, dichotomous levels are not always available in each
category.e.g. category 1 may have all categorized as 0s, category 5 may
have all categorized as 1s, category 3 may have 0s and 1s, and so on...

I tried to use at=1:5+/- 0.1, add=T,xaxt="n" with complementary
(subset(dichot=0) & subset(dichot=1)) datasets  and it did not work..

I would highly appreciate your suggestions...

Thanks and regards,
Santosh

[[alternative HTML version deleted]]

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


Re: [R] How to import timestamps from emails into R

2009-06-24 Thread Thomas Levine
One last tiny problem: How do I add months to the scale? It currently just
has years
http://school.thomaslevine.org/mywall.png

Thanks again

Tom

On Sat, Jun 20, 2009 at 12:14 PM, Thomas Levine wrote:

> I wasn't really thinking that far ahead; plot tries to do something, so I
> figured I'd try that as I had little other idea of what to do.
>
> The plot(tt) actually does what I want, though; the scales are just very
> messed-up.
>
> Tom
>
>
> On Sat, Jun 20, 2009 at 11:58 AM, Gabor Grothendieck <
> ggrothendi...@gmail.com> wrote:
>
>> If that is the situation then plot(tt) in your post could not have been
>> what you wanted in any case, e.g. plot(10:20)
>>
>> On Sat, Jun 20, 2009 at 11:49 AM, Thomas Levine
>> wrote:
>> > This produces the x-axis is the index, and the y-axis is time. It has
>> all of
>> > the time information on the same axis, allowing me to plot cumulative
>> > occurrences by time (my original plan) if the times are sorted, which
>> they
>> > should be.
>> >
>> > I think I'll end up using some variant of plot(tt,seq_along(tt)),
>> putting
>> > the time axis along the bottom.
>> >
>> > Thanks
>> >
>> > Tom
>> >
>> > On Sat, Jun 20, 2009 at 11:15 AM, Gabor Grothendieck
>> >  wrote:
>> >>
>> >> Try this:
>> >>
>> >> plot(seq_along(tt), tt)
>> >>
>> >>
>> >> On Sat, Jun 20, 2009 at 10:55 AM, Thomas Levine<
>> thomas.lev...@gmail.com>
>> >> wrote:
>> >> > Here's what I get
>> >> >> head(tt)
>> >> > [1] "2008-02-20 03:09:51 EST" "2008-02-20 12:12:57 EST"
>> >> > [3] "2008-03-05 09:11:28 EST" "2008-03-05 17:59:40 EST"
>> >> > [5] "2008-03-09 09:00:09 EDT" "2008-03-29 15:57:16 EDT"
>> >> >
>> >> > But I can't figure out how to plot this now. plot(tt) does not appear
>> to
>> >> > be
>> >> > univariate. I get the same plot with plot(as.Date(tt)), which would
>> make
>> >> > sense if time is used because of the range of the dates and the
>> >> > insignificance of the times of day.
>> >> >> head(as.Date(tt))
>> >> > [1] "2008-02-20" "2008-02-20" "2008-03-05" "2008-03-05" "2008-03-09"
>> >> > [6] "2008-03-29"
>> >> >
>> >> > plot(tt) and plot(as.Date(tt)) give something like year as a function
>> of
>> >> > the
>> >> > rest of the date. Here they are
>> >> >
>> >> >
>> >> > Here are the addresses
>> >> > http://thomaslevine.org/time/tt.png
>> >> > http://thomaslevine.org/time/as.Date.tt.png
>> >> >
>> >> > Tom
>> >> >
>> >> > On Fri, Jun 19, 2009 at 6:21 PM, Gabor Grothendieck
>> >> >  wrote:
>> >> >>
>> >> >> Try this:
>> >> >>
>> >> >>
>> >> >> Lines <- "Sun, 14 Jun 2009 07:33:00 -0700
>> >> >> Sun, 14 Jun 2009 08:35:10 -0700
>> >> >> Sun, 14 Jun 2009 21:26:34 -0700
>> >> >> Mon, 15 Jun 2009 19:47:47 -0700
>> >> >> Wed, 17 Jun 2009 21:50:41 -0700"
>> >> >>
>> >> >> # L <- readLines("myfile.txt")
>> >> >> L <- readLines(textConnection(Lines))
>> >> >> tt <- as.POSIXct(L, format = "%a, %d %b %Y %H:%M:%S")
>> >> >>
>> >> >>
>> >> >>
>> >> >> On Fri, Jun 19, 2009 at 6:06 PM, Thomas Levine<
>> thomas.lev...@gmail.com>
>> >> >> wrote:
>> >> >> > I am analysing occurrences of a phenomenon by time, and each of
>> these
>> >> >> > timestamps taken from email headers represents one occurrence.
>> (The
>> >> >> > last
>> >> >> > number is the time zone.) I can easily change the format.
>> >> >> >
>> >> >> > Sun, 14 Jun 2009 07:33:00 -0700
>> >> >> > Sun, 14 Jun 2009 08:35:10 -0700
>> >> >> > Sun, 14 Jun 2009 21:26:34 -0700
>> >> >> > Mon, 15 Jun 2009 19:47:47 -0700
>> >> >> > Wed, 17 Jun 2009 21:50:41 -0700
>> >> >> >
>> >> >> > I've found documentation for a plethora of ways of importing time
>> >> >> > data,
>> >> >> > but
>> >> >> > I can't decide how to approach it. Any ideas on what may be the
>> >> >> > cleanest
>> >> >> > way? The only special concern is that I'll want to plot these data
>> by
>> >> >> > date
>> >> >> > and time, meaning that I would rather not bin all of the
>> occurrences
>> >> >> > from
>> >> >> > one day.
>> >> >> >
>> >> >> > The time zone isn't important as these are all local times; the
>> time
>> >> >> > zone
>> >> >> > only changes as a function of daylight savings time, so I probably
>> >> >> > shouldn't
>> >> >> > use it at all.
>> >> >> >
>> >> >> > Tom
>> >> >> >
>> >> >> >[[alternative HTML version deleted]]
>> >> >> >
>> >> >> > __
>> >> >> > R-help@r-project.org mailing list
>> >> >> > https://stat.ethz.ch/mailman/listinfo/r-help
>> >> >> > PLEASE do read the posting guide
>> >> >> > http://www.R-project.org/posting-guide.html
>> >> >> > and provide commented, minimal, self-contained, reproducible code.
>> >> >> >
>> >> >
>> >> >
>> >
>> >
>>
>
>

[[alternative HTML version deleted]]

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


Re: [R] curvedarrow (some graphics problem)

2009-06-24 Thread David Winsemius

I get:
> unit(-1, "line")
Error in valid.units(units) : Invalid unit
> unit(-1, "lines")
[1] -1lines

I have an older version of R (2.8.1) and of grid (2.8.1). The source  
for grid 2.8.1 does not have pseudonyms.


http://svn.r-project.org/R/branches/R-2-8-branch/src/library/grid/src/unit.c
--
David

On Jun 24, 2009, at 9:48 AM, baptiste auguie wrote:



You're right, I meant to write "lines"not "line". The strange thing  
is, although "line" isn't listed in ?unit, it doesn't return an  
error on my machine,


> unit(-1, "line")
[1] -1line
> unit(-1, "lines")
[1] -1lines

Reading fromhttp://svn.r-project.org/R/trunk/src/library/grid/src/unit.c 
 "line" is listed as a pseudonym, so I guess it is a valid unit  
after all.


sessionInfo()
R version 2.9.0 (2009-04-17)
i386-apple-darwin8.11.1

locale:
en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] datasets  stats grid ( 2.9.0 ) graphics  grDevices  
utils methods   base



Best,

baptiste





David Winsemius wrote:


On Jun 24, 2009, at 1:21 AM, casperyc wrote:



[quote]>  grid.text("t", x=0.3, y=unit(-1, "line"), vp=vp2)
Error in valid.units(units) : Invalid unit

grid.text("s", 0.8, unit(-1, "line"), gp=gpar(col="red"), vp=vp2)

Error in valid.units(units) : Invalid unit[/quote]

Hi,

I have loaded the [grid] package. It seems that I have to load  
another

package?

No. Such a need might have been suggested by a function not found  
error. In this case the details are in the help page for the unit  
function in grid. The unit parameter was mis-specified.


?unit

Try:

grid.text("t", x=0.3, y=unit(-1, "lines"), vp=vp2)
--
grid.text("s", 0.8, unit(-1, "lines"), gp=gpar(col="red"), vp=vp2)


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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




--
_

Baptiste Auguié

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

Phone: +44 1392 264187

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

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


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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


Re: [R] driver file

2009-06-24 Thread John Kane

Do you mean something like source?  Type ?source for help

--- On Tue, 6/23/09, Derek Lacoursiere  wrote:

> From: Derek Lacoursiere 
> Subject: [R]  driver file
> To: r-help@r-project.org
> Received: Tuesday, June 23, 2009, 3:05 PM
> 
> Hi,
> 
> How can I, from a single "driver" file, source other files
> in such a way
> that I can access their functions with parameters defined
> in my "driver"
> file?  I wish to do this to avoid creating a single,
> self-contained but
> clunky piece of code.  I have searched and found
> functions such as file(),
> pipe(), open(), found manuals on creating my own packages,
> etc. but I become
> increasingly aware that I don't know exactly what I am
> looking for (that I
> am a "neophyte").  
> 
> Help would be appreciated
> 
> Derek
> -- 
> View this message in context: 
> http://www.nabble.com/driver-file-tp24171201p24171201.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org
> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
> 


  __
Make your browsing faster, safer, and easier with the new Internet Explorer® 8. 
Optimized for Yahoo! Get it Now for Free! at 
http://downloads.yahoo.com/ca/internetexplorer/

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


Re: [R] How to import timestamps from emails into R

2009-06-24 Thread Gabor Grothendieck
See the example in plot.zoo labelled Fancy X Axis:

library(zoo)
example(plot.zoo)
?plot.zoo

On Wed, Jun 24, 2009 at 10:11 AM, Thomas Levine wrote:
> One last tiny problem: How do I add months to the scale? It currently just
> has years
> http://school.thomaslevine.org/mywall.png
>
> Thanks again
>
> Tom
>
> On Sat, Jun 20, 2009 at 12:14 PM, Thomas Levine 
> wrote:
>>
>> I wasn't really thinking that far ahead; plot tries to do something, so I
>> figured I'd try that as I had little other idea of what to do.
>>
>> The plot(tt) actually does what I want, though; the scales are just very
>> messed-up.
>>
>> Tom
>>
>> On Sat, Jun 20, 2009 at 11:58 AM, Gabor Grothendieck
>>  wrote:
>>>
>>> If that is the situation then plot(tt) in your post could not have been
>>> what you wanted in any case, e.g. plot(10:20)
>>>
>>> On Sat, Jun 20, 2009 at 11:49 AM, Thomas Levine
>>> wrote:
>>> > This produces the x-axis is the index, and the y-axis is time. It has
>>> > all of
>>> > the time information on the same axis, allowing me to plot cumulative
>>> > occurrences by time (my original plan) if the times are sorted, which
>>> > they
>>> > should be.
>>> >
>>> > I think I'll end up using some variant of plot(tt,seq_along(tt)),
>>> > putting
>>> > the time axis along the bottom.
>>> >
>>> > Thanks
>>> >
>>> > Tom
>>> >
>>> > On Sat, Jun 20, 2009 at 11:15 AM, Gabor Grothendieck
>>> >  wrote:
>>> >>
>>> >> Try this:
>>> >>
>>> >> plot(seq_along(tt), tt)
>>> >>
>>> >>
>>> >> On Sat, Jun 20, 2009 at 10:55 AM, Thomas
>>> >> Levine
>>> >> wrote:
>>> >> > Here's what I get
>>> >> >> head(tt)
>>> >> > [1] "2008-02-20 03:09:51 EST" "2008-02-20 12:12:57 EST"
>>> >> > [3] "2008-03-05 09:11:28 EST" "2008-03-05 17:59:40 EST"
>>> >> > [5] "2008-03-09 09:00:09 EDT" "2008-03-29 15:57:16 EDT"
>>> >> >
>>> >> > But I can't figure out how to plot this now. plot(tt) does not
>>> >> > appear to
>>> >> > be
>>> >> > univariate. I get the same plot with plot(as.Date(tt)), which would
>>> >> > make
>>> >> > sense if time is used because of the range of the dates and the
>>> >> > insignificance of the times of day.
>>> >> >> head(as.Date(tt))
>>> >> > [1] "2008-02-20" "2008-02-20" "2008-03-05" "2008-03-05" "2008-03-09"
>>> >> > [6] "2008-03-29"
>>> >> >
>>> >> > plot(tt) and plot(as.Date(tt)) give something like year as a
>>> >> > function of
>>> >> > the
>>> >> > rest of the date. Here they are
>>> >> >
>>> >> >
>>> >> > Here are the addresses
>>> >> > http://thomaslevine.org/time/tt.png
>>> >> > http://thomaslevine.org/time/as.Date.tt.png
>>> >> >
>>> >> > Tom
>>> >> >
>>> >> > On Fri, Jun 19, 2009 at 6:21 PM, Gabor Grothendieck
>>> >> >  wrote:
>>> >> >>
>>> >> >> Try this:
>>> >> >>
>>> >> >>
>>> >> >> Lines <- "Sun, 14 Jun 2009 07:33:00 -0700
>>> >> >> Sun, 14 Jun 2009 08:35:10 -0700
>>> >> >> Sun, 14 Jun 2009 21:26:34 -0700
>>> >> >> Mon, 15 Jun 2009 19:47:47 -0700
>>> >> >> Wed, 17 Jun 2009 21:50:41 -0700"
>>> >> >>
>>> >> >> # L <- readLines("myfile.txt")
>>> >> >> L <- readLines(textConnection(Lines))
>>> >> >> tt <- as.POSIXct(L, format = "%a, %d %b %Y %H:%M:%S")
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> On Fri, Jun 19, 2009 at 6:06 PM, Thomas
>>> >> >> Levine
>>> >> >> wrote:
>>> >> >> > I am analysing occurrences of a phenomenon by time, and each of
>>> >> >> > these
>>> >> >> > timestamps taken from email headers represents one occurrence.
>>> >> >> > (The
>>> >> >> > last
>>> >> >> > number is the time zone.) I can easily change the format.
>>> >> >> >
>>> >> >> > Sun, 14 Jun 2009 07:33:00 -0700
>>> >> >> > Sun, 14 Jun 2009 08:35:10 -0700
>>> >> >> > Sun, 14 Jun 2009 21:26:34 -0700
>>> >> >> > Mon, 15 Jun 2009 19:47:47 -0700
>>> >> >> > Wed, 17 Jun 2009 21:50:41 -0700
>>> >> >> >
>>> >> >> > I've found documentation for a plethora of ways of importing time
>>> >> >> > data,
>>> >> >> > but
>>> >> >> > I can't decide how to approach it. Any ideas on what may be the
>>> >> >> > cleanest
>>> >> >> > way? The only special concern is that I'll want to plot these
>>> >> >> > data by
>>> >> >> > date
>>> >> >> > and time, meaning that I would rather not bin all of the
>>> >> >> > occurrences
>>> >> >> > from
>>> >> >> > one day.
>>> >> >> >
>>> >> >> > The time zone isn't important as these are all local times; the
>>> >> >> > time
>>> >> >> > zone
>>> >> >> > only changes as a function of daylight savings time, so I
>>> >> >> > probably
>>> >> >> > shouldn't
>>> >> >> > use it at all.
>>> >> >> >
>>> >> >> > Tom
>>> >> >> >
>>> >> >> >        [[alternative HTML version deleted]]
>>> >> >> >
>>> >> >> > __
>>> >> >> > R-help@r-project.org mailing list
>>> >> >> > https://stat.ethz.ch/mailman/listinfo/r-help
>>> >> >> > PLEASE do read the posting guide
>>> >> >> > http://www.R-project.org/posting-guide.html
>>> >> >> > and provide commented, minimal, self-contained, reproducible
>>> >> >> > code.
>>> >> >> >
>>> >> >
>>> >> >
>>> >
>>> >
>>
>
>

__
R-help@

[R] Second LondonR Group meeting

2009-06-24 Thread Francisco Gochez
Hello,

 

Mango is pleased to announce that the next LondonR Group meeting will be
held on 21st July. At this meeting we plan to have a feedback session
from people who attended useR! in Rennes. To help us plan this, if you
are attending at Rennes next month and would be interested in giving
some short feedback on an aspect of your choice please let us know.

 

DateTuesday 21st July 2009

Time4pm to 7pm 

Venue  The Wall

45 Old Broad St

London

EC2N 1HU

Tel 020 7588 4845

 

To register for this event please send an email to
market...@mango-solutions.com

 

I hope you can attend and look forward to meeting you.

 

 

Kind regards,


Francisco 

 

mangosolutions

S & R Consulting and Training

T: +44 (0)1249 767700

F: +44 (0)1249 767707

M: +44 (0)7966 062462

 

Unit 2 Greenways Business Park

Bellinger Close

Chippenham

SN15 1BN

UK

 


[[alternative HTML version deleted]]

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


[R] rgdal package -- Error in installing package

2009-06-24 Thread Luis Ridao Cruz
R-help,

I'm trying to install the rgdal package under Ubuntu
but I get the following warning:


> install.packages("rgdal")
Warning in install.packages("rgdal", configure.args = 
"--with-gdal-modules=/usr/local/lib") :
  argument 'lib' is missing: using 
'/home/luisridaocruz/R/x86_64-pc-linux-gnu-library/2.8'

which causes the error:

> library("rgdal")
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared library 
'/home/luisridaocruz/R/x86_64-pc-linux-gnu-library/2.8/rgdal/libs/rgdal.so':
  libgdal.so.1: cannot open shared object file: No such file or directory
Error: package/namespace load failed for 'rgdal'

If I try the following:

> install.packages("rgdal",configure.args="--with-gdal-modules=/usr/local/lib")
Warning in install.packages("rgdal", configure.args = 
"--with-gdal-modules=/usr/local/lib") :
  argument 'lib' is missing: using 
'/home/luisridaocruz/R/x86_64-pc-linux-gnu-library/2.8'
trying URL 'http://cran.ii.uib.no/src/contrib/rgdal_0.6-8.tar.gz'
Content type 'ap
.


Then the same error occurs and by doing:

> install.packages("rgdal",configure.args="--with-gdal-modules=/usr/local/lib",lib="/usr/local/lib")
Warning in install.packages("rgdal", configure.args = 
"--with-gdal-modules=/usr/local/lib",  :
  'lib = "/usr/local/lib"' is not writable
Error in install.packages("rgdal", configure.args = 
"--with-gdal-modules=/usr/local/lib",  : 
  unable to install packages

Can anyone helps?

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


Re: [R] Boxplots: side-by-side

2009-06-24 Thread stephen sefick
reproducible code.

On Wed, Jun 24, 2009 at 8:53 AM, Santosh wrote:
> Dear R-sians..
>
> I am trying to plot boxplots with side-by-side option.. I tried some of the
> posted suggestions and could not make it work due to unequal sizes of
> categories...
>
> e.g.
> weekly measured water depth values are categorized into 5 levels based on
> their values
> such measurement is again categorized into dichotomous levels - based on the
> result of a test
>
> I would like generate boxplot of water depth, with side-by-side display at
> dichotomous levels (0,1), for each category (1-5).
>
> However, dichotomous levels are not always available in each
> category.e.g. category 1 may have all categorized as 0s, category 5 may
> have all categorized as 1s, category 3 may have 0s and 1s, and so on...
>
> I tried to use at=1:5+/- 0.1, add=T,xaxt="n" with complementary
> (subset(dichot=0) & subset(dichot=1)) datasets  and it did not work..
>
> I would highly appreciate your suggestions...
>
> Thanks and regards,
> Santosh
>
>        [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

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


[R] order by decerasing 1st variable and increasing 2nd variable

2009-06-24 Thread Daniel Brewer
Hello,

I have a data.frame which I would like to sort with the primary key
decreasing while the secondry key is increasing e.g.

x <- data.frame(One=c(1,1,1,2,2,3,4,5),Two=c(2,3,1,2,3,3,3,3))

I would like to order it so it looks like this:

  One Two
8   5   3
7   4   3
6   3   3
4   2   2
5   2   3
3   1   1
1   1   2
2   1   3

i.e. primarily decreasing in the 1st column but if there is a tie
increasing in the second column.

Is this possible?  I can not find anything in order that seems to
support this.  I would have thought,

x[order(x$One,x$Two,decreasing=c(T,F)),]

would do it but it doesn't.

Thanks

Dan

-- 
**
Daniel Brewer, Ph.D.

Institute of Cancer Research
Molecular Carcinogenesis
Email: daniel.bre...@icr.ac.uk
**

The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the a...{{dropped:2}}

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


[R] Qualified parameters in SOAP body using .SOAP

2009-06-24 Thread Olivier Cailloux

Hello,

I am trying to reach a web service using the SOAP package. I succeeded 
calling the web service, but not sending parameters to it. After much 
research and tries, I think I found that the problem lies in the 
namespace including the parameters in the SOAP body.


In short, my question is: how can I send unqualified parameters in the 
SOAP body of a call produced through the SOAP package? Details of what I 
try to do follow.


The SOAP package sends this soap envelope to my test web service (wsdl 
here [http://smg8.ulb.ac.be:8080/web2?wsdl]).
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>

 
   http://web2.web/";>
 Olivier
   
 


The R commands used are:
library("SSOAP")
smg8TestService <- SOAPServer("smg8.ulb.ac.be", "/web2/TestService", 8080)
contentGreet <- .SOAP(server=smg8TestService, method="greetMe", 
arg0="Olivier", action="", xmlns="http://web2.web/";, .convert=FALSE)


But, AFAIU, the arg0 tag should NOT be qualified, according to the WSDL. 
Hence, my web service implementation never receives the "Olivier" 
argument and rather receives "null" as the string parameter.


When calling the web service using an other client (eclipse Web services 
explorer), I see it generates the following body:
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:q0="http://web2.web/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>

 
   
 Olivier-from-eclipse
   
 


Thus with the "arg0" tag being unqualified (i.e. not in the 
"http://web2.web/"; namespace). And that works: my web service 
implementation indeed receives the "Olivier-from-eclipse" parameter as 
string.


Can anyone confirm that my understanding of what happens and why my web 
service implementation, when called by the R client, does not see the 
parameters, seems correct?


If it seems correct, then how can I send unqualified parameters in the 
SOAP body using the SOAP package? Thanks for any help!

Olivier

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


Re: [R] order by decerasing 1st variable and increasing 2nd variable

2009-06-24 Thread Ronggui Huang
How about this:
> x[order(x$One,-x$Two,decreasing=T),]
  One Two
8   5   3
7   4   3
6   3   3
4   2   2
5   2   3
3   1   1
1   1   2
2   1   3


2009/6/24 Daniel Brewer :
> Hello,
>
> I have a data.frame which I would like to sort with the primary key
> decreasing while the secondry key is increasing e.g.
>
> x <- data.frame(One=c(1,1,1,2,2,3,4,5),Two=c(2,3,1,2,3,3,3,3))
>
> I would like to order it so it looks like this:
>
>  One Two
> 8   5   3
> 7   4   3
> 6   3   3
> 4   2   2
> 5   2   3
> 3   1   1
> 1   1   2
> 2   1   3
>
> i.e. primarily decreasing in the 1st column but if there is a tie
> increasing in the second column.
>
> Is this possible?  I can not find anything in order that seems to
> support this.  I would have thought,
>
> x[order(x$One,x$Two,decreasing=c(T,F)),]
>
> would do it but it doesn't.
>
> Thanks
>
> Dan
>
> --
> **
> Daniel Brewer, Ph.D.
>
> Institute of Cancer Research
> Molecular Carcinogenesis
> Email: daniel.bre...@icr.ac.uk
> **
>
> The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
> Limited by Guarantee, Registered in England under Company No. 534147 with its 
> Registered Office at 123 Old Brompton Road, London SW7 3RP.
>
> This e-mail message is confidential and for use by the a...{{dropped:2}}
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
HUANG Ronggui, Wincent
PhD Candidate
Dept of Public and Social Administration
City University of Hong Kong
Home page: http://asrr.r-forge.r-project.org/rghuang.html

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


Re: [R] rgdal package -- Error in installing package

2009-06-24 Thread B. H. Braswell


$ sudo R
> install.packages(rgdal)

worked for me on my Ubuntu machine

but, I already had GDAL library installed with

$ sudo apt-get install libgdal1-1.5.0

--
B. H. Braswell (Rob)
University of New Hampshire

On Jun 24, 2009, at 9:24 AM, Luis Ridao Cruz wrote:


R-help,

I'm trying to install the rgdal package under Ubuntu
but I get the following warning:



install.packages("rgdal")
Warning in install.packages("rgdal", configure.args = "--with-gdal- 
modules=/usr/local/lib") :
 argument 'lib' is missing: using '/home/luisridaocruz/R/x86_64-pc- 
linux-gnu-library/2.8'


which causes the error:


library("rgdal")

Error in dyn.load(file, DLLpath = DLLpath, ...) :
 unable to load shared library '/home/luisridaocruz/R/x86_64-pc- 
linux-gnu-library/2.8/rgdal/libs/rgdal.so':
 libgdal.so.1: cannot open shared object file: No such file or  
directory

Error: package/namespace load failed for 'rgdal'

If I try the following:

install.packages("rgdal",configure.args="--with-gdal-modules=/usr/ 
local/lib")
Warning in install.packages("rgdal", configure.args = "--with-gdal- 
modules=/usr/local/lib") :
 argument 'lib' is missing: using '/home/luisridaocruz/R/x86_64-pc- 
linux-gnu-library/2.8'

trying URL 'http://cran.ii.uib.no/src/contrib/rgdal_0.6-8.tar.gz'
Content type 'ap
.


Then the same error occurs and by doing:

install.packages("rgdal",configure.args="--with-gdal-modules=/usr/ 
local/lib",lib="/usr/local/lib")
Warning in install.packages("rgdal", configure.args = "--with-gdal- 
modules=/usr/local/lib",  :

 'lib = "/usr/local/lib"' is not writable
Error in install.packages("rgdal", configure.args = "--with-gdal- 
modules=/usr/local/lib",  :

 unable to install packages

Can anyone helps?

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


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


[R] [Classification] lifting score in R

2009-06-24 Thread Michael
Hi all,

Could anybody give me some pointers to Cross Validation using Lifting
Score as error function, as commonly used in data-mining and
classification field in marketing and e-commerce research?

Thanks!

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


Re: [R] Boxplots: side-by-side

2009-06-24 Thread Richard M. Heiberger

Try this

Rich


tmp <- data.frame(
y=rnorm(100),
category=rep(factor(letters[1:5]),each=20),
level=rep(factor(0:1), length=100))
tmp
table(tmp[,2:3])
tmp$y[with(tmp, category=="a" & level=0)] <- NA
tmp$y[with(tmp, category=="a" & level==0)] <- NA
tmp$y[with(tmp, category=="e" & level==1)] <- NA
tmp$y[78:80] <- NA
tmp[!is.na(tmp$y),]
tmp2 <- tmp[!is.na(tmp$y),]
table(tmp2[2:3])

bwplot(y ~ category | level, data=tmp2)
bwplot(y ~ category | level, data=tmp2, layout=c(1,2))

bwplot(y ~ level | category, data=tmp2, layout=c(5,1))
bwplot(y ~ level | category, data=tmp2, layout=c(5,1))

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


[R] how to undo automatic loading of packages?

2009-06-24 Thread davidr
I wanted to try out package distrMod, so I did

> install.packages('distrMod')
> library(distrMod)

and played around, saved and quit.

Now whenever I start up in this directory, I get distr and lots of other
stuff loaded and lots of messages.

How do I keep it from automatically loading, other than starting over in
another directory?
I read ?Startup, but I couldn't suss out where the autoloading was
occurring.
It probably has something to do with the "Autoloads" that shows up in my
search list, but
I don't know how to get it out.
If I start up in another directory, this behavior is avoided, so I don't
think it's in
any site files. In this session's R.home(), I have
$ cat .Rprofile
options(stringsAsFactors = FALSE)
so it's not in there.

> search()
 [1] ".GlobalEnv" "package:grDevices"
"package:datasets"   "package:RandVar"   
 [5] "package:distrEx""package:actuar"
"package:evd""package:distr" 
 [9] "package:SweaveListingUtils" "package:sfsmisc"
"package:utils"  "package:stats" 
[13] "package:startupmsg" "package:graphics"
"package:methods""Autoloads" 
[17] "package:base"  

> options("defaultPackages")
$defaultPackages
[1] "datasets"  "utils" "grDevices" "graphics"  "stats"
"methods"  

> sessionInfo()
R version 2.9.0 (2009-04-17) 
i386-pc-mingw32 

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

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


other attached packages:
[1] RandVar_0.6.7  distrEx_2.1actuar_1.0-2
evd_2.2-4  distr_2.1.1   
[6] SweaveListingUtils_0.2 sfsmisc_1.0-7  startupmsg_0.6

loaded via a namespace (and not attached):
[1] distrMod_2.1 MASS_7.2-46  stats4_2.9.0

Thanks for any help on this,
David L. Reiner




This e-mail and any materials attached hereto, including, without limitation, 
all content hereof and thereof (collectively, "Rho Content") are confidential 
and proprietary to Rho Trading Securities, LLC ("Rho") and/or its affiliates, 
and are protected by intellectual property laws.  Without the prior written 
consent of Rho, the Rho Content may not (i) be disclosed to any third party or 
(ii) be reproduced or otherwise used by anyone other than current employees of 
Rho or its affiliates, on behalf of Rho or its affiliates.
 
THE RHO CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, RHO HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE RHO 
CONTENT, AND NEITHER RHO NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY RHO CONTENT, EVEN IF RHO IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

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


[R] building R packages

2009-06-24 Thread Stein, Luba (AIM SE)
Hello,

I tried to build an own R package on Windows XP but get an error which I can't 
solve.
I called my package "pack". It works to creat the file "pack" with 
package.skeleton().

But when I try to compile it with Rcmd build --binary pack I obtain the 
following error:

IO::Seekable::seek missing at C:/R/R-2.9.0/share/perl/FileHandle.pm line 59.
Compilation failed in require at C:/R/R-2.9.0/share/perl/R/Dcf.pm line 49.
BEGIN failed--compilation aborted at C:/R/R-2.9.0/share/perl/R/Dcf.pm line 49.
Compilation failed in require at C:\R\R-2.9.0/bin/build line 28.
BEGIN failed--compilation aborted at C:\R\R-2.9.0/bin/build line 28.


So if someone could help me on this I would be very greatful.

Wishes,
Luba Stein








[[alternative HTML version deleted]]

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


Re: [R] The gradient of a multivariate normal density with respecttoits parameters

2009-06-24 Thread Ravi Varadhan
Karl,

I have written a function to compute the gradient of a multivariate normal
density (derivatives at a given point, with respect to the parameters of the
density).  It is in the atttached file.  I would appreciate any feedback.

There are couple of interesting points: 

1.  Note is that there is a minor adjustment needed to the formulas given by
Dwyer (Table 2, Eqs. (11.7 and 11.8) to account for the symmetry in the
derivatives of the covariance parameters.  Without this adjustment the
derivatives of covariances are off by a factor of 2.

2.  I couldn't figure out how to avoid inverting the covariance matrix for
Eq. (11.7), using `solve(sigma)'.  I would appreciate knowing if there is a
trick for doing this.

Ravi. 



---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: rvarad...@jhmi.edu

Webpage:
http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h
tml

 





-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Karl Ove Hufthammer
Sent: Wednesday, June 24, 2009 3:21 AM
To: r-h...@stat.math.ethz.ch
Subject: Re: [R] The gradient of a multivariate normal density with
respecttoits parameters

Ravi Varadhan:

> You may want to look at the paper by Dwyer on "Some applications of 
> matrix derivatives in multivariate analysis" (JASA 1967), especially 
> the Table 2 on p. 617.

Thanks! That's a *very* useful paper. Note there also is a small corrigenda
available:

Corrigenda: Some Applications of Matrix Derivatives in Multivariate Analysis
Paul S. Dwyer Journal of the American Statistical Association, Vol. 62, No.
320 (Dec., 1967), p. 1518 Stable URL: http://www.jstor.org/stable/2283811

--
Karl Ove Hufthammer

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


mvnorm.grad <- function(x, mu, sigma, log=FALSE) {
# x = a vector denoting location at which gradient is computed
# mu = a vector denoting mean of multivariate normal
# sigma = covariance matrix
# log = logical variable indicating whether density or log-density should be 
used
# Note:  gradient is computed with respect to location parameters, and with 
respect to variances and covariances 
#
# Author:  Ravi Varadhan, Johns Hopkins University, June 24, 2009
#
siginvmu <- c(solve(sigma, x-mu))
mu.grad <- siginvmu
sigma.grad <- tcrossprod(siginvmu) - solve(sigma)  # is there a way to avoid 
inverting `sigma'?
diag(sigma.grad) <- 0.5 * diag(sigma.grad)  # this is required to account for 
symmetry of covariance matrix

if (log) list(mu.grad=mu.grad, sigma.grad=sigma.grad) else 
{
f <- dmvnorm(x, mean=mu, sigma=sigma, log=FALSE)
list(mu.grad=mu.grad*f, sigma.grad=sigma.grad*f)
}   
}


# application to a bivariate normal
#
f=function(pars, xx, yy, log=FALSE)
# Numerical gradient using "numDeriv" for bivariate normal
#
{
  mu = pars[1:2]
  sig1 = pars[3]
  sig12 = pars[4]
  sig2 = pars[5]
  sig = matrix(c(sig1,sig12,sig12,sig2),2)
  dmvnorm(c(xx,yy),mean=mu,sigma=sig, log=log)
}

mu1=1
mu2=2
sig1=3^2
sig2=4^2
sig12=.5 * sqrt(sig1 * sig2)
sig <- matrix(c(sig1,sig12,sig12,sig2), 2, 2)

xx=rnorm(1) # or a x vector
yy=rnorm(1) # or a y vector

ans1 <- jacobian(func=f, x=c(mu1,mu2,c(sig)[-3]), xx=xx, yy=yy)
ans2 <- mvnorm.grad(x=c(xx, yy), mu=c(mu1, mu2), sigma=sig)
ans1
ans2
all.equal(c(ans1), c(ans2$mu, ans2$sigma.grad[lower.tri(ans2$sigma.grad, 
diag=TRUE)]))

#
# application to a 4-dim multivariate normal
mu <- rnorm(4, mean=c(1,2,4,8))
sigma <- matrix(rexp(16), 4, 4)
sigma <- sigma %*% t(sigma)  

x0 <- rnorm(4, mean=c(1,2,4,8))
ans <- mvnorm.grad(x=x0, mu=mu, sigma=sigma)
ans
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] subsetting data frame using a vector of column names / values

2009-06-24 Thread Blazej Krzeminski
This "one liner" works great!
Thanks (for all replies)

>
> Try this:
>
> subset(d, eval(parse(text = paste(paste(columns, values, sep = "=="), 
> collapse = " & "
>

>>
>> Hello
>>
>> I have a data frame d with columns "var1", "var2", "var3"
>>
>> Then I have two vectors:
>> columns <- c("var2", "var3")
>> values <- c(0, 1)
>>
>>
>> Is there a compact way to subset the data frame
>> using these two vectors and get the result equivalent to:
>>
>> select (d, var2==0 & var3==1)  ?
>>
>> Thank You
>>
>> Blazej
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O

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


Re: [R] how to undo automatic loading of packages?

2009-06-24 Thread Prof Brian Ripley

On Wed, 24 Jun 2009, dav...@rhotrading.com wrote:


I wanted to try out package distrMod, so I did


install.packages('distrMod')
library(distrMod)


and played around, saved and quit.

Now whenever I start up in this directory, I get distr and lots of other
stuff loaded and lots of messages.

How do I keep it from automatically loading, other than starting over in
another directory?
I read ?Startup, but I couldn't suss out where the autoloading was
occurring.
It probably has something to do with the "Autoloads" that shows up in my
search list, but
I don't know how to get it out.
If I start up in another directory, this behavior is avoided, so I don't
think it's in
any site files. In this session's R.home(), I have
$ cat .Rprofile
options(stringsAsFactors = FALSE)
so it's not in there.


search()

[1] ".GlobalEnv" "package:grDevices"
"package:datasets"   "package:RandVar"
[5] "package:distrEx""package:actuar"
"package:evd""package:distr"
[9] "package:SweaveListingUtils" "package:sfsmisc"
"package:utils"  "package:stats"
[13] "package:startupmsg" "package:graphics"
"package:methods""Autoloads"
[17] "package:base"


options("defaultPackages")

$defaultPackages
[1] "datasets"  "utils" "grDevices" "graphics"  "stats"
"methods"


sessionInfo()

R version 2.9.0 (2009-04-17)
i386-pc-mingw32

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

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


other attached packages:
[1] RandVar_0.6.7  distrEx_2.1actuar_1.0-2
evd_2.2-4  distr_2.1.1
[6] SweaveListingUtils_0.2 sfsmisc_1.0-7  startupmsg_0.6

loaded via a namespace (and not attached):
[1] distrMod_2.1 MASS_7.2-46  stats4_2.9.0

Thanks for any help on this,
David L. Reiner




This e-mail and any materials attached hereto, including, without limitation, all content hereof 
and thereof (collectively, "Rho Content") are confidential and proprietary to Rho Trading 
Securities, LLC ("Rho") and/or its affiliates, and are protected by intellectual property 
laws.  Without the prior written consent of Rho, the Rho Content may not (i) be disclosed to any 
third party or (ii) be reproduced or otherwise used by anyone other than current employees of Rho 
or its affiliates, on behalf of Rho or its affiliates.

THE RHO CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY 
KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, RHO HEREBY 
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE RHO 
CONTENT, AND NEITHER RHO NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE 
FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, 
DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS 
AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR 
INABILITY TO USE, ANY RHO CONTENT, EVEN IF RHO IS ADVISED OF THE POSSIBILITY OF 
SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.

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



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

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


Re: [R] [Classification] lifting score in R

2009-06-24 Thread Christian Schulz

Maybe the packages caret,RWeka and ROCR  are usefuel starting points.
Cheers, Christian


Hi all,

Could anybody give me some pointers to Cross Validation using Lifting
Score as error function, as commonly used in data-mining and
classification field in marketing and e-commerce research?

Thanks!

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




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


[R] Random Forest Variable Importance Interpretation

2009-06-24 Thread lara harrup (IAH-P)
Hi

 

I am trying to explore the use of random forests for regression to
identify the important environmental/microclimate variables involved in
predicting the abundance of a species in different habitats, there are
approx 40 variable and between 200 and 500 data points depending on the
dataset. I have successfully used the randomForest package to conduct
the analysis and looked at the %IncMSE and IncNodeImpurity values given
by calling and plotting these out and have looked at the partial
dependence plots for the different variables effect of the response but
I have been looking though the literature to see how people have
previously used this type of analysis and I would like to be able to
plot out the overall variable importance in some form of PCA Scree graph
but havn't got a clue how to even start this so any suggestions will be
most appreciated?

 

Many thanks in advance

 

Lara


[[alternative HTML version deleted]]

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


Re: [R] [Classification] lifting score in R

2009-06-24 Thread Tobias Sing
Michael,

a lift chart for evaluating binary scoring classifiers, as I
understand it, plots...

lift score: P(Yhat = + | Y = +)/P(Yhat = +)
against
rate of rate of positive predictions: P(Yhat = +).

...across the continuum of possible cutoffs. If you want to do this,
here is how you would do this with ROCR:

library(ROCR)
x <- your.predicted.scores
y <- your.true.class.labels
pred <- prediction(x, y)
perf <- performance(pred, 'lift', 'rpp')
plot(perf)

x and y can be vectors, or, in the case of cross-validation, data
frames or lists representing the individual cross-validation runs.
See the ROCR help pages ?performance, help(package=ROCR) and this slide deck:
http://rocr.bioinf.mpi-sb.mpg.de/ROCR_Talk_Tobias_Sing.ppt

HTH,
  Tobias



On Wed, Jun 24, 2009 at 5:17 PM, Michael wrote:
> Hi all,
>
> Could anybody give me some pointers to Cross Validation using Lifting
> Score as error function, as commonly used in data-mining and
> classification field in marketing and e-commerce research?
>
> Thanks!
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


[R] "by" question

2009-06-24 Thread David Hugh-Jones
Hello all

I have a big data frame and I regularly want to break it down into subsets,
calculate some new data, and add it back to the data frame.

At the moment my technique seems a bit ugly and embarrassing. Something
like:

result <- by(mydata, mydata$some_factor, function (x) {
  # do something to create a vector v with length(v) == nrow(x)
 return(v)
})
# now result has a big list, argh... how do I put it neatly back into the
mydata data frame?
for (i in unique(mydata$some_factor) {
mydata$newvar[mydata$somefactor ==i] <- result[[i]]
}

What should I be doing instead of this?

David Hugh-Jones
Post-doctoral Researcher
Max Planck Institute of Economics, Jena
http://davidhughjones.googlepages.com

[[alternative HTML version deleted]]

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


Re: [R] how to undo automatic loading of packages?

2009-06-24 Thread Prof Brian Ripley
That was unintentional: the mail server crashed and apparently sent 
the just-started reply.


It is nothing to do with 'Autoloads'.  What is most likely if that you 
have saved a reference to a namespace such as 'distrMod' in your 
.RData file.  If that it is the case, when .RData is loaded it will 
load the namespace, and any namespaces it imports (and so on 
recursively).


Once distrMod's namespace is loaded, it can attach other packages, and 
indeed it does:



loadNamespace("distrMod")

... lots of messages from those prolix authors 

search()

 [1] ".GlobalEnv" "package:RandVar"
 [3] "package:distrEx""package:actuar"
 [5] "package:evd""package:distr"
 [7] "package:SweaveListingUtils" "package:sfsmisc"
 [9] "package:startupmsg" "package:stats"
[11] "package:graphics"   "package:grDevices"
[13] "package:utils"  "package:datasets"
[15] "package:methods""Autoloads"
[17] "package:base"

The only fix is to locate the object you saved with the reference to 
distrMod and delete it.  The only hint I can offer is that it is 
likely to be a function with namespace:distrMod as its environment.


Note that it is not regarded as good form for loading a namepace to 
attach a package, and should not be necessary.



On Wed, 24 Jun 2009, Prof Brian Ripley wrote:


On Wed, 24 Jun 2009, dav...@rhotrading.com wrote:


I wanted to try out package distrMod, so I did


install.packages('distrMod')
library(distrMod)


and played around, saved and quit.

Now whenever I start up in this directory, I get distr and lots of other
stuff loaded and lots of messages.

How do I keep it from automatically loading, other than starting over in
another directory?
I read ?Startup, but I couldn't suss out where the autoloading was
occurring.
It probably has something to do with the "Autoloads" that shows up in my
search list, but
I don't know how to get it out.
If I start up in another directory, this behavior is avoided, so I don't
think it's in
any site files. In this session's R.home(), I have
$ cat .Rprofile
options(stringsAsFactors = FALSE)
so it's not in there.


search()

[1] ".GlobalEnv" "package:grDevices"
"package:datasets"   "package:RandVar"
[5] "package:distrEx""package:actuar"
"package:evd""package:distr"
[9] "package:SweaveListingUtils" "package:sfsmisc"
"package:utils"  "package:stats"
[13] "package:startupmsg" "package:graphics"
"package:methods""Autoloads"
[17] "package:base"


options("defaultPackages")

$defaultPackages
[1] "datasets"  "utils" "grDevices" "graphics"  "stats"
"methods"


sessionInfo()

R version 2.9.0 (2009-04-17)
i386-pc-mingw32

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

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


other attached packages:
[1] RandVar_0.6.7  distrEx_2.1actuar_1.0-2
evd_2.2-4  distr_2.1.1
[6] SweaveListingUtils_0.2 sfsmisc_1.0-7  startupmsg_0.6

loaded via a namespace (and not attached):
[1] distrMod_2.1 MASS_7.2-46  stats4_2.9.0

Thanks for any help on this,
David L. Reiner




This e-mail and any materials attached hereto, including, without 
limitation, all content hereof and thereof (collectively, "Rho Content") 
are confidential and proprietary to Rho Trading Securities, LLC ("Rho") 
and/or its affiliates, and are protected by intellectual property laws. 
Without the prior written consent of Rho, the Rho Content may not (i) be 
disclosed to any third party or (ii) be reproduced or otherwise used by 
anyone other than current employees of Rho or its affiliates, on behalf of 
Rho or its affiliates.


THE RHO CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF 
ANY KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, RHO 
HEREBY DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO 
THE RHO CONTENT, AND NEITHER RHO NOR ANY OF ITS AFFILIATES SHALL IN ANY 
EVENT BE LIABLE FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT 
NOT LIMITED TO, DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE 
DAMAGES, LOSS OF PROFITS AND TRADING LOSSES, RESULTING FROM ANY PERSON'S 
USE OR RELIANCE UPON, OR INABILITY TO USE, ANY RHO CONTENT, EVEN IF RHO IS 
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR IF SUCH DAMAGES WERE 
FORESEEABLE.


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

and provide commented, minimal, self-contained, reproducible code.



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: 

Re: [R] "by" question

2009-06-24 Thread jim holtman
How about something like this:

> x
   id  data
1   1 0.7773207
2   3 0.9606180
3   2 0.4346595
4   3 0.7125147
5   2 0.344
6   2 0.3253522
7   2 0.7570871
8   3 0.2026923
9   3 0.7111212
10  2 0.1216919
> # compute running sum for each ID
> x$run <- ave(x$data, x$id, FUN=cumsum)
> x
   id  data   run
1   1 0.7773207 0.7773207
2   3 0.9606180 0.9606180
3   2 0.4346595 0.4346595
4   3 0.7125147 1.6731327
5   2 0.344 0.8346539
6   2 0.3253522 1.1600060
7   2 0.7570871 1.9170932
8   3 0.2026923 1.8758249
9   3 0.7111212 2.5869462
10  2 0.1216919 2.0387851
>


On Wed, Jun 24, 2009 at 12:08 PM, David Hugh-Jones  wrote:

> Hello all
>
> I have a big data frame and I regularly want to break it down into subsets,
> calculate some new data, and add it back to the data frame.
>
> At the moment my technique seems a bit ugly and embarrassing. Something
> like:
>
> result <- by(mydata, mydata$some_factor, function (x) {
>  # do something to create a vector v with length(v) == nrow(x)
>  return(v)
> })
> # now result has a big list, argh... how do I put it neatly back into the
> mydata data frame?
> for (i in unique(mydata$some_factor) {
> mydata$newvar[mydata$somefactor ==i] <- result[[i]]
> }
>
> What should I be doing instead of this?
>
> David Hugh-Jones
> Post-doctoral Researcher
> Max Planck Institute of Economics, Jena
> http://davidhughjones.googlepages.com
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

What is the problem that you are trying to solve?

[[alternative HTML version deleted]]

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


Re: [R] how to undo automatic loading of packages?

2009-06-24 Thread davidr
I removed all of the objects that were from the examples I tried, saved,
and quit.
R starts up cleanly now. Yeah!

That was annoying behavior, and I would recommend that the authors
change it, please.

Thank you for your to-the-point advice, Professor Ripley!
-- David
ps - Sorry for the lengthy disclaimer appended by my company - sigh.

-Original Message-
From: Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk] 
Sent: Wednesday, June 24, 2009 11:12 AM
To: David Reiner 
Cc: R-help@r-project.org
Subject: Re: [R] how to undo automatic loading of packages?

That was unintentional: the mail server crashed and apparently sent 
the just-started reply.

It is nothing to do with 'Autoloads'.  What is most likely if that you 
have saved a reference to a namespace such as 'distrMod' in your 
.RData file.  If that it is the case, when .RData is loaded it will 
load the namespace, and any namespaces it imports (and so on 
recursively).

Once distrMod's namespace is loaded, it can attach other packages, and 
indeed it does:

> loadNamespace("distrMod")
... lots of messages from those prolix authors 
> search()
  [1] ".GlobalEnv" "package:RandVar"
  [3] "package:distrEx""package:actuar"
  [5] "package:evd""package:distr"
  [7] "package:SweaveListingUtils" "package:sfsmisc"
  [9] "package:startupmsg" "package:stats"
[11] "package:graphics"   "package:grDevices"
[13] "package:utils"  "package:datasets"
[15] "package:methods""Autoloads"
[17] "package:base"

The only fix is to locate the object you saved with the reference to 
distrMod and delete it.  The only hint I can offer is that it is 
likely to be a function with namespace:distrMod as its environment.

Note that it is not regarded as good form for loading a namepace to 
attach a package, and should not be necessary.


On Wed, 24 Jun 2009, Prof Brian Ripley wrote:

> On Wed, 24 Jun 2009, dav...@rhotrading.com wrote:
>
>> I wanted to try out package distrMod, so I did
>> 
>>> install.packages('distrMod')
>>> library(distrMod)
>> 
>> and played around, saved and quit.
>> 
>> Now whenever I start up in this directory, I get distr and lots of
other
>> stuff loaded and lots of messages.
>> 
>> How do I keep it from automatically loading, other than starting over
in
>> another directory?
>> I read ?Startup, but I couldn't suss out where the autoloading was
>> occurring.
>> It probably has something to do with the "Autoloads" that shows up in
my
>> search list, but
>> I don't know how to get it out.
>> If I start up in another directory, this behavior is avoided, so I
don't
>> think it's in
>> any site files. In this session's R.home(), I have
>> $ cat .Rprofile
>> options(stringsAsFactors = FALSE)
>> so it's not in there.
>> 
>>> search()
>> [1] ".GlobalEnv" "package:grDevices"
>> "package:datasets"   "package:RandVar"
>> [5] "package:distrEx""package:actuar"
>> "package:evd""package:distr"
>> [9] "package:SweaveListingUtils" "package:sfsmisc"
>> "package:utils"  "package:stats"
>> [13] "package:startupmsg" "package:graphics"
>> "package:methods""Autoloads"
>> [17] "package:base"
>> 
>>> options("defaultPackages")
>> $defaultPackages
>> [1] "datasets"  "utils" "grDevices" "graphics"  "stats"
>> "methods"
>> 
>>> sessionInfo()
>> R version 2.9.0 (2009-04-17)
>> i386-pc-mingw32
>> 
>> locale:
>> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
>> States.1252;LC_MONETARY=English_United
>> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>> 
>> attached base packages:
>> [1] grDevices datasets  utils stats graphics  methods   base
>> 
>> 
>> other attached packages:
>> [1] RandVar_0.6.7  distrEx_2.1actuar_1.0-2
>> evd_2.2-4  distr_2.1.1
>> [6] SweaveListingUtils_0.2 sfsmisc_1.0-7  startupmsg_0.6
>> 
>> loaded via a namespace (and not attached):
>> [1] distrMod_2.1 MASS_7.2-46  stats4_2.9.0
>> 
>> Thanks for any help on this,
>> David L. Reiner
>> 
>> 
>> 
>> 
>> This e-mail and any materials attached hereto, including, without 
>> limitation, all content hereof and thereof (collectively, "Rho
Content") 
>> are confidential and proprietary to Rho Trading Securities, LLC
("Rho") 
>> and/or its affiliates, and are protected by intellectual property
laws. 
>> Without the prior written consent of Rho, the Rho Content may not (i)
be 
>> disclosed to any third party or (ii) be reproduced or otherwise used
by 
>> anyone other than current employees of Rho or its affiliates, on
behalf of 
>> Rho or its affiliates.
>> 
>> THE RHO CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR
WARRANTIES OF 
>> ANY KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW,
RHO 
>> HEREBY DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED,
RELATING TO 
>> THE RHO CONTENT, AND NEITHER RHO NOR ANY OF ITS AFFILIATES SHALL IN
ANY 
>> EVENT BE LIABL

Re: [R] [Classification] lifting score in R

2009-06-24 Thread Michael
Thanks a lot!

Yet is there a way to incorporate the lifting score into Cross
Validation, not just a plot?

Thanks again!

On Wed, Jun 24, 2009 at 9:07 AM, Tobias Sing wrote:
> Michael,
>
> a lift chart for evaluating binary scoring classifiers, as I
> understand it, plots...
>
> lift score: P(Yhat = + | Y = +)/P(Yhat = +)
> against
> rate of rate of positive predictions: P(Yhat = +).
>
> ...across the continuum of possible cutoffs. If you want to do this,
> here is how you would do this with ROCR:
>
> library(ROCR)
> x <- your.predicted.scores
> y <- your.true.class.labels
> pred <- prediction(x, y)
> perf <- performance(pred, 'lift', 'rpp')
> plot(perf)
>
> x and y can be vectors, or, in the case of cross-validation, data
> frames or lists representing the individual cross-validation runs.
> See the ROCR help pages ?performance, help(package=ROCR) and this slide deck:
> http://rocr.bioinf.mpi-sb.mpg.de/ROCR_Talk_Tobias_Sing.ppt
>
> HTH,
>  Tobias
>
>
>
> On Wed, Jun 24, 2009 at 5:17 PM, Michael wrote:
>> Hi all,
>>
>> Could anybody give me some pointers to Cross Validation using Lifting
>> Score as error function, as commonly used in data-mining and
>> classification field in marketing and e-commerce research?
>>
>> Thanks!
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

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


[R] How to avoid ifelse statement converting factor to character

2009-06-24 Thread Mark Na
Hi R-helpers,

Please see the below R output.
The problem is that after running the ifelse statement, data$SOCIAL_STATUS
is converted from a factor to a character.

Is there some way I can avoid this conversion?

Thanks in advance, Mark Na


> str(data)
'data.frame': 2100 obs. of  11 variables:
$ DATE   : Factor w/ 5 levels "4-Jun-09","7-May-09",..: 1 1 1 1 1 1
1 1 1 1 ...
$ POND_ID: Factor w/ 113 levels "10","18","19",..: 8 8 8 8 8 8 8 8 8
8 ...
$ STATUS : num  1 1 1 1 1 1 1 1 1 1 ...
$ SPECIES: Factor w/ 25 levels "AGWT","AMCO",..: 10 10 7 7 3 5 5 5 5
2 ...
$ SOCIAL_STATUS  : Factor w/ 8 levels "A","B","D","E",..: 4 1 4 1 4 4 4 4 1
6 ...
$ COUNT_OF_GROUPS: num  1 1 1 1 1 3 3 3 1 2 ...
$ MALE   : num  1 1 1 1 1 1 1 1 1 0 ...
$ FEMALE : num  1 0 1 0 1 1 1 1 0 0 ...
$ NOSEX  : num  0 0 0 0 0 0 0 0 0 2 ...
$ UPLAND : num  0 0 0 0 0 0 0 0 0 0 ...
$ TAG: num  0 0 0 0 0 0 0 0 0 0 ...

> data$SOCIAL_STATUS<-ifelse(data$SOCIAL_STATUS=="B" & data$MALE>4, "C",
data$SOCIAL_STATUS)

> str(data)
'data.frame': 2100 obs. of  11 variables:
$ DATE   : Factor w/ 5 levels "4-Jun-09","7-May-09",..: 1 1 1 1 1 1
1 1 1 1 ...
$ POND_ID: Factor w/ 113 levels "10","18","19",..: 8 8 8 8 8 8 8 8 8
8 ...
$ STATUS : num  1 1 1 1 1 1 1 1 1 1 ...
$ SPECIES: Factor w/ 25 levels "AGWT","AMCO",..: 10 10 7 7 3 5 5 5 5
2 ...
$ SOCIAL_STATUS  : chr  "4" "1" "4" "1" ...
$ COUNT_OF_GROUPS: num  1 1 1 1 1 3 3 3 1 2 ...
$ MALE   : num  1 1 1 1 1 1 1 1 1 0 ...
$ FEMALE : num  1 0 1 0 1 1 1 1 0 0 ...
$ NOSEX  : num  0 0 0 0 0 0 0 0 0 2 ...
$ UPLAND : num  0 0 0 0 0 0 0 0 0 0 ...
$ TAG: num  0 0 0 0 0 0 0 0 0 0 ...

[[alternative HTML version deleted]]

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


Re: [R] lmList

2009-06-24 Thread Daniel Malter
Cecilia, this is impossible to tell from the information you provide. The
simulated data below...

##START
year=rep(1:10,10)
year.fe=rep(rgamma(10,10,2),10)
firm.fe=rep(rnorm(10,0,3),each=10)
x=rnorm(100,0,3)
e=rnorm(100,0,3)
y=10+firm.fe+year.fe+x+e
newdata=data.frame(y,x,e,firm,year,firm.fe,year.fe)

reg=lm(y~x,subset=year%in%c(1))
summary(reg)


library(nlme)
reg=lmList(y~x|year,data=newdata)
summary(reg)
##END


...produces the exact same estimates in lm (base) and in lmList (nlme).
Thus, the mistake lies most probably somewhere in your data setup. For
example, sometimes the data you provide to lmList can differ because in lm
the data may be taken from the global environment, whereas you explicitly
provide the dataset in lmList. If they do not perfectly coincide, you would
naturally see differences. Therefore, provide the explicit dataset to lm
too. (for the above example: reg=lm(y~x,subset=year%in%c(1),data=newdata).
If you still observe differences, you have to be more specific and provide
your data and code...

Hope that helps,
Daniel

-
cuncta stricte discussurus
-

-Ursprüngliche Nachricht-
Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im
Auftrag von Cecilia Carmo
Gesendet: Wednesday, June 24, 2009 8:23 AM
An: r-help@r-project.org
Betreff: [R] lmList

Hi R-helpers:

I have a function f<-y~a+b.x and my data is an unbalanced panel data (a
dataframe with columns: firm,year,y,x). I need to run that regression by
year. I started to subset the data by year and run the lm () function, but I
asked R help how to perform this regressions at once. One of the suggestions
was to run lmList (y ~ a + b.x  | year, …) but the coefficients that I
obtain are different from those I have before. Someone could explain me why?

Thank you,
Cecília Carmo (Universidade de Aveiro - Portugal)

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

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


[R] Problem installing RODBC package under UBUNTU

2009-06-24 Thread Luis Ridao Cruz
R-help,

I'm now on the process of installing RODBC on UBUNTU
but an error occured. I copy-paste the output:

> install.packages("RODBC")
Warning in install.packages("RODBC") :
  argument 'lib' is missing: using 
'/home/luisridaocruz/R/x86_64-pc-linux-gnu-library/2.8'
trying URL 'http://cran.ii.uib.no/src/contrib/RODBC_1.2-6.tar.gz'
Content type 'application/x-gzip' length 123956 bytes (121 Kb)
opened URL
==
downloaded 121 Kb

* Installing *source* package 'RODBC' ...
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sql.h usability... no
checking sql.h presence... no
checking for sql.h... no
checking sqlext.h usability... no
checking sqlext.h presence... no
checking for sqlext.h... no
configure: error: "ODBC headers sql.h and sqlext.h not found"
ERROR: configuration failed for package 'RODBC'
** Removing '/home/luisridaocruz/R/x86_64-pc-linux-gnu-library/2.8/RODBC'

The downloaded packages are in
/tmp/RtmpWqXfbD/downloaded_packages
Warning message:
In install.packages("RODBC") :
  installation of package 'RODBC' had non-zero exit status

#
#
$ uname -a
Linux ubuntu 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:58:03 UTC 2009 
x86_64 GNU/Linux

> version
   _   
platform   x86_64-pc-linux-gnu 
arch   x86_64  
os linux-gnu   
system x86_64, linux-gnu   
status 
major  2   
minor  8.1 
year   2008
month  12  
day22  
svn rev47281   
language   R   
version.string R version 2.8.1 (2008-12-22)

##
##

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


[R] change the height or scale of the y axis

2009-06-24 Thread legen

Hallo, All,

I have a question about changing the height or scale of the y axis. When I
use following two R codes, I can get two plots. Please look at the y axes,
the number of indices (x1, x2, …) on the y axis in the first plot is smaller
than that in the second plot, and hence the space between any two indices in
the first plot is wider than that in the second plot. As the number of
indices increases, the space will vanish and the indices will overlap. I
want to display all the indices on the y axis in the second plot, just look
like that in the first plot. How to separate the indices on the y axis in
the second plot? I guess maybe changing the height or scale of y axis is a
way to solve my problem, but I failed to do it after several trails. Anybody
can help me? Thank you in advance.

Legen

The first R code:
x<-c("x1","x2","x3","x4","x5","x6","x7","x8","x9","x10")
y<-sample(0:100,10,replace=F)
d<-data.frame(y)
rownames(d)<-x
r<-nrow(d)
i<-1:r
plot(d$y,i,xlab="",ylab="",axes=F)
axis(1)
axis(2,at=i,labels=x)

The second R code:
x<-c("x1","x2","x3","x4","x5","x6","x7","x8","x9","x10",
 "x11","x12","x13","x14","x15","x16","x17","x18","x19","x20",
 "x21","x22","x23","x24","x25","x26","x27","x28","x29","x30",
 "x31","x32","x33","x34","x35","x36","x37","x38","x39","x40",
 "x41","x42","x43","x44","x45","x46","x47","x48","x49","x50",
 "x51","x52","x53","x54","x55","x56","x57","x58","x59","x60",
 "x61","x62","x63","x64","x65","x66","x67","x68","x69","x70",
 "x71","x72","x73","x74","x75","x76","x77","x78","x79","x80",
 "x81","x82","x83","x84","x85","x86","x87","x88","x89","x90",
 "x91","x92","x93","x94","x95","x96","x97","x98","x99","x100",
 "x101","x102","x103","x104","x105","x106","x107","x108","x109","x110",
 "x111","x112","x113","x114","x115","x116","x117","x118","x119","x120",
 "x121","x122","x123","x124","x125","x126","x127","x128","x129","x130",
 "x131","x132","x133","x134","x135","x136","x137","x138","x139","x140",
 "x141","x142","x143","x144","x145","x146","x147","x148","x149","x150",
 "x151","x152","x153","x154","x155","x156","x157","x158","x159","x160",
 "x161","x162","x163","x164","x165","x166","x167","x168","x169","x170",
 "x171","x172","x173","x174","x175","x176","x177","x178","x179","x180",
 "x181","x182","x183","x184","x185","x186","x187","x188","x189","x190",
 "x191","x192","x193","x194","x195","x196","x197","x198","x199","x200")
y<-sample(0:300,200,replace=F)
d<-data.frame(y)
rownames(d)<-x
r<-nrow(d)
i<-1:r
plot(d$y,i,xlab="",ylab="",axes=F)
axis(1)
axis(2,at=i,labels=x)

-- 
View this message in context: 
http://www.nabble.com/change-the-height-or-scale-of-the-y-axis-tp24187351p24187351.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] How to avoid ifelse statement converting factor to character

2009-06-24 Thread Henrique Dallazuanna
You can work with levels of factor:

levels(DF$SOCIAL_STATUS)[DF$MALE > 4 & DF$SOCIAL_STATUS == "B"] <- "C"

On Wed, Jun 24, 2009 at 1:34 PM, Mark Na  wrote:

> Hi R-helpers,
>
> Please see the below R output.
> The problem is that after running the ifelse statement, data$SOCIAL_STATUS
> is converted from a factor to a character.
>
> Is there some way I can avoid this conversion?
>
> Thanks in advance, Mark Na
>
>
> > str(data)
> 'data.frame': 2100 obs. of  11 variables:
> $ DATE   : Factor w/ 5 levels "4-Jun-09","7-May-09",..: 1 1 1 1 1 1
> 1 1 1 1 ...
> $ POND_ID: Factor w/ 113 levels "10","18","19",..: 8 8 8 8 8 8 8 8
> 8
> 8 ...
> $ STATUS : num  1 1 1 1 1 1 1 1 1 1 ...
> $ SPECIES: Factor w/ 25 levels "AGWT","AMCO",..: 10 10 7 7 3 5 5 5
> 5
> 2 ...
> $ SOCIAL_STATUS  : Factor w/ 8 levels "A","B","D","E",..: 4 1 4 1 4 4 4 4 1
> 6 ...
> $ COUNT_OF_GROUPS: num  1 1 1 1 1 3 3 3 1 2 ...
> $ MALE   : num  1 1 1 1 1 1 1 1 1 0 ...
> $ FEMALE : num  1 0 1 0 1 1 1 1 0 0 ...
> $ NOSEX  : num  0 0 0 0 0 0 0 0 0 2 ...
> $ UPLAND : num  0 0 0 0 0 0 0 0 0 0 ...
> $ TAG: num  0 0 0 0 0 0 0 0 0 0 ...
>
> > data$SOCIAL_STATUS<-ifelse(data$SOCIAL_STATUS=="B" & data$MALE>4, "C",
> data$SOCIAL_STATUS)
>
> > str(data)
> 'data.frame': 2100 obs. of  11 variables:
> $ DATE   : Factor w/ 5 levels "4-Jun-09","7-May-09",..: 1 1 1 1 1 1
> 1 1 1 1 ...
> $ POND_ID: Factor w/ 113 levels "10","18","19",..: 8 8 8 8 8 8 8 8
> 8
> 8 ...
> $ STATUS : num  1 1 1 1 1 1 1 1 1 1 ...
> $ SPECIES: Factor w/ 25 levels "AGWT","AMCO",..: 10 10 7 7 3 5 5 5
> 5
> 2 ...
> $ SOCIAL_STATUS  : chr  "4" "1" "4" "1" ...
> $ COUNT_OF_GROUPS: num  1 1 1 1 1 3 3 3 1 2 ...
> $ MALE   : num  1 1 1 1 1 1 1 1 1 0 ...
> $ FEMALE : num  1 0 1 0 1 1 1 1 0 0 ...
> $ NOSEX  : num  0 0 0 0 0 0 0 0 0 2 ...
> $ UPLAND : num  0 0 0 0 0 0 0 0 0 0 ...
> $ TAG: num  0 0 0 0 0 0 0 0 0 0 ...
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

[[alternative HTML version deleted]]

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


Re: [R] "by" question

2009-06-24 Thread David Hugh-Jones
That seems to work. I should add that to make "ave" work like "by" one can
do:

mydata$newvar <- ave(1:nrow(mydata), mydata$some_factor, FUN= function (x) {
  x <- ds[x,]
# ... etc...
})

Thanks!
David

[[alternative HTML version deleted]]

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



Re: [R] How to avoid ifelse statement converting factor to character

2009-06-24 Thread Bert Gunter
Explicitly convert it to a factor...

data$SOCIAL_STATUS<-factor(ifelse(data$SOCIAL_STATUS=="B" & data$MALE>4,
"C", data$SOCIAL_STATUS))

However, note that this would, in general, change the levels attribute to
the levels actually present in the converted vector. If you wish to (and it
makes sense to) retain the original levels, you will have to set them
explicitly in the factor() call, I believe.

I believe the reason this occurs is that ifelse() could (and usually would)
change the values present, which would mess up the levels of the factor. So
default conversion to character seems like desirable behavior to me. It's
then up to the user to recreate the factor as appropriate.


Bert Gunter
Genentech Nonclinical Biostatistics


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Mark Na
Sent: Wednesday, June 24, 2009 9:34 AM
To: r-help@r-project.org
Subject: [R] How to avoid ifelse statement converting factor to character

Hi R-helpers,

Please see the below R output.
The problem is that after running the ifelse statement, data$SOCIAL_STATUS
is converted from a factor to a character.

Is there some way I can avoid this conversion?

Thanks in advance, Mark Na


> str(data)
'data.frame': 2100 obs. of  11 variables:
$ DATE   : Factor w/ 5 levels "4-Jun-09","7-May-09",..: 1 1 1 1 1 1
1 1 1 1 ...
$ POND_ID: Factor w/ 113 levels "10","18","19",..: 8 8 8 8 8 8 8 8 8
8 ...
$ STATUS : num  1 1 1 1 1 1 1 1 1 1 ...
$ SPECIES: Factor w/ 25 levels "AGWT","AMCO",..: 10 10 7 7 3 5 5 5 5
2 ...
$ SOCIAL_STATUS  : Factor w/ 8 levels "A","B","D","E",..: 4 1 4 1 4 4 4 4 1
6 ...
$ COUNT_OF_GROUPS: num  1 1 1 1 1 3 3 3 1 2 ...
$ MALE   : num  1 1 1 1 1 1 1 1 1 0 ...
$ FEMALE : num  1 0 1 0 1 1 1 1 0 0 ...
$ NOSEX  : num  0 0 0 0 0 0 0 0 0 2 ...
$ UPLAND : num  0 0 0 0 0 0 0 0 0 0 ...
$ TAG: num  0 0 0 0 0 0 0 0 0 0 ...

> data$SOCIAL_STATUS<-ifelse(data$SOCIAL_STATUS=="B" & data$MALE>4, "C",
data$SOCIAL_STATUS)

> str(data)
'data.frame': 2100 obs. of  11 variables:
$ DATE   : Factor w/ 5 levels "4-Jun-09","7-May-09",..: 1 1 1 1 1 1
1 1 1 1 ...
$ POND_ID: Factor w/ 113 levels "10","18","19",..: 8 8 8 8 8 8 8 8 8
8 ...
$ STATUS : num  1 1 1 1 1 1 1 1 1 1 ...
$ SPECIES: Factor w/ 25 levels "AGWT","AMCO",..: 10 10 7 7 3 5 5 5 5
2 ...
$ SOCIAL_STATUS  : chr  "4" "1" "4" "1" ...
$ COUNT_OF_GROUPS: num  1 1 1 1 1 3 3 3 1 2 ...
$ MALE   : num  1 1 1 1 1 1 1 1 1 0 ...
$ FEMALE : num  1 0 1 0 1 1 1 1 0 0 ...
$ NOSEX  : num  0 0 0 0 0 0 0 0 0 2 ...
$ UPLAND : num  0 0 0 0 0 0 0 0 0 0 ...
$ TAG: num  0 0 0 0 0 0 0 0 0 0 ...

[[alternative HTML version deleted]]

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

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


Re: [R] Problem installing RODBC package under UBUNTU

2009-06-24 Thread Dirk Eddelbuettel

Luis,

On 24 June 2009 at 16:35, Luis Ridao Cruz wrote:
| R-help,
| 
| I'm now on the process of installing RODBC on UBUNTU
| but an error occured. I copy-paste the output:

You can simply do 

   $ sudo apt-get install r-cran-rodbc


As for the error:

| > install.packages("RODBC")
[...]
| configure: error: "ODBC headers sql.h and sqlext.h not found"

That is about as plain as it gets. You need these headers. There is also
README in the sources with more detail.

If you're in a hurry, why don't you 

   a) install the binary packafe and 

   b) learn about the CRAN repository for Ubuntu that has binaries of R 2.9.0 
  for you and

   c) consider subscribing to the r-sig-debian list we have for Debian and
  Ubuntu questions.

Hth, Dirk

-- 
Three out of two people have difficulties with fractions.

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


[R] Coxph frailty model counting process error X matrix deemed singular

2009-06-24 Thread Porter, Aaron T
Hello,

I am currently trying to simulate data and analyze it using the frailty option 
in the coxph function.  I am working with recurrent event data, using counting 
process notation.  Occasionally, (about 1 in every 100 simulations) I get the 
following warning: 

Error in coxph(Surv(start, end, censorind) ~ binary + uniform + 
frailty(subject,  : 
  X matrix deemed to be singular; variable 2

My data is structured as follows: I have a Bernoulli random variable 
(parameter=0.5) (labeled "binary") and a second variable which was generated as 
seq(0.02, 1, 0.02), which is labeled as "uniform".  There are 50 individual 
subjects.  Recurrent events are then generated as rexp(1, 
0.2*frailparm[j]*exp(mydata[j,1]*alpha[1]+mydata[j,2]*alpha[2])) where mydata 
is the cbind of the data just mentioned, alpha are the parameters for the 
recurrent events (here I am using c(1,1)) and frailparm is the frailty term for 
subject {j}.  I generate recurrent events until the sum of the times is greater 
than the terminal time or censoring time, and keep the previous highest time as 
my final recurrent time, with one additional time which is censored at the 
minimum of the terminal event time and the censoring time.  I then repeat for 
each subject.

I then try to analyze the data like this: 
coxph(Surv(start,end,censorind)~binary+uniform+frailty(subject,distribution="gauss",
 method="reml"), method="breslow", singular.ok=FALSE, data=fulldata) 
Where start is the previous recurrent time, end is the current recurrent time, 
censorind is the censoring indicator for the current recurrent time, and 
subject is the current observation.

There does not appear to be an issue with the binary variable taking a 
particular value for every observed event time, nor does there appear to be 
perfect correlation between the variable "uniform" and the survival time.

Any help would be much appreciated.

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


Re: [R] Qualified parameters in SOAP body using .SOAP

2009-06-24 Thread Duncan Temple Lang


Hi Olivier

Olivier Cailloux wrote:

Hello,

I am trying to reach a web service using the SOAP package. I succeeded 
calling the web service, but not sending parameters to it. After much 
research and tries, I think I found that the problem lies in the 
namespace including the parameters in the SOAP body.


There's no doubt that the SSOAP package doesn't cover all possible cases
from the SOAP specification. But before adding support for additional
types of server, can you point me to where in the specification or
in the research you did that indicates what the namespace should
be for this situation. That would be helpful.

Since this client - server computing an error could be in either the 
client or the server, or both.   Looking at the WSDL, it appears
that this might have been created manually. Is this the case? and is the 
server implemented via standard toolkits or home-grown? Regardless

of how it is created, we just want to make certain it is correct.

Now, as for an easy solution to the problem
You can cause the writeSOAPBody() method to avoid defining
a default namespace on the  node in the body of the message.
You do this by putting a name on the character vector giving the 
namespaces, e.g.


 xmlns = c(x = "http://web2.web";)

in the call.  So

contentGreet <- .SOAP(server=smg8TestService, method="greetMe",
  arg0="Olivier", action="",
  xmlns=c(x = "http://web2.web/";),
  .convert=FALSE)

works just fine.


 D.





In short, my question is: how can I send unqualified parameters in the 
SOAP body of a call produced through the SOAP package? Details of what I 
try to do follow.


The SOAP package sends this soap envelope to my test web service (wsdl 
here [http://smg8.ulb.ac.be:8080/web2?wsdl]).
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>

 
   http://web2.web/";>
 Olivier
   
 


The R commands used are:
library("SSOAP")
smg8TestService <- SOAPServer("smg8.ulb.ac.be", "/web2/TestService", 8080)
contentGreet <- .SOAP(server=smg8TestService, method="greetMe", 
arg0="Olivier", action="", xmlns="http://web2.web/";, .convert=FALSE)


But, AFAIU, the arg0 tag should NOT be qualified, according to the WSDL. 
Hence, my web service implementation never receives the "Olivier" 
argument and rather receives "null" as the string parameter.


When calling the web service using an other client (eclipse Web services 
explorer), I see it generates the following body:
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:q0="http://web2.web/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>

 
   
 Olivier-from-eclipse
   
 


Thus with the "arg0" tag being unqualified (i.e. not in the 
"http://web2.web/"; namespace). And that works: my web service 
implementation indeed receives the "Olivier-from-eclipse" parameter as 
string.


Can anyone confirm that my understanding of what happens and why my web 
service implementation, when called by the R client, does not see the 
parameters, seems correct?


If it seems correct, then how can I send unqualified parameters in the 
SOAP body using the SOAP package? Thanks for any help!

Olivier

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

and provide commented, minimal, self-contained, reproducible code.


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


Re: [R] I meant bwlabel

2009-06-24 Thread Sandor Benczik


aliceduggan wrote:
> 
> Sorry I meant bwlabel on this message
> [...]
> I am using R-Image in an MSc statistics dissertation and have found, in
> various EBImage manuals a functions - bwimage, which I would like to use,
> however I can't find it within my version of R.
> Could you tell me if the function has changed or what I need to do to be
> able to use it.
> 
Alice,

I am not familiar with the given function, but I would first make sure that
the package containing it is installed and loaded. Try

1. Type: 
library()
Is the EBImage package in the list? 

2. If it is not listed  you will need to install it. See its homepage  
http://www.bioconductor.org/packages/devel/bioc/html/EBImage.html 
http://www.bioconductor.org/packages/devel/bioc/html/EBImage.html  for
instructions. Do you get any errors?

3. If no errors, try loading it with 
library(EBImage)
Check for errors.

If you get errors in any of the above steps and the function is still
missing, you might get a moe knowlegdeable answer on the 
https://stat.ethz.ch/mailman/listinfo/bioconductor  
https://stat.ethz.ch/mailman/listinfo/bioconductor   list. 

Sandor
-- 
View this message in context: 
http://www.nabble.com/I-meant-bwlabel-tp24184106p24189646.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Goodness of fit test / pseudo r^2 measure for Zero Inflated Model

2009-06-24 Thread lara harrup (IAH-P)
Hi 

 

I have been using a Zero-Inflated negative binomial model fitted using
the pscl zeroinfl command but I would like to extract a goodness of fit
measure are there any suitable pseudo R^2 measures available for this
type of analysis to try and assess the amount of variation in the data
explained by the model?

 

I have tried with the pR2 command in pscl (for computing various pseudo
R2 measures), the same package as zeroinfl, but I get the message that
there is no-applicable method when I try it with a zeroinfl model. Any
suggestions most appreciated.

 

Many thanks in advance

 

Lara

 


[[alternative HTML version deleted]]

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


[R] How to recursively build a binary tree with R script?

2009-06-24 Thread Mike Beddo
Greetings!

Can someone provide a simple script for a R function that recursively builds a 
binary tree. I am most familiar with C and pass by reference, but I think R is 
like Fortran and pass by value.

- Mike Beddo

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


[R] agrep behavior

2009-06-24 Thread Eduardo Leoni
Dear list -

I am a bit puzzled by the behavior of agrep:

The following command finds a match:

agrep("Staatssekretar im Bundeskanzleramt","Bundeskanzler",max.distance=.6)

But if I _increase_ the maximum distance to .9 it fails:

agrep("Staatssekretar im Bundeskanzleramt","Bundeskanzler",max.distance=.9)

What am I missing? (If we use integers in max.distance the threshold
is between 30 and 31)

-Eduardo

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


[R] subplot()

2009-06-24 Thread Kexin Ji

Hi,

I'm trying to get a color-gradient triangle out of a large plot.
Wonder can subplot() generate a triangle?
So far, I'm only getting rectangles.
Great appreciation for any reply!!

Kexin

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


[R] Reading 4-byte float into R from binary file

2009-06-24 Thread Sean Davis
A simple question, I hope  I have a binary file format that I want to
slurp into R using readBin.  There are a couple of fields in the file that
are 4-byte floats.  Since R has no "float" data type (4-byte), I am
wondering how to go about this task.  I could simply do all the work in C,
but the format is pretty simple, so I wanted to do it using just R.  I did
see as.single, but it appears that is for passing things to C and not much
more.  Any suggestions appreciated.

Thanks,
Sean

[[alternative HTML version deleted]]

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


Re: [R] "by" question

2009-06-24 Thread hadley wickham
You might also want to look at the plyr package,
http://had.co.nz/plyr.  In particular, ddply + transform makes these
tasks very easy.

library(plyr)
ddply(mtcars, "cyl", transform, pos = seq_along(cyl), mpg_avg = mean(mpg))

Hadley

On Wed, Jun 24, 2009 at 11:48 AM, David
Hugh-Jones wrote:
> That seems to work. I should add that to make "ave" work like "by" one can
> do:
>
> mydata$newvar <- ave(1:nrow(mydata), mydata$some_factor, FUN= function (x) {
>  x <- ds[x,]
> # ... etc...
> })
>
> Thanks!
> David
>
>        [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

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


Re: [R] How to avoid ifelse statement converting factor to character

2009-06-24 Thread Stavros Macrakis
On Wed, Jun 24, 2009 at 12:34 PM, Mark Na wrote:
> The problem is that after running the ifelse statement, data$SOCIAL_STATUS
> is converted from a factor to a character.
> Is there some way I can avoid this conversion?

I'm afraid that ifelse has very bizarre semantics when the yes and no
arguments don't have the same, atomic vector, type.

The quick workaround for the bizarre semantics (though it can have a
significant efficiency cost) is this:

   unlist( ifelse ( condition, as.list( yes ), as.list( no ) ) )

(This isn't perfect, either, but...)

Take a look at the man page for details and the warning:

 The mode of the result may depend on the value of 'test', and the
 class attribute of the result is taken from 'test' and may be
 inappropriate for the values selected from 'yes' and 'no'.

Some consequences of the definition of ifelse are:

Even if the classes of the yes and no arguments are identical, the
result does not necessarily have that class:

ifelse(TRUE,as.raw(4),as.raw(5)) => error

ifelse(TRUE,factor('x'),factor('x')) => 1  (integer)

dates <- as.POSIXct(c('1990-1-1','2000-1-1'))
ifelse(c(TRUE,FALSE),dates,dates)  =>  63117 946702800  (double)

ifelse(c(TRUE,FALSE),factor(c('x','y')),factor(c('y','x'))) => 1 1

If they have different classes, things get stranger:

ifelse(c(TRUE,FALSE),c("a","b"),factor(c("c","d")))  =>  "a" "2"

ifelse(c(TRUE,FALSE),list(1,2),as.raw(4))
[[1]]
[1] 1

[[2]]
[1] 04

Result is order-dependent:

ifelse(c(TRUE,FALSE),as.raw(4),list(1,2))
Error in ans[test & !nas] <- rep(yes, length.out = length(ans))[test &  :
incompatible types (from raw to logical) in subassignment type fix

Welcome to R!

 -s

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


Re: [R] Reading 4-byte float into R from binary file

2009-06-24 Thread Duncan Murdoch

On 6/24/2009 2:41 PM, Sean Davis wrote:

A simple question, I hope  I have a binary file format that I want to
slurp into R using readBin.  There are a couple of fields in the file that
are 4-byte floats.  Since R has no "float" data type (4-byte), I am
wondering how to go about this task.  I could simply do all the work in C,
but the format is pretty simple, so I wanted to do it using just R.  I did
see as.single, but it appears that is for passing things to C and not much
more.  Any suggestions appreciated.


You can specify the size when reading a float using 
readBin(what="numeric", size=4).  It will read a single, then convert it 
to double to store in R.  You may need to set the endian value too, if 
the byte order is wrong.


Duncan Murdoch

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


Re: [R] agrep behavior

2009-06-24 Thread David Winsemius

Unable to reproduce:

> agrep("Staatssekretar im  
Bundeskanzleramt","Bundeskanzler",max.distance=.6)

[1] 1
>
> agrep("Staatssekretar im  
Bundeskanzleramt","Bundeskanzler",max.distance=.89)

[1] 1
> agrep("Staatssekretar im  
Bundeskanzleramt","Bundeskanzler",max.distance=.9)

[1] 1
> agrep("Staatssekretar im  
Bundeskanzleramt","Bundeskanzler",max.distance=.99)

[1] 1


Using integers the threshold is between 20 and 21. Something to do mit  
encodings?


> sessionInfo()
R version 2.8.1 Patched (2009-01-19 r47650)
i386-apple-darwin9.6.0

locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

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

On Jun 24, 2009, at 2:06 PM, Eduardo Leoni wrote:


Dear list -

I am a bit puzzled by the behavior of agrep:

The following command finds a match:

agrep("Staatssekretar im  
Bundeskanzleramt","Bundeskanzler",max.distance=.6)


But if I _increase_ the maximum distance to .9 it fails:

agrep("Staatssekretar im  
Bundeskanzleramt","Bundeskanzler",max.distance=.9)


What am I missing? (If we use integers in max.distance the threshold
is between 30 and 31)

-Eduardo



David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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


Re: [R] How to recursively build a binary tree with R script?

2009-06-24 Thread Duncan Murdoch

On 6/24/2009 2:02 PM, Mike Beddo wrote:

Greetings!

Can someone provide a simple script for a R function that recursively builds a 
binary tree. I am most familiar with C and pass by reference, but I think R is 
like Fortran and pass by value.



Here's a tree with a random depth:

makeTree <- function() {
if (runif(1) < 0.4) list(makeTree(), makeTree())
else "leaf"
}

Duncan Murdoch

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


[R] Why can't I use ADF.test?

2009-06-24 Thread DongHongwei

Greetings!
I'm trying to use R to test the unit root for a univariate data. By this link: 
http://rss.acs.unt.edu/Rdoc/library/uroot/html/ADF.test.html
 it tells me that I can use the function ADF.test(). However, when I tried this 
in R, I got this message:
"Error: could not find function "ADF.test"".
I'm confused by this. Anyone could give me some hints? Thanks.
Hongwei



_
´ò¹¤£¬ÕõÇ®£¬Âò·¿×Ó£¬¿ìÀ´MClubÒ»Æ𡱽ðÎݲؽ¿¡±£¡

[[alternative HTML version deleted]]

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


Re: [R] Why can't I use ADF.test?

2009-06-24 Thread Richardson, Patrick
Since you provided no code, the following is just a guess,  Try:

install.packages("uroot")
library(uroot)

Then try your analysis again.


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of DongHongwei
Sent: Wednesday, June 24, 2009 3:06 PM
To: r-help@r-project.org
Subject: [R] Why can't I use ADF.test?


Greetings!
I'm trying to use R to test the unit root for a univariate data. By this link: 
http://rss.acs.unt.edu/Rdoc/library/uroot/html/ADF.test.html
 it tells me that I can use the function ADF.test(). However, when I tried this 
in R, I got this message:
"Error: could not find function "ADF.test"".
I'm confused by this. Anyone could give me some hints? Thanks.
Hongwei



_
´ò¹¤£¬ÕõÇ®£¬Âò·¿×Ó£¬¿ìÀ´MClubÒ»Æ𡱽ðÎݲؽ¿¡±£¡

[[alternative HTML version deleted]]

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

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


Re: [R] agrep behavior

2009-06-24 Thread Eduardo Leoni
Thanks David, for trying to replicate. May be it is a 2.9 problem? I
should have attached session info:

> agrep("Staatssekretar im Bundeskanzleramt","Bundeskanzler",max.distance=.9)
integer(0)
> agrep("Staatssekretar im Bundeskanzleramt","Bundeskanzler",max.distance=.7)
[1] 1

sessionInfo()
R version 2.9.0 (2009-04-17)
i386-apple-darwin8.11.1

locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

The same problem occurs on windows:

> sessionInfo()
R version 2.9.0 (2009-04-17)
i386-pc-mingw32

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

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





On Wed, Jun 24, 2009 at 2:57 PM, David Winsemius wrote:
> Unable to reproduce:
>
>> agrep("Staatssekretar im
>> Bundeskanzleramt","Bundeskanzler",max.distance=.6)
> [1] 1
>>
>> agrep("Staatssekretar im
>> Bundeskanzleramt","Bundeskanzler",max.distance=.89)
> [1] 1
>> agrep("Staatssekretar im
>> Bundeskanzleramt","Bundeskanzler",max.distance=.9)
> [1] 1
>> agrep("Staatssekretar im
>> Bundeskanzleramt","Bundeskanzler",max.distance=.99)
> [1] 1
>
>
> Using integers the threshold is between 20 and 21. Something to do mit
> encodings?
>
>> sessionInfo()
> R version 2.8.1 Patched (2009-01-19 r47650)
> i386-apple-darwin9.6.0
>
> locale:
> en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> On Jun 24, 2009, at 2:06 PM, Eduardo Leoni wrote:
>
>> Dear list -
>>
>> I am a bit puzzled by the behavior of agrep:
>>
>> The following command finds a match:
>>
>> agrep("Staatssekretar im
>> Bundeskanzleramt","Bundeskanzler",max.distance=.6)
>>
>> But if I _increase_ the maximum distance to .9 it fails:
>>
>> agrep("Staatssekretar im
>> Bundeskanzleramt","Bundeskanzler",max.distance=.9)
>>
>> What am I missing? (If we use integers in max.distance the threshold
>> is between 30 and 31)
>>
>> -Eduardo
>
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
>



-- 
Science is the art of the soluble. (Peter Medawar)

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


Re: [R] subplot()

2009-06-24 Thread Greg Snow
The subplot function (at least the one in the TeachingDemos package and the 
copy in Hmisc) only does rectangles.  Clipping regions are also limited to 
rectangles currently.  There are external tools (gimp, imagemagick) that may me 
of use or triangles and other shapes can be approximated by enough small 
rectangles.  If you give a bit more detail about what you are trying to do then 
we can give more specific help.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Kexin Ji
> Sent: Monday, June 23, 2008 12:38 PM
> To: r-help@r-project.org
> Subject: [R] subplot()
> 
> Hi,
> 
> I'm trying to get a color-gradient triangle out of a large plot.
> Wonder can subplot() generate a triangle?
> So far, I'm only getting rectangles.
> Great appreciation for any reply!!
> 
> Kexin
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Why can't I use ADF.test?

2009-06-24 Thread DongHongwei

Thanks! I tried these, but I got the following messages:Warning message:In 
getDependencies(pkgs, dependencies, available, lib) :  package ‘uroot’ is 
not available
Error in library(uroot) : there is no package called 'uroot'


I download a package called "uroot" and put it into: C:\Program 
Files\R\R-2.9.0\library. But still got the same error. Any further suggestions?
  Hongwei 


> From: patrick.richard...@vai.org
> To: dongh...@hotmail.com; r-help@r-project.org
> Date: Wed, 24 Jun 2009 15:12:22 -0400
> Subject: RE: [R] Why can't I use ADF.test?
> 
> Since you provided no code, the following is just a guess,  Try:
> 
> install.packages("uroot")
> library(uroot)
> 
> Then try your analysis again.
> 
> 
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
> Behalf Of DongHongwei
> Sent: Wednesday, June 24, 2009 3:06 PM
> To: r-help@r-project.org
> Subject: [R] Why can't I use ADF.test?
> 
> 
> Greetings!
> I'm trying to use R to test the unit root for a univariate data. By this 
> link: 
> http://rss.acs.unt.edu/Rdoc/library/uroot/html/ADF.test.html
>  it tells me that I can use the function ADF.test(). However, when I tried 
> this in R, I got this message:
> "Error: could not find function "ADF.test"".
> I'm confused by this. Anyone could give me some hints? Thanks.
> Hongwei
> 
> 
> 
> _
> ´ò¹¤£¬ÕõÇ®£¬Âò·¿×Ó£¬¿ìÀ´MClubÒ»Æ𡱽ðÎݲؽ¿¡±£¡
> 
>   [[alternative HTML version deleted]]
> 
> This email message, including any attachments, is for the sole use of the 
> intended recipient(s) and may contain confidential information.  Any 
> unauthorized review, use, disclosure or distribution is prohibited.  If you 
> are not the intended recipient(s) please contact the sender by reply email 
> and destroy all copies of the original message.  Thank you.

_
Messenger安全保护中心,免费修复系统漏洞,保护Messenger安全!
http://im.live.cn/safe/
[[alternative HTML version deleted]]

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


[R] distinguish regression lines in grouped, black and white lattice xyplot

2009-06-24 Thread Katharina May
Hi,

I've got the following problem which I cannot think of a solution right now:

if got a lattice xyplot in black and white and a grouping variable
with many (more than 8
values) and I plot it as regression lines (type="r"), just like this
one (not reproducable but that's
I guess not the point here):

xyplot(log(AGWB) ~ log(BM_roots), data=sub_agwb_data, groups=species,
type="r", lty=c(1:6),panel=allo.panel.5)

The problem is that I've got 26 different values for the grouping
variable species and only 6 default values for the line type
lty (and according to the par {graphics} help page customizable to up
to 8 different line types).

Does anybody have any idea how these 26 different lines can be made
distinguishable from each other without the use
of colors?

Thanks,

 Katharina

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


Re: [R] distinguish regression lines in grouped, black and white lattice xyplot

2009-06-24 Thread Chuck Cleland
On 6/24/2009 3:28 PM, Katharina May wrote:
> Hi,
> 
> I've got the following problem which I cannot think of a solution right now:
> 
> if got a lattice xyplot in black and white and a grouping variable
> with many (more than 8
> values) and I plot it as regression lines (type="r"), just like this
> one (not reproducable but that's
> I guess not the point here):
> 
> xyplot(log(AGWB) ~ log(BM_roots), data=sub_agwb_data, groups=species,
> type="r", lty=c(1:6),panel=allo.panel.5)
> 
> The problem is that I've got 26 different values for the grouping
> variable species and only 6 default values for the line type
> lty (and according to the par {graphics} help page customizable to up
> to 8 different line types).
> 
> Does anybody have any idea how these 26 different lines can be made
> distinguishable from each other without the use
> of colors?

  If you need to distinguish individual regression lines, I would
consider 26 panels rather than attempting one panel with 26 regression
lines each of a different line type.  Something like this:

xyplot(log(AGWB) ~ log(BM_roots) | species, data=sub_agwb_data,
type="r", panel=allo.panel.5)

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

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

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


Re: [R] distinguish regression lines in grouped, black and white lattice xyplot

2009-06-24 Thread Bert Gunter
Don't be silly. They can't be made "distinguishable" by any number of line
types and/or colors. The brain can't keep that many different symbol
representations straight. Referring back and forth to a legend is also
similarly useless. You need to think more creatively about how to make a
more meaningful display to provide viewers interpretable information.

Bert Gunter
Genentech Nonclinical Biostatistics


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Katharina May
Sent: Wednesday, June 24, 2009 12:28 PM
To: r-help@r-project.org
Subject: [R] distinguish regression lines in grouped,black and white lattice
xyplot

Hi,

I've got the following problem which I cannot think of a solution right now:

if got a lattice xyplot in black and white and a grouping variable
with many (more than 8
values) and I plot it as regression lines (type="r"), just like this
one (not reproducable but that's
I guess not the point here):

xyplot(log(AGWB) ~ log(BM_roots), data=sub_agwb_data, groups=species,
type="r", lty=c(1:6),panel=allo.panel.5)

The problem is that I've got 26 different values for the grouping
variable species and only 6 default values for the line type
lty (and according to the par {graphics} help page customizable to up
to 8 different line types).

Does anybody have any idea how these 26 different lines can be made
distinguishable from each other without the use
of colors?

Thanks,

 Katharina

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

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


Re: [R] Weighting column entries in a data frame

2009-06-24 Thread camillus

Thanks!



jholtman wrote:
> 
> Try this:
> 
>> fdata
> state statenum yearincome popul
> 1 ALABAMA11  9.703193  3973
> 2 ALABAMA12  9.745950  3992
> 3 ALABAMA13  9.762092  4015
> 4  ALASKA21 10.221640   532
> 5  ALASKA22 10.169600   544
> 6  ALASKA23 10.101300   539
>> statepops<-tapply(fdata$popul,fdata$state,sum)
>> popweight <- statepops/sum(statepops)
>> fdata$adj <- fdata$income * popweight[fdata$state]
>> fdata
> state statenum yearincome popul  adj
> 1 ALABAMA11  9.703193  3973 8.550515
> 2 ALABAMA12  9.745950  3992 8.588193
> 3 ALABAMA13  9.762092  4015 8.602417
> 4  ALASKA21 10.221640   532 1.214266
> 5  ALASKA22 10.169600   544 1.208084
> 6  ALASKA23 10.101300   539 1.199971
>>
> 
> 
> On Tue, Jun 23, 2009 at 3:11 PM, camillus 
> wrote:
> 
>>
>> Hi Guys,
>>
>> I would like to weight column entries in a data frame by the population
>> of
>> each state.  For example, here is some data:
>>
>> state statenum year incomepopul
>> ALABAMA11   9.703193  3973.00
>> ALABAMA12   9.745950  3992.00
>> ALABAMA13   9.762092  4015.00
>> ALASKA 21   10.221640 532.00
>> ALASKA 22   10.169600 544.00
>> ALASKA 23   10.101300 539.00
>>
>>
>> I would like to adjust "income" by population ("popul") for each state. 
>> I
>> can use:
>>
>> statepop<-tapply(fdata$popul,fdata$state,sum),
>>
>> which gives:
>>
>> ALABAMA ALASKA
>> 53590.130   7435.263
>>
>> I can find the weights:
>>
>> popweight <- statepops/sum(statepops)
>>
>>ALABAMA  ALASKA
>> 0.016327564 0.002265338
>>
>> Is there an efficient way to multiply each entry of "income" by
>> "popweght"
>> conditional on the state?  That is, ALABAMA income for year 1 is
>> 9.703193*0.016327564, etc.
>>
>> Thanks,
>>
>> William
>> --
>> View this message in context:
>> http://www.nabble.com/Weighting-column-entries-in-a-data-frame-tp24171435p24171435.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> 
> 
> -- 
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
> 
> What is the problem that you are trying to solve?
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Weighting-column-entries-in-a-data-frame-tp24171435p24190249.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] lmList

2009-06-24 Thread Daniel Malter
As I said, the example works. So for simulated data it works, which means
that for correctly provided data, it should work as well.

year%in%c(1) means for all years in the vector. In this case, it is
identical to year==1. However, the option I use is extendable since you
could write year%in%c(1,3,7) for example. So it would run the regression on
the data for years 1,3, and 7. This should have nothing to do whether your
analysis gives the same result as in one-by-one regressions.

Again, the best advice is that you should check that the data the
regressions are run on are absolutely identical. If they are, the results
should be the same.

Daniel



-
cuncta stricte discussurus
-

-Ursprüngliche Nachricht-
Von: Cecilia Carmo [mailto:cecilia.ca...@ua.pt] 
Gesendet: Wednesday, June 24, 2009 1:17 PM
An: Daniel Malter
Betreff: Re: AW: [R] lmList

Well it doesn´t work with my example, but I will do some more experiences.
Could you tell me what means year%in%c(1), more specific c(1). Instead of it
I usually write subset=data$year==2000, and I run the regressions one by one
for each year.

Thanks
Cecília


Em Wed, 24 Jun 2009 12:44:40 -0400
  "Daniel Malter"  escreveu:
> Cecilia, this is impossible to tell from the information you provide. 
>The  simulated data below...
> 
> ##START
> year=rep(1:10,10)
> year.fe=rep(rgamma(10,10,2),10)
> firm.fe=rep(rnorm(10,0,3),each=10)
> x=rnorm(100,0,3)
> e=rnorm(100,0,3)
> y=10+firm.fe+year.fe+x+e
> newdata=data.frame(y,x,e,firm,year,firm.fe,year.fe)
> 
> reg=lm(y~x,subset=year%in%c(1))
> summary(reg)
> 
> 
> library(nlme)
> reg=lmList(y~x|year,data=newdata)
> summary(reg)
> ##END
> 
> 
> ...produces the exact same estimates in lm (base) and in lmList 
>(nlme).
> Thus, the mistake lies most probably somewhere in your data setup. For  
>example, sometimes the data you provide to lmList can differ because in 
>lm  the data may be taken from the global environment, whereas you 
>explicitly  provide the dataset in lmList. If they do not perfectly 
>coincide, you would  naturally see differences. Therefore, provide the 
>explicit dataset to lm  too. (for the above example:
>reg=lm(y~x,subset=year%in%c(1),data=newdata).
> If you still observe differences, you have to be more specific and 
>provide  your data and code...
> 
> Hope that helps,
> Daniel
> 
> -
> cuncta stricte discussurus
> -
> 
> -Ursprüngliche Nachricht-
> Von: r-help-boun...@r-project.org
>[mailto:r-help-boun...@r-project.org] Im  Auftrag von Cecilia Carmo
> Gesendet: Wednesday, June 24, 2009 8:23 AM
> An: r-help@r-project.org
> Betreff: [R] lmList
> 
> Hi R-helpers:
> 
> I have a function f<-y~a+b.x and my data is an unbalanced panel data 
>(a  dataframe with columns: firm,year,y,x). I need to run that 
>regression by  year. I started to subset the data by year and run the 
>lm () function, but I  asked R help how to perform this regressions at 
>once.
>One of the suggestions
> was to run lmList (y ~ a + b.x  | year, …) but the coefficients that I  
>obtain are different from those I have before. Someone could explain me 
>why?
> 
> Thank you,
> Cecília Carmo (Universidade de Aveiro - Portugal)
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

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


Re: [R] Reading 4-byte float into R from binary file

2009-06-24 Thread Sean Davis
On Wed, Jun 24, 2009 at 2:55 PM, Duncan Murdoch wrote:

> On 6/24/2009 2:41 PM, Sean Davis wrote:
>
>> A simple question, I hope  I have a binary file format that I want to
>> slurp into R using readBin.  There are a couple of fields in the file that
>> are 4-byte floats.  Since R has no "float" data type (4-byte), I am
>> wondering how to go about this task.  I could simply do all the work in C,
>> but the format is pretty simple, so I wanted to do it using just R.  I did
>> see as.single, but it appears that is for passing things to C and not much
>> more.  Any suggestions appreciated.
>>
>
> You can specify the size when reading a float using readBin(what="numeric",
> size=4).  It will read a single, then convert it to double to store in R.
>  You may need to set the endian value too, if the byte order is wrong.
>
>
As usual, thanks, Duncan.  And, conveniently, the folks deciding the format
specified the endian-ness.

Sean

[[alternative HTML version deleted]]

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


Re: [R] Help LSD multiple comparison test

2009-06-24 Thread Mendiburu, Felipe (CIP)
Dear Tu,

Use library(agricolae)
LSD.test(), It is necessary to aov()

comparison <- LSD.test(yield,virus,df,MSerror,group=F)

Comparison between treatments means

  tr.i tr.j   diff pvalue
112 11.533 0.0176
213 11.933 0.0151
314 12.500 0.0121
423 23.467 0.0003
524 24.033 0.0003
634  0.567 0.8873

or

comparison <- LSD.test(yield,virus,df,MSerror, group=T)

Least Significant Difference 8.928965
Means with the same letter are not significantly different.

Groups, Treatments and means
aoo  36.9 
aff  36.3 
 b   cc  24.4 
  c  fc  12.86667 

Regards,

Felipe.


-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org]on Behalf Of Chunhao Tu
Sent: Tuesday, June 23, 2009 10:41 PM
To: r-help@r-project.org
Subject: [R] Help LSD multiple comparison test



Hi R users,
I know this is a old question but I did not see any clear answer. Is there
any way or package to perform LSD test in R such as H0: A=B. H0, A=C and H0
B=C.

Thank you in advance
Tu 
-- 
View this message in context: 
http://www.nabble.com/Help-LSD-multiple-comparison-test-tp24178161p24178161.html
Sent from the R help mailing list archive at Nabble.com.

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

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


[R] Memory issues on a 64-bit debian system (quantreg)

2009-06-24 Thread Jonathan Greenberg

Rers:

   I installed R 2.9.0 from the Debian package manager on our amd64 
system that currently has 6GB of RAM -- my first question is whether 
this installation is a true 64-bit installation (should R have access to 
> 4GB of RAM?)  I suspect so, because I was running an rqss() (package 
quantreg, installed via install.packages() -- I noticed it required a 
compilation of the source) and watched the memory usage spike to 4.9GB 
(my input data contains > 500,000 samples).


   With this said, after 30 mins or so of processing, I got the 
following error:


tahoe_rq <- 
rqss(ltbmu_4_stemsha_30m_exp.img~qss(ltbmu_eto_annual_mm.img),tau=.99,data=boundary_data)

Error: cannot allocate vector of size 1.5 Gb

   The dataset is a bit big (300mb or so), so I'm not providing it 
unless necessary to solve this memory problem.


   Thoughts?  Do I need to compile either the main R "by hand" or the 
quantreg package?


--j

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


Re: [R] distinguish regression lines in grouped, black and white lattice xyplot

2009-06-24 Thread Katharina May
That's a point. I justed wanted to provide an overview for myself to
see the tendencies in a direct comparement
and with an easy way to distinct them, but maybe the text panel can
help me with that...

Well anyway, is it right that a grouped black and white plot can
contain a maxinum of 8 distinguishable  lines or might
there be a way to increase that?
I know some graphics from papers containing lines with equally
distance points on the lines (one type of point per line)
as a form of distinction. Can this be realised using grouped lattice
plots with regression lines?


2009/6/24 Bert Gunter :
> Don't be silly. They can't be made "distinguishable" by any number of line
> types and/or colors. The brain can't keep that many different symbol
> representations straight. Referring back and forth to a legend is also
> similarly useless. You need to think more creatively about how to make a
> more meaningful display to provide viewers interpretable information.
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
>
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Katharina May
> Sent: Wednesday, June 24, 2009 12:28 PM
> To: r-help@r-project.org
> Subject: [R] distinguish regression lines in grouped,black and white lattice
> xyplot
>
> Hi,
>
> I've got the following problem which I cannot think of a solution right now:
>
> if got a lattice xyplot in black and white and a grouping variable
> with many (more than 8
> values) and I plot it as regression lines (type="r"), just like this
> one (not reproducable but that's
> I guess not the point here):
>
> xyplot(log(AGWB) ~ log(BM_roots), data=sub_agwb_data, groups=species,
> type="r", lty=c(1:6),panel=allo.panel.5)
>
> The problem is that I've got 26 different values for the grouping
> variable species and only 6 default values for the line type
> lty (and according to the par {graphics} help page customizable to up
> to 8 different line types).
>
> Does anybody have any idea how these 26 different lines can be made
> distinguishable from each other without the use
> of colors?
>
> Thanks,
>
>         Katharina
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



-- 
Time flies like an arrow, fruit flies like bananas.

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


Re: [R] distinguish regression lines in grouped, black and white lattice xyplot

2009-06-24 Thread Charles Annis, P.E.
Perhaps what you do should depend on what you want to see.  If all the lines
lie near one another that says one thing.  If all but one or two "agree" but
the mavericks are in obvious disagreement, then that begs to ask "why?"  If
the entire lot looks like spaghetti, then that is informative also.  So
plotting all on one grid isn't of itself bad.  That depends on what you are
trying to do.

Charles Annis, P.E.

charles.an...@statisticalengineering.com
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Katharina May
Sent: Wednesday, June 24, 2009 5:05 PM
To: r-help@r-project.org
Subject: Re: [R] distinguish regression lines in grouped,black and white
lattice xyplot

That's a point. I justed wanted to provide an overview for myself to
see the tendencies in a direct comparement
and with an easy way to distinct them, but maybe the text panel can
help me with that...

Well anyway, is it right that a grouped black and white plot can
contain a maxinum of 8 distinguishable  lines or might
there be a way to increase that?
I know some graphics from papers containing lines with equally
distance points on the lines (one type of point per line)
as a form of distinction. Can this be realised using grouped lattice
plots with regression lines?


2009/6/24 Bert Gunter :
> Don't be silly. They can't be made "distinguishable" by any number of line
> types and/or colors. The brain can't keep that many different symbol
> representations straight. Referring back and forth to a legend is also
> similarly useless. You need to think more creatively about how to make a
> more meaningful display to provide viewers interpretable information.
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
>
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On
> Behalf Of Katharina May
> Sent: Wednesday, June 24, 2009 12:28 PM
> To: r-help@r-project.org
> Subject: [R] distinguish regression lines in grouped,black and white
lattice
> xyplot
>
> Hi,
>
> I've got the following problem which I cannot think of a solution right
now:
>
> if got a lattice xyplot in black and white and a grouping variable
> with many (more than 8
> values) and I plot it as regression lines (type="r"), just like this
> one (not reproducable but that's
> I guess not the point here):
>
> xyplot(log(AGWB) ~ log(BM_roots), data=sub_agwb_data, groups=species,
> type="r", lty=c(1:6),panel=allo.panel.5)
>
> The problem is that I've got 26 different values for the grouping
> variable species and only 6 default values for the line type
> lty (and according to the par {graphics} help page customizable to up
> to 8 different line types).
>
> Does anybody have any idea how these 26 different lines can be made
> distinguishable from each other without the use
> of colors?
>
> Thanks,
>
>         Katharina
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



-- 
Time flies like an arrow, fruit flies like bananas.

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

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


  1   2   >