Re: [R] Antialiasing plots and text on different devices

2009-06-05 Thread Winston Chang
Update: The font situation on Macs with cairo and Cairo is a little worse
that I initially thought. I re-generated the images on a different Mac. The
previous Mac had OS 10.4 and this one has 10.5. The fonts from cairo and
Cairo have changed. Now there are italics and bold italics where there
should be normal and bold text.

http://stdout.org/~winston/X/r-antialias/pch.htmlhttp://stdout.org/%7Ewinston/X/r-antialias/pch.html


On Thu, Jun 4, 2009 at 7:30 PM, Winston Chang 
winstonchang2...@u.northwestern.edu wrote:

 I have a question about antialiasing when R generates bitmaps. (This
 follows a thread on the ggplot2 mailing list.)

 I mostly use R on Linux, although I sometimes use it in Mac and Windows as
 well. On Linux, I've found that plotting shapes 15-18 via cairo results in
 bad-looking output. The points are not antialiased, and they are jagged and
 misshapen. Plots generated in Windows also aren't antialiased, but at least
 the vector shapes seem to be aligned to pixel boundaries so that the raster
 images look consistent.

 You can see this in the scatterplots I've posted here:
 http://stdout.org/~winston/X/r-antialias/pch.htmlhttp://stdout.org/%7Ewinston/X/r-antialias/pch.html

 Also on that page are pch symbol charts from a modified version of
 pchShow() from the pch help page. I rendered PNG's of the chart on Mac,
 Linux, and Windows, using png() and setting type to Xlib, cairo, quartz,
 if available on the given platform. In Windows, I did it without the type
 argument (in Windows, the flag wasn't available). Finally, I also installed
 the Cairo package and used CairoPNG. Please note the distinction between
 cairo, which is built-in, and Cairo, which is an installed package.

 (Side note: there's no Mac-Xlib image, but only because I had some X server
 issues on that computer.)

 Here are some observations and questions that hopefully someone can answer:
 - With cairo, all shapes are antialiased except 15-18. Why do cairo and
 Cairo give different results for shapes 15-18?
 - With CairoPNG, all shapes are antialiased. Title text looks different
 between the platforms, though. On Mac, it's normal text; on Linux, it's
 bold; and on Windows, it's italic. I believe that font.main was set to 2, so
 it should be bold. Why does Cairo render text so differently on different
 platforms?


 It would be nice not to have to tailor scripts to fit the quirks of
 whatever platform I happen to be at. For example, to have the title render
 properly in bold and have all shapes be anti-aliased, here's what I would
 need to do:
 - Mac: png(type=quartz)
 - Linux: CairoPNG()
 - Windows: not possible

 Ideally, I would like to use the same command on all platforms to generate
 good antialiased graphs with similar-looking fonts. Is such a thing
 possible?

 -Winston



 This is the code that I used to generate all the images for each platform:

 pchShow -
function(extras = c(*,., o,O,0,+,-,|,%,#),
 cex = 3, ## good for both .Device==postscript and x11
 col = red3, bg = gold, coltext = brown, cextext = 1.2,
 main = paste(plot symbols :  points (...  pch = *, cex =,
  cex,)))
{
  nex - length(extras)
  np  - 26 + nex
  ipch - 0:(np-1)
  k - floor(sqrt(np))
  dd - c(-1,1)/2
  rx - dd + range(ix - ipch %/% k)
  ry - dd + range(iy - 3 + (k-1)- ipch %% k)
  pch - as.list(ipch) # list with integers  strings
  if(nex  0) pch[26+ 1:nex] - as.list(extras)
  plot(rx, ry, type=n, axes = FALSE,
   xlab = x-axis label, ylab = y-axis label,
   main = main)
  abline(v = ix, h = iy, col = lightgray, lty = dotted)
  for(i in 1:np) {
pc - pch[[i]]
## 'col' symbols with a 'bg'-colored interior (where available) :
points(ix[i], iy[i], pch = pc, col = col, bg = bg, cex = cex)
if(cextext  0)
text(ix[i] - 0.3, iy[i], pc, col = coltext, cex = cextext)
  }
}


 sysname - paste(version$platform, _, version$major, ., version$minor,
 sep=)

 # Make the scatterplot
 set.seed(123)
 png(paste(sysname, -default_png_scatterplot.png, sep=), width=300,
 height=300)
 plot(rnorm(20),rnorm(20), pch=16, main=paste(sysname,pch=16))
 dev.off()


 # Get the possible types on this computer (cairo, Xlib, etc)
 types - NULL
 if (capabilities()[cairo])types - c(types, cairo)
 if (capabilities()[X11])  types - c(types, Xlib)
 if (capabilities()[aqua]) types - c(types, quartz)


 # Generate the images
 if (is.null(types)) {
 # If no types available
 png(paste(sysname, -default_png.png, sep=), width=300,
 height=300)
 pchShow(cex=.9, cextext=.8, main=paste(sysname, default PNG
 output))
 dev.off()

 } else {
  for (i in 1:length(types)) {
 # If types are available, use them
 png(paste(sysname, -, types[i], .png, sep=), width=300,
 height=300,
 type=types[i])
 pchShow(cex=.9, cextext=.8, 

[R] Odp: Plot and lm

2009-06-05 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 04.06.2009 16:11:29:

 I want to make a log-log plot with a regression line, but I can't figure
 out what I'm doing wrong. What I'm trying is:
 
 plot(mass,area, log=xy, pch=as.numeric(food))
 abline(lm(mass~area))


abline(lm(area~mass))

 
 or
 
 plot(mass,area, log=xy, pch=as.numeric(food))
 islands$logmass - log(mass)
 islands$logarea - log(area)
 attach(islands)
 abline(lm(logmass~logarea))

abline(lm(logarea~logmass))

 
 
 But that does not show a line. Where am I going wrong?

plot(x,y)
but
lm(y~x)

Regards
Petr

 
 data: 
 island, area,species,food,mass
 Ibiza , 577 ,  Anser n. sp., herb,  2.0
 Ibiza , 577 ,Haliaeetus albicilla, carn, 4.8
 Mauritius , 1874 ,  Raphus cucullatus, herb,  19 
 Mauritius , 1874 ,  Circus alphonsi, carn, 0.63
 Mallorca , 3667 , Myotragus balearicus, herb,  40 
 Mallorca , 3667 , Aquila chrysaetos, carn, 4.2
 Kreta , 8259 , Elephas creutzburgi, herb,  3200 
 ...
 
 /Par
 
 -- 
 Par Leijonhufvud   p...@hunter-gatherer.org
 I don't believe in reincarnation.  I used to,
 but that was in another life.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Done: Fast way of finding top-n values of a long vector

2009-06-05 Thread Allan Engelhardt
I'm all done now.  The max2 version below is what I went with in the 
end for my proposed change to caret::nearZeroVar (which used the sort 
method). Max Kuhn will make it available on CRAN soon.  It speeds up 
that routine by a factor 2-5 on my test cases and uses much less 
memory.  For what it is worth, I also made a C version (cmax below) 
which of course is faster yet again and scales nicely for returning the 
top n values of the array:


cmax - function (v) {max - vector(double,2); max - .C(test, 
as.double(v), as.integer(length(v)), max, NAOK=TRUE)[[3]]; 
return(max[1]/max[2]);}


library(rbenchmark)
set.seed(1); x - runif(1e7, max=1e8); x[1] - NA;
benchmark(
replications=20,
columns=c(test,elapsed),
order=elapsed
, sort = {a-sort(x, decreasing=TRUE, na.last=NA)[1:2]; a[1]/a[2];}
, qsrt = {a-sort(x, decreasing=TRUE, na.last=NA, method=quick)[1:2]; 
a[1]/a[2];}

, part = {a-sort.int(-x, partial=1:2, na.last=NA)[1:2]; a[1]/a[2];}
, max1 = {m-max(x, na.rm=TRUE); w-which(x==m)[1]; 
m/max(x[-w],na.rm=TRUE);}

, max2 = {w-which.max(x); max(x, na.rm=TRUE)/max(x[-w], na.rm=TRUE);}
, cmax = {cmax(x);}
)
#   test elapsed
# 6 cmax   4.394
# 5 max2   8.954
# 4 max1  18.835
# 3 part  21.749
# 2 qsrt  46.692
# 1 sort  77.679

Thanks for all the suggestions and comments.

Allan.


PS: Slightly off-topic but is there a way within the syntax of R to set 
up things so that 'sort' (or any function) would know it is called in a 
partial list context in sort(x)[1:2] and it therefore could choose to 
use the partial argument automatically for small [] lists?  The R 
interpreter of course knows full well that it is going to drop all but 
the first two values of the result before it calls 'sort'.  Perl has 
'use Want' where howmany() and want(n) provides a subset of this 
functionality (essentially for [] lists of the form 1:n).


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

2009-06-05 Thread souad romdhane



Dear R
expert

I am a
student and I am currently conducting a research project on the Modeling Loss
Index Triggers to price Cat Bonds: Application of the risk of hurricanes in
USA.

I need to
solve with R (especially with EM algorithm) this specific problem below. CRAN
Package archive doesn't seem to have it also the statistical modeling journal
didn't contain a paper that implements this:

I have two
data samples. The first sample contains 64 depths for historical hurricanes
happened in Florida between 1950 - 2008. The second sample contains only 48
losses associated to these hurricanes. This second data is missing 16 values of
losses.

Since 48
out 64 observations have information about hurricanes losses, it is necessary
to treat the missing data of losses for a further analysis. So, I chose to make
an EM-algorithm:

1- Experts in climatology describe that
hurricanes losses are directly proportional to the depths of the hurricanes.
Besides, statistically we observe a relationship between the two vectors
(depths of hurricanes and losses). So the approach is to estimate the missing
losses by means of the linear regression model x= á+ â yi + åi, where x (n x 1) 
is a vector of observations
on the response variable and  y (n x p)
is the p explanatory variables.

2- An approach to deal with the missing data
is the expectation -Maximum algorithm (EM)

The
expectation step:

This
algorithm consists of omitting the cases with missing data and running a
regression on what remains.  The
regression coefficient will be used to estimate the missing data.

The
maximization step:

After this
estimation step, a new regression will be done over the complete data
(including estimated values). With the new regression coefficients, the missing
data is re-estimated. This process will continue until the estimates are
adjusted to give model sampling error, ie it will not be a longer noticeable
change. 

Does anyone
have any ideas how to make this in R algorithm?

Can you
guide me to something already done? Or please help me to find the true code.

Thank you
in advance to consider my request   

Best regards 

Souad


_
[[elided Hotmail spam]]

[[alternative HTML version deleted]]

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


Re: [R] Import ARIMA coefficients

2009-06-05 Thread Gavin Simpson
On Thu, 2009-06-04 at 15:21 +0100, Daniel Mail wrote:
snip /
 Hello,
   
 I need to know how to import ARIMA coefficients. I already determined
 the coefficients of the model with other software, but now i need to
 do the forecast in R.
snip/
  
 
  fit - arima(x, order=c(1, 0, 1), fixed=c(-.172295, .960043, 0)) 
  fit
 
 Call:
 arima(x = x, order = c(1, 0, 1), fixed = c(-0.172295, 0.960043, 0))
 
 Coefficients:
 Error in se  nrow(x$var.coef) : invalid 'y' type in 'x  y'

Looks like this is a bug in print.Arima, as it assumes that x$var.coef
is a matrix or similar. In this case, it is actually

 mod2$var.coef
numeric(0)
 nrow(mod2$var.coef)
NULL

And the NULL is causing the error: [note 'se' is TRUE here]

 TRUE  NULL
Error in TRUE  NULL : invalid 'y' type in 'x  y'

The simple work around is just to call the print method explicitly and
set argument 'se' to be FALSE. This only seems to affect the print
method - you can use the predict method (?predict.Arima) to do your
forecasts.

Here is an example using dummy data so it is reproducible:

 set.seed(123)
 x - cumsum(rnorm(1000))
 x - as.ts(x)
 mod - arima(x, order=c(1, 1, 1))
 mod

Call:
arima(x = x, order = c(1, 1, 1))

Coefficients:
 ar1  ma1
  0.6000  -0.6362
s.e.  0.2963   0.2855

sigma^2 estimated as 0.9814:  log likelihood = -1408.14,  aic = 2822.28
 ## note coefs - use them in a new fit as you were doing
 mod2 - arima(x, order=c(1, 1, 1), fixed = c(0.6000,-0.6362))
 print(mod2, se = FALSE)

Call:
arima(x = x, order = c(1, 1, 1), fixed = c(0.6, -0.6362))

Coefficients:
ar1  ma1  
 0.6000  -0.6362  

sigma^2 estimated as 0.9814:  log likelihood = -1408.14,  aic = 2818.28
 ## Now do a prediction - default is the 1-step ahead forecast:
 predict(mod2)
$pred
Time Series:
Start = 1001 
End = 1001 
Frequency = 1 
[1] 16.15804

$se
Time Series:
Start = 1001 
End = 1001 
Frequency = 1 
[1] 0.9906526

Although, you'd probably be better off doing the fit in R directly...

G

  
 
 
 
 I will be very pleased if someone help me.

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



signature.asc
Description: This is a digitally signed message part
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 with using subset from two different tables

2009-06-05 Thread Jim Lemon

venkata kirankumar wrote:

Hi all,

I am new to R-project my problem is I tried to get subset from two different
tables its giving error
but if i m tring for  geting results from one table its working

actually i have to take values from two tables with applying different
conditions on two tables like


kk- is an object of one table and
fk- is an object of another table

here i have to get values  from these tables like

subset(kk  fk,kk$Rmaxtgavcg  1.256  fk$rmaxtgavcg 
3.25,select=c(uniqueid))

my doubt is, that if any thing like this expression is there in R-project or
i have to go for two different subsets and then adding those two one after
another with checking the common uniqueid's

  

Hi Kiran,
I assume that your tables are data frames and have the same first 
dimension. If not,


subsetvector-kk$Rmaxygavcg  1.256  fk$rmaxtgavcg  3.25

will recycle the shorter of the two logical vectors, which is almost 
certainly not what you want.
If they have the same first dimension, you could then combine the 
tables and get your result:


dupnames-which(names(fk)%in%names(kk))
subset(cbind(kk,fk[,-dupnames]),subsetvector)

Jim

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


[R] Odp: Plot and lm

2009-06-05 Thread Andrew Dolman
A mix of Petr and William's answers will sort you out. You had two problems:
the base 10/e problem and the axes swapping problem.


?dput

I didn't know about that one either - very useful!


andydol...@gmail.com


2009/6/5 Petr PIKAL petr.pi...@precheza.cz

Hi

 r-help-boun...@r-project.org napsal dne 04.06.2009 16:11:29:

  I want to make a log-log plot with a regression line, but I can't figure
  out what I'm doing wrong. What I'm trying is:
 
  plot(mass,area, log=xy, pch=as.numeric(food))
  abline(lm(mass~area))


 abline(lm(area~mass))

 
  or
 
  plot(mass,area, log=xy, pch=as.numeric(food))
  islands$logmass - log(mass)
  islands$logarea - log(area)
  attach(islands)
  abline(lm(logmass~logarea))

 abline(lm(logarea~logmass))

 
 
  But that does not show a line. Where am I going wrong?

 plot(x,y)
 but
 lm(y~x)

 Regards
 Petr

 
  data:
  island, area,species,food,mass
  Ibiza , 577 ,  Anser n. sp., herb,  2.0
  Ibiza , 577 ,Haliaeetus albicilla, carn, 4.8
  Mauritius , 1874 ,  Raphus cucullatus, herb,  19
  Mauritius , 1874 ,  Circus alphonsi, carn, 0.63
  Mallorca , 3667 , Myotragus balearicus, herb,  40
  Mallorca , 3667 , Aquila chrysaetos, carn, 4.2
  Kreta , 8259 , Elephas creutzburgi, herb,  3200
  ...
 
  /Par
 
  --
  Par Leijonhufvud   p...@hunter-gatherer.org
  I don't believe in reincarnation.  I used to,
  but that was in another life.
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/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.


[[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] R 2.9.0 on AIX 5.3: Error: Invalid DESCRIPTION file

2009-06-05 Thread Loris Bennett
Hi,

I am trying to install R 2.9.0 on AIX 5.3. During the 'make' run I get
the following error:

   Error: Invalid DESCRIPTION file

   Invalid Priority field.
   Packages with priorities 'base' or 'recommended' or 'defunct-base' must
   already be known to R.

   See the information on DESCRIPTION files in section 'Creating R
   packages' of the 'Writing R Extensions' manual.
   Execution halted

Any ideas? Full output below.

Thanks

Loris

Here is the full output of 'make':

   Target R is up to date.
   Target R is up to date.
   Target R is up to date.
   Target R is up to date.
   Target Makedeps is up to date.
   Target libbz2.a is up to date.
   Target all is up to date.
   Target Makedeps is up to date.
   Target libpcre.a is up to date.
   Target all is up to date.
   Target Makedeps is up to date.
   Target libz.a is up to date.
   Target all is up to date.
   Target R is up to date.
   Target Makedeps is up to date.
   Target libappl.a is up to date.
   Target Makedeps is up to date.
   Target libnmath.a is up to date.
   Target Makedeps is up to date.
   Target libunix.a is up to date.
   xlc_r -q64 -I. -I../../src/include -I../../src/include
   -I/usr/lpp/X11/include/X11 -DHAVE_CONFIG_H -O -qstrict
   -DR_HOME='/opt/sw/install/R-2.9.0' -o Rscript ./Rscript.c
   Target Makedeps is up to date.
   /opt/sw/install/R-2.9.0/bin/exec/R is unchanged
   Target Makedeps is up to date.
   Target internet.so is up to date.
   Target all is up to date.
   Target Makedeps is up to date.
   Target libRlapack.so is up to date.
   /opt/sw/install/R-2.9.0/lib/libRlapack.so is unchanged
   Target lapack.so is up to date.
   Target all is up to date.
   Target Makedeps is up to date.
   Target vfonts.so is up to date.
   Target all is up to date.
   Target Makedeps is up to date.
   Target R_X11.so is up to date.
   building system startup profile
   building package 'base'
   all.R is unchanged
   building package 'tools'
   all.R is unchanged
   Target Makedeps is up to date.
   ../../../../library/tools/libs/tools.so is unchanged
   Error: Invalid DESCRIPTION file

   Invalid Priority field.
   Packages with priorities 'base' or 'recommended' or 'defunct-base' must
   already be known to R.

   See the information on DESCRIPTION files in section 'Creating R
   packages' of the 'Writing R Extensions' manual.
   Execution halted
   make: 1254-004 The error code from the last command is 1.


   Stop.
   make: 1254-004 The error code from the last command is 1.


   Stop.
   make: 1254-004 The error code from the last command is 1.


   Stop.
   make: 1254-004 The error code from the last command is 1.


   Stop.

-- 
Dr. Loris Bennett
Computer Centre
Freie Universität Berlin
Berlin, Germany

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


Re: [R] SSOAP failing

2009-06-05 Thread Olivier Cailloux

Duncan Temple Lang a écrit :



Olivier Cailloux wrote:

Dear list,

I am trying to use the SSOAP package to access a very simple SOAP 
service, included as a demonstrator in the axis2 Apache package: 
Version (takes no input parameters and should return a string with 
the version number). The web service itself seems to be working as I 
could access it using an other client (eclipse Web Server tester).


You will find the service wsdl here: 
http://smg8.ulb.ac.be:8080/axis2/services/Version?wsdl, and 
informations on the other services I tried here: 
http://smg8.ulb.ac.be:8080/axis2/services/listServices.


I used the following commands:
   library(SSOAP)
   smg8Version - SOAPServer(smg8.ulb.ac.be, 
axis2/services/Version, 8080)
   .SOAP(smg8Version, getVersion, 
action=I(VersionHttpSoap11Endpoint))


The first command seems to give a proper smg8Version object, but the 
second one fails with Error: evaluation nested too deeply: infinite 
recursion / options(expressions=)?.




The best thing to do is find where the error is occurring.
You can step through the .SOAP call and see where the problem arises.

The issue is in fromXML when converting the result.
In the separation of the code in the SSOAP package into
SSOAP and XMLSchema, I overlooked some methods for the fromXML()
function for cases where no type information is available.
There is now a new version (0.1-1) of XMLSchema on the Omegahat web site.

When reporting problems such as these, it is important to provide
information about what OS, version of R, and the different packages
you are using. The code above involves the SSOAP, XML, RCurl and 
XMLSchema packages.
Sorry about that, my e-mail has been sent too soon by mistake (also from 
an incorrect exp. address). I was planning to add further details.


So I'm running Debian Lenny. sessionInfo() gives:
R version 2.7.1 (2008-06-23)
i486-pc-linux-gnu

locale:
C

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


Package:   SSOAP
Version:   0.5-0
Date:  2009/05/04
Package:  XML
Version:  2.3-0
Date: 2009/03/04
Package:  RCurl
Version:  0.97-3
Package:   XMLSchema
Version:   0.1-0

I must be stupid but I can't find XMLSchema on the omegahat website. (I 
just installed the 0.1-0 version a few days ago when trying to use 
SSOAP.) Google gives nothing useful for XMLSchema site:omegahat.org.


I'm beginner in both web services and R programming (my knowledge is 
more in desktop  CORBA Java programming). I am simply trying to make 
Java and R communicate (call Java code from R remotely), for use by 
someone else who works in R. I'd like to provide him with a fully 
functional example. I must recognize that having to step through SSOAP 
code to find where the problem lies might be too difficult considering 
my current knowledge (knowing I don't intend to become an expert R 
programmer). Please don't take it as rude or implying that I'm simply 
expecting someone to solve the problem for me: I am ready to investigate 
but I'd simply like to have an idea of how difficult it will be. If I 
have to patch part of SSOAP or if you think that the functions I need 
are not implemented yet, then I'd better not insist and try to 
communicate from R to Java using an other way. If on the other hand you 
think it should be working and is simply a matter of using the right 
version of the right package, or using an other web services platform on 
the Java side, or configuring something differently, etc., then I'll 
happily dig into it.


More generally, if someone has a suggestion on what to use to call Java 
over TCP/IP from R, I'd be interested. I am currently considering OSS as 
well as SSOAP. I'd prefer learning an approach that I can reuse for 
other languages, so possibly a standard like SOAP or CORBA would be best.


Thanks for any pointer.
Olivier



 D.




I tried different action values, because I don't know what I should 
put there. But I always get the same error.


Also, FYI, the following command produces the following output:
   smg8Def -  
processWSDL(http://smg8.ulb.ac.be:8080/axis2/services/Version?wsdl;, 
verbose=TRUE)

processing (sub) schema http://axisversion.sample
1 ) Exception
2 ) Exception
3 ) getVersionResponse
Warning message:
In 
processWSDL(http://smg8.ulb.ac.be:8080/axis2/services/Version?wsdl;,  :

 Ignoring additional serviceport ... elements

and then

I also tried a simpler service (WSDL manually created myself, but I 
am not sure it is correct although it validates):
   smg8EchoDef - 
processWSDL(http://smg8.ulb.ac.be:8080/axis2/services/EchoService?wsdl;, 
verbose=TRUE)

processing (sub) schema http://smg8.ulb.ac.be/echoSvc/
1 ) TheString
   genSOAPClientInterface(def = smg8EchoDef)
Error in d...@operations[[1]] : subscript out of bounds
Indeed:
   length(smg8echo...@operations)
[1] 0

__

[R] New Meta-Analysis Package (metafor)

2009-06-05 Thread Viechtbauer Wolfgang (STAT)
A new package is now available via CRAN, called metafor.

The metafor package consists of a collection of functions for conducting 
meta-analyses in R. Fixed- and random-effects models (with and without 
moderators) can be fitted via the general linear (mixed-effects) model. For 2x2 
table data, the Mantel-Haenszel and Peto's method are also implemented. The 
package also provides various plot functions (for example, for forest, funnel, 
and radial plots) and functions for assessing the model fit and obtaining case 
diagnostics.

Best,

--
Wolfgang Viechtbauer
 Department of Methodology and Statistics
 University of Maastricht, The Netherlands
 http://www.wvbauer.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] Morlet wavelet analysis

2009-06-05 Thread Matthew Albrecht
Irina Foss wrote:
 Dear,
 
 I am using cwt function from Rwave package to perform Morlet wavelet 
 analysis.
 d1-ts(d1deltat=1,start=c(1960,1))
  library(Rwave)
 D1-cwt(d1,noctave=8,nvoice=1)
 
 After I did Morlet wavelet analysis by using function wavelet from dplR 
 package.
 
  library(dplR)
 
 D2-wavelet(d1,Dt=1)
 
 But the wavelets from two tests are very different. What is the reason??

Try

D2-wavelet(d1, 1, s0=2, dj=1, J=7, siglvl=0.95)
plot(abs(D1))
plot(abs(D2$wave))

This at least gives the shape of the other one for each frequency
analysed, but unfortunately the magnitudes are different.
Differences are probably due to the energy normalisation constants and
the size of the gaussian envelope. You'll have to look at the code to
find out.

I have a Morlet Wavelet script in Scilab if you're interested in
checking that out. I wrote it so that I could customise everything I was
interested in easily and as a learning process.

Matt Albrecht

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

2009-06-05 Thread koyel chakrabartti
Hi,
While doing the ADF test in R using the following command I am getting the
error and the result..
x.ct=ur.df(rev$REVENUE,start=1,end=length(rev$REVENUE),frequency=1)
Error in ur.df(rev$REVENUE, start = 1, end = length(rev$REVENUE), frequency
= 1) :
  unused argument(s) (start = 1, end = 4, frequency = 1)

rev$REVENUE.ct=ur.df(rev$REVENUE,start=1,end=length(rev$REVENUE),frequency=1)
Error in ur.df(rev$REVENUE, start = 1, end = length(rev$REVENUE), frequency
= 1) :
  unused argument(s) (start = 1, end = 4, frequency = 1)
 plot(rev$REVENUE.ct)
Error in plot.window(...) : need finite 'xlim' values
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
3: In min(x) : no non-missing arguments to min; returning Inf
4: In max(x) : no non-missing arguments to max; returning -Inf
 library(tseries)
 adf.test(REVENUE,alternative=explosive,k=0)
Error in NCOL(x) : object 'REVENUE' not found
 adf.test(rev$REVENUE,alternative=explosive,k=0)
Error in if (interpol == min(tablep)) warning(p-value smaller than printed
p-value) else warning(p-value greater than printed p-value) :
  missing value where TRUE/FALSE needed
 summary(ur.df(rev$REVENUE,lags=0,type=trend)
+ )

###
# Augmented Dickey-Fuller Test Unit Root Test #
###

Test regression trend


Call:
lm(formula = z.diff ~ z.lag.1 + 1 + tt)

Residuals:
ALL 3 residuals are 0: no residual degrees of freedom!

Coefficients:
Estimate Std. Error t value Pr(|t|)
(Intercept)  171.522 NA  NA   NA
z.lag.1   -5.579 NA  NA   NA
tt 3.459 NA  NA   NA

Residual standard error: NaN on 0 degrees of freedom
Multiple R-squared: 1,  Adjusted R-squared:   NaN
F-statistic:   NaN on 2 and 0 DF,  p-value: NA


Value of test-statistic is: NaN NaN NaN

Critical values for test statistics:
  1pct  5pct 10pct
tau3 -4.38 -3.60 -3.24
phi2  8.21  5.68  4.67
phi3 10.61  7.24  5.91


Can anyone tell me what is wrong with the codes???The code used is given
below.

Thanx

t=1:length(x)
plot(t,x)
trend = lm(x~t)
abline(lm(x~t))
summary(trend)
library(urca)
x = ts(x, start=1, end = length(x), frequency=1)
x.ct = ur.df(x,lags=0,type='trend')
plot(x.ct)
library(tseries)
adf.test(x,alternative = explosive , k=0)
summary(ur.df(x,lags=0,type='trend')

[[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] Regular expression \ String Extraction help

2009-06-05 Thread Tony Breyal
Thanks guys, that's information if very much appreciated. Both
solution are better than mine which was to use capture.output after
using the cat function.

re: collapse argument in paste() -- I've always wondered what that
argument was for, i thought it was basically doing what the sep
argument does, but i can now see that it can do something else that is
very useful which sep does not do

 txt - c('Doctor', 'Who', 'For', 'The', 'Win!')
 paste(txt, sep=' ')
[1] Doctor WhoForTheWin!
 paste(txt, collapse=' ')
[1] Doctor Who For The Win!

re: regulare expression by Gabor - mate, that line of code is a thing
of beauty, i can honestly say i would never have come up with that.

Cheers,
Tony

2009/6/3 Greg Snow greg.s...@imail.org:
 Ted,

 Try using paste with the collapse argument.

 --
 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 Ted Harding
 Sent: Wednesday, June 03, 2009 7:56 AM
 To: Tony Breyal; r-help@r-project.org
 Subject: Re: [R] Regular expression \ String Extraction help

 On 03-Jun-09 11:34:16, Tony Breyal wrote:
  Dear all,
  Is there a good way of doing the following conversion:
 
  []-[MM]-[DD] [Time] [Day] [Name][Integer].[Extention]
 
  to become
 
  C:\test\[Name]\[]-[MM]-[DD] [Time] [Day]\[]-[MM]-[DD] [Time]
  [Day] [Name][Integer].[Extention]
 
  i.e. these
 
  2009-04-10 1400 Fri Foo1.txt
  2009-04-10 1400 Fri Universities2.txt
  2009-04-10 1400 Fri Hitchhikers Guide To The Galaxy42.txt
 
  will become
 
  C:\test\Foo\2009-04-10 1400 Fri Foo1.txt
  C:\test\Universities\2009-04-10 1400 Fri Universities2.txt
  C:\test\Hitchhikers Guide To The Galaxy\2009-04-10 1400 Fri
  Hitchhikers Guide To The Galaxy42.txt
 
  My main issue is the conversion for 'Hitchkikers Guide To The
  Galaxy54' because of the spaces in the Name. So far this is what i
  have:
 
  txt - '2009-04-10 1400 Fri Universities1.txt'
  step1 - unlist(strsplit(txt, '\\.'))
  step2 - unlist(strsplit(step1[1], ' '))
  Name - gsub('[0-9]',replacement='', step2[4])
  step3 - paste(step2[1], step2[2], step2[3], sep=' ')
  paste('C:\\test\\', Name, '\\', step3, '\\', txt, sep='' )
  [1] C:\\test\\Universities\\2009-04-10 1400 Fri\\2009-04-10 1400 Fri
  Universities1.txt
 
  Cheers,
  Tony Breyal

 I can get as far as the following (using the Hitchhikers one):

    txt - '2009-04-10 1400 Fri Hitchhikers Guide To The Galaxy42.txt'
    step1 - unlist(strsplit(txt, '\\.'))
    step2 - unlist(strsplit(step1[1], ' '))
    step2
    # [1] Hitchhikers Guide To The Galaxy42

 What is now needed is to join all the separate elements of step2
 into a single character string. paste() won't do it, because it
 produces a separate character string for each element of step2.
 cat() won't do it because it has no value (so cannot be assigned).

 You could loop over step2:

    Name1 - step2[4]
    for(i in (5:length(step2))) Name1 - paste(Name1,step2[i])
    Name1
    # [1] Hitchhikers Guide To The Galaxy42

 Then do your gsub:

    Name - gsub('[0-9]',replacement='', Name1)
    step3 - paste(step2[1], step2[2], step2[3], sep=' ')
    paste('C:\\test\\', Name, '\\', step3, '\\', txt, sep='' )

 [1] C:\\test\\Hitchhikers Guide To The Galaxy\\2009-04-10 1400
 Fri\\2009-04-10 1400 Fri Hitchhikers Guide To The Galaxy42.txt

 So that works; but it would be nice to be able to avoid the loop!

 Ted.

 
 E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
 Fax-to-email: +44 (0)870 094 0861
 Date: 03-Jun-09                                       Time: 14:55:28
 -- XFMail --

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


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

2009-06-05 Thread Ptit_Bleu

Hello,

I'm just looking for an easy way to find the positions of a complete
sequence in a bigger vector.
For example :
c(a,z,e) in c(a,z,e,r,t,a,z,a,z,e,c)
and the result should be
1 8
that is the positions of the beginning of the complete sequence.

I tried with %in%, match, is.element but all I get is, for example
which(c(a,z,e) in c(a,z,e,r,t,a,z,a,z,e,c))
1 2 3
meaning that each character is in the bigger vector.

It must be easy, except for me. Sorry.

If you have a solution, thanks in advance to share it.
Have a good week-end,
Ptit Bleu.

-- 
View this message in context: 
http://www.nabble.com/find-a-sequence-of-characters-in-a-vector-tp23888063p23888063.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] find a sequence of characters in a vector

2009-06-05 Thread Sundar Dorai-Raj
use gregexpr and paste

 aze - paste(c(a, z, e), collapse = )
 sequence - paste(c(a,z,e,r,t,a,z,a,z,e,c), collapse = 
 )
 gregexpr(aze, sequence, fixed = TRUE)
[[1]]
[1] 1 8
attr(,match.length)
[1] 3 3

HTH,

--sundar

On Fri, Jun 5, 2009 at 6:22 AM, Ptit_Bleuptit_b...@yahoo.fr wrote:

 Hello,

 I'm just looking for an easy way to find the positions of a complete
 sequence in a bigger vector.
 For example :
 c(a,z,e) in c(a,z,e,r,t,a,z,a,z,e,c)
 and the result should be
 1 8
 that is the positions of the beginning of the complete sequence.

 I tried with %in%, match, is.element but all I get is, for example
 which(c(a,z,e) in c(a,z,e,r,t,a,z,a,z,e,c))
 1 2 3
 meaning that each character is in the bigger vector.

 It must be easy, except for me. Sorry.

 If you have a solution, thanks in advance to share it.
 Have a good week-end,
 Ptit Bleu.

 --
 View this message in context: 
 http://www.nabble.com/find-a-sequence-of-characters-in-a-vector-tp23888063p23888063.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] read.table, row.names arg

2009-06-05 Thread Markus Loecher
Dear R users,
I had somehow expected that read.table() would treat the column specified by
the row.names argument as of class character. That seems to be the only
sensible class allowed for a column containing row names. However, that does
not seem to be the case, as the following example shows:

  x - cbind.data.frame(ID = c(010007787048271871, 1007109516820319,
10094843652996959, 010145176274075487), X1 = 1:4, X2 = 4:1);
write.table(x, tmp.txt, quote = FALSE, row.names = FALSE);
y - read.table(tmp.txt, header= TRUE, row.names=1)

 y
  X1 X2
10007787048271872  1  4
1007109516820319   2  3
10094843652996960  3  2
10145176274075488  4  1
 x
  ID X1 X2
1 010007787048271871  1  4
2   1007109516820319  2  3
3  10094843652996959  3  2
4 010145176274075487  4  1

The first column was not read in as a string, which mangled the IDs.
I could use colClasses explicitly, but then I would need to know the number
and classes of the remaining columns in advance.
Is this a bug or expected behavior ?
Any advice would be most helpful.

Thanks,

Markus

[[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] React on sigterm

2009-06-05 Thread Christian Ruckert

Dear all,

is there any possibility to react on a process termination signal in R?

In a cluster (using RMPI and snow) if the main R process is aborted due 
to runtime limitations I want to properly shutdown all spawned node 
processes, e.g. via mpi.close.Rslaves.


Any hints are welcome,

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] EM Algorithm

2009-06-05 Thread Janet Rosenbaum


Look into the R packages for missing data by Joe Schafer.  These  
missing data routines use EM.  See here for starters.  He also wrote a  
book:

http://www.stat.psu.edu/~jls/misoftwa.html

Janet

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] RWeka write.arff: set @relation

2009-06-05 Thread Nikki K
Dear all,

I am using the RWeka package to append several arff files. Although it
works the resulting arff files always have @relation R_data_frame,
and I have to change this manually to my desired relation name. Can
the package accomplish this for me instead?

Thank you,

Wil Koetsier

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] theta.mod in mda()

2009-06-05 Thread Vaniscotte

Hello,

Does someone know what are theta.mod coefficients in the output of mda() 
function in the mda package?


Thanks for your help


Amélie Vaniscotte,

Department of Chrono-environment, UMR UFC/CNRS 6249 aff. INRA
University of Franche-Comté
amelie.vanisco...@univ-fcomte.fr

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Linear model with coefficient restriction

2009-06-05 Thread Axel Leroix
Hi every one

I perform a simple linear regression

lm(a b + c + d , data = data1)

How to say to R to perform and print the regression with restricting the 
coefficient
of the variable c to be equal to 0.1. In the model print, I want to 
show the p-values of all my coefficients. 

Thank you in advance.
Axel




  
[[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] Linear model with coefficient restriction

2009-06-05 Thread David Winsemius



On Jun 5, 2009, at 11:10 AM, Axel Leroix wrote:


Hi every one

I perform a simple linear regression

lm(a b + c + d , data = data1)

How to say to R to perform and print the regression with restricting  
the coefficient

of the variable c to be equal to 0.1.


?lm

Examine material on specifying an offset ... in your case 0.1 * c.

 In the model print, I want to show the p-values of all my  
coefficients.


?anova





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] ADF test

2009-06-05 Thread Stefan Grosse
koyel chakrabartti wrote:
 While doing the ADF test in R using the following command I am getting the
 error and the result..
 x.ct=ur.df(rev$REVENUE,start=1,end=length(rev$REVENUE),frequency=1)
 Error in ur.df(rev$REVENUE, start = 1, end = length(rev$REVENUE), frequency
 = 1) :
   unused argument(s) (start = 1, end = 4, frequency = 1)
   

The error and code above does not fit to the code below. The arguments
start, end and frequency belong to the ts command which you probably
forgot in the code above.

Btw. it seems you have a time series of only 4 dates, so either there is
another mistake or you don't know what you do...


 t=1:length(x)
 plot(t,x)
 trend = lm(x~t)
 abline(lm(x~t))
 summary(trend)
 library(urca)
 x = ts(x, start=1, end = length(x), frequency=1)
 x.ct = ur.df(x,lags=0,type='trend')
 plot(x.ct)
 library(tseries)
 adf.test(x,alternative = explosive , k=0)
 summary(ur.df(x,lags=0,type='trend')


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] S4: Initialization method called during setClass??

2009-06-05 Thread Vitalie S.

Dear UseRs,

A simple class inheritance example:


setClass(test,representation(a=numeric))
setMethod(initialize,test,

  function(.Object,x,...){
  print(Initialization!!!)
  callNextMethod(.Object,a=x,...)
  })


new(test,x=23)

[1] Initialization!!!
An object of class test
Slot a:
[1] 23


setClass(test2,contains=test,representation(b=integer))

[1] Initialization!!!
Error in .nextMethod(.Object, a = x, ...) : 
 argument x is missing, with no default



When trying to define a new class test2 above, initialize method for test is called (??? looks like a bug to me) and naturally argument x is not found. Thus I can not create a subclass for test. 

I could not find anything in documentation. 


Thanks,
Vitalie.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] S4: Initialization method called during setClass??

2009-06-05 Thread Martin Morgan
Hi Vitalie --

Vitalie S. wrote:
 Dear UseRs,
 
 A simple class inheritance example:
 
 setClass(test,representation(a=numeric))
 setMethod(initialize,test,
   function(.Object,x,...){
   print(Initialization!!!)
   callNextMethod(.Object,a=x,...)
   })
 
 new(test,x=23)
 [1] Initialization!!!
 An object of class test
 Slot a:
 [1] 23

the implicit contract is that the initialize method is written so that
new(test) works. This contract comes up at several points during class
definition and instantiation. You've identified one of those points.

 
 setClass(test2,contains=test,representation(b=integer))
 [1] Initialization!!!
 Error in .nextMethod(.Object, a = x, ...) : argument x is missing,
 with no default

I'm not sure of the details, but part of the class definition is a
coercion method, and in defining this new() is called, without
arguments, on the contained classes.

Martin

 
 
 When trying to define a new class test2 above, initialize method for
 test is called (??? looks like a bug to me) and naturally argument x
 is not found. Thus I can not create a subclass for test.
 I could not find anything in documentation.
 Thanks,
 Vitalie.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] read.table, row.names arg

2009-06-05 Thread Adrian Dusa
Markus Loecher markus.loecher at gmail.com writes:

 [...]
  x
   ID X1 X2
 1 010007787048271871  1  4
 2   1007109516820319  2  3
 3  10094843652996959  3  2
 4 010145176274075487  4  1
 
 The first column was not read in as a string, which mangled the IDs.
 I could use colClasses explicitly, but then I would need to know the number
 and classes of the remaining columns in advance.
 Is this a bug or expected behavior ?
 Any advice would be most helpful.

You could use a generic colClasses for all columns, like:

y - read.table(tmp.txt, header= TRUE, row.names=1, colClasses=character)
y
   X1 X2
010007787048271871  1  4
10071095168203192  3
10094843652996959   3  2
010145176274075487  4  1

In this case, all columns are read as character and need to be converted
manually, but your row names are appropriate.

Hoping this helps,
Adrian

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] New Meta-Analysis Package (metafor)

2009-06-05 Thread Emmanuel Charpentier
Le vendredi 05 juin 2009 à 14:03 +0200, Viechtbauer Wolfgang (STAT) a
écrit :
 A new package is now available via CRAN, called metafor.
 
 The metafor package consists of a collection of functions for
 conducting meta-analyses in R. Fixed- and random-effects models (with
 and without moderators) can be fitted via the general linear
 (mixed-effects) model. For 2x2 table data, the Mantel-Haenszel and
 Peto's method are also implemented. The package also provides various
 plot functions (for example, for forest, funnel, and radial plots) and
 functions for assessing the model fit and obtaining case diagnostics.

Thank you very much ! I think that this package was expected ...

Emmanuel Charpentier

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

2009-06-05 Thread Greg Snow
Here is one approach (this could be wrapped into a function if you are applying 
it repeatedly):

 one - c(a,z,e)
 two - c(a,z,e,r,t,a,z,a,z,e,c)
 
 which( sapply( 1:(length(two)-length(one)+1), 
+ function(i) isTRUE( all.equal( one, two[ i + 0:(length(one)-1) ] ) ) ) )
[1] 1 8


Hope this helps,

-- 
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 Ptit_Bleu
 Sent: Friday, June 05, 2009 7:22 AM
 To: r-help@r-project.org
 Subject: [R] find a sequence of characters in a vector
 
 
 Hello,
 
 I'm just looking for an easy way to find the positions of a complete
 sequence in a bigger vector.
 For example :
 c(a,z,e) in c(a,z,e,r,t,a,z,a,z,e,c)
 and the result should be
 1 8
 that is the positions of the beginning of the complete sequence.
 
 I tried with %in%, match, is.element but all I get is, for example
 which(c(a,z,e) in c(a,z,e,r,t,a,z,a,z,e,c))
 1 2 3
 meaning that each character is in the bigger vector.
 
 It must be easy, except for me. Sorry.
 
 If you have a solution, thanks in advance to share it.
 Have a good week-end,
 Ptit Bleu.
 
 --
 View this message in context: http://www.nabble.com/find-a-sequence-of-
 characters-in-a-vector-tp23888063p23888063.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


[R] help with duplicates

2009-06-05 Thread Chris Anderson
I have a large dataset that contain duplicate records. How do I identify and 
remove duplicate records?


Chris Anderson
707.315.8486
www.sassydeals4u.com

Free info for small business owners.  Click here to find great products geared 
for your business.
http://thirdpartyoffers.netzero.net/TGL2241/fc/BLSrjpYWIQYSqjUJ0P8Kjx22OUKmSdbeF2JnHh5X1EZsmlucvn6niiClhHS/
[[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] Mixed Latin, Greek and subscript characters in axis label

2009-06-05 Thread Jonathan Williams
Dear R-helpers,

I have been trying to figure out how to plot a graph with an axis label
consisting of a mixture of Latin, Greek and subscript characters.
Specifically, I need to write A[beta]{1-42}, where A is Latin script A,
[beta] is Greek lower case beta and {1-42} is subscript '1-42'.
I can use xlab=expression(beta[1-42]) and obtain the [beta]{1-42} part of
the label. But, I can't add the preceding Latin character A to this
expression.
I have tried xlab=expression(A,beta[1-42]), which simply prints 'A'. I have
tried xlab=paste('A',expression(beta[1-42])), but this prints A
(beta[1-42]).
Anything else that I try returns an error (e.g. xlab=expression(A
beta[1]42]) returns 'Error: unexpected symbol').
So, I would be very grateful if someone can tell me how to write my label.

Thanks,

Jonathan Williams

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

2009-06-05 Thread Henrique Dallazuanna
Try this:

d - data.frame(a = c(1, 1, 2, 3), b = c(10, 10, 9, 8))
unique(d)



On Fri, Jun 5, 2009 at 1:38 PM, Chris Anderson chris6...@netzero.netwrote:

 I have a large dataset that contain duplicate records. How do I identify
 and remove duplicate records?


 Chris Anderson
 707.315.8486
 www.sassydeals4u.com
 
 Free info for small business owners.  Click here to find great products
 geared for your business.

 http://thirdpartyoffers.netzero.net/TGL2241/fc/BLSrjpYWIQYSqjUJ0P8Kjx22OUKmSdbeF2JnHh5X1EZsmlucvn6niiClhHS/
[[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] help with duplicates

2009-06-05 Thread Jim Porzak
Chris,

How large is large? How may columns?

Duplicate across all columns of just some?

Henrique gave you simple R answer. Perhaps doing in SQL is more efficient?
eg

SELECT DISTINCT
 stuff
  FROM somewhere;


HTH,
Jim Porzak
TGN.com
San Francisco, CA
www.linkedin.com/in/jimporzak
use R! Group SF: www.meetup.com/R-Users/


On Fri, Jun 5, 2009 at 9:38 AM, Chris Anderson chris6...@netzero.netwrote:

 I have a large dataset that contain duplicate records. How do I identify
 and remove duplicate records?


 Chris Anderson
 707.315.8486
 www.sassydeals4u.com
 
 Free info for small business owners.  Click here to find great products
 geared for your business.

 http://thirdpartyoffers.netzero.net/TGL2241/fc/BLSrjpYWIQYSqjUJ0P8Kjx22OUKmSdbeF2JnHh5X1EZsmlucvn6niiClhHS/
[[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.


[R] question about read.xls

2009-06-05 Thread jlfmssm
I am woking on Windows and using  read.xls to read Excel.xls file.
But it needs to install perl on my machine first, and then give the
following until it can work:

read.xls(file,sheet=i,perl=E:\\Perl\\bin\\bin\\perl.exe);

I am wondering if there is other way to read Excel.xls file without needing
do this?

jlm

[[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] find a sequence of characters in a vector

2009-06-05 Thread Gabor Grothendieck
I think I would use Sundar's solution but here are a couple
more just in case:

 x - c(a, z, e)
 y - c(a, z, e, r, t, a, z, a, z, e, c)

 #1
 which(apply(embed(y, 3), 1, identical, rev(x)))
[1] 1 8

 #2
 library(zoo)
 which(rollapply(zoo(y), 3, identical, x, align = left))
[1] 1 8


On Fri, Jun 5, 2009 at 9:30 AM, Sundar Dorai-Rajsdorai...@gmail.com wrote:
 use gregexpr and paste

 aze - paste(c(a, z, e), collapse = )
 sequence - paste(c(a,z,e,r,t,a,z,a,z,e,c), collapse = 
 )
 gregexpr(aze, sequence, fixed = TRUE)
 [[1]]
 [1] 1 8
 attr(,match.length)
 [1] 3 3

 HTH,

 --sundar

 On Fri, Jun 5, 2009 at 6:22 AM, Ptit_Bleuptit_b...@yahoo.fr wrote:

 Hello,

 I'm just looking for an easy way to find the positions of a complete
 sequence in a bigger vector.
 For example :
 c(a,z,e) in c(a,z,e,r,t,a,z,a,z,e,c)
 and the result should be
 1 8
 that is the positions of the beginning of the complete sequence.

 I tried with %in%, match, is.element but all I get is, for example
 which(c(a,z,e) in c(a,z,e,r,t,a,z,a,z,e,c))
 1 2 3
 meaning that each character is in the bigger vector.

 It must be easy, except for me. Sorry.

 If you have a solution, thanks in advance to share it.
 Have a good week-end,
 Ptit Bleu.

 --
 View this message in context: 
 http://www.nabble.com/find-a-sequence-of-characters-in-a-vector-tp23888063p23888063.html
 Sent from the R help mailing list archive at Nabble.com.

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


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


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


Re: [R] question about read.xls

2009-06-05 Thread Gabor Grothendieck
Check out:
http://wiki.r-project.org/rwiki/doku.php?id=tips:data-io:ms_windows

On Fri, Jun 5, 2009 at 1:37 PM, jlfmssmjlfm...@gmail.com wrote:
 I am woking on Windows and using  read.xls to read Excel.xls file.
 But it needs to install perl on my machine first, and then give the
 following until it can work:

 read.xls(file,sheet=i,perl=E:\\Perl\\bin\\bin\\perl.exe);

 I am wondering if there is other way to read Excel.xls file without needing
 do this?

 jlm

        [[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] re ad.table, row.names arg

2009-06-05 Thread Adrian Dusa



Markus Loecher-4 wrote:
 
 Dear R users,
 I had somehow expected that read.table() would treat the column specified
 by
 the row.names argument as of class character. That seems to be the only
 sensible class allowed for a column containing row names. However, that
 does
 not seem to be the case, as the following example shows:
 
   x - cbind.data.frame(ID = c(010007787048271871, 1007109516820319,
 10094843652996959, 010145176274075487), X1 = 1:4, X2 = 4:1)
 [...snip...]
 

As a better alternative, why not move directly the first column in the
rownames?

rownames(x) - x$ID
write.table(x[, -1], tmp.txt)
y - read.table(tmp.txt, header=T)
y
   X1 X2
010007787048271871  1  4
10071095168203192  3
10094843652996959   3  2
010145176274075487  4  1

In this case, X1 and X2 variables are read as numeric, while the first
column is read as character and assigned directly to the rownames.

HTH,
Adrian
-- 
View this message in context: 
http://www.nabble.com/read.table%2C-row.names-arg-tp23888975p23892826.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] help with duplicates

2009-06-05 Thread Peter Dalgaard

Chris Anderson wrote:


I have a large dataset that contain duplicate records. How do I identify and 
remove duplicate records?



Here's one way:

 aq - airquality[sample(NROW(airquality), replace=TRUE),]
 any(duplicated(aq))
[1] TRUE
 which(duplicated(aq))
 [1]   2  15  34  44  45  47  49  50  52  53  65  75  76  78  83  86 
88  90  91
[20]  94  96  98  99 100 103 104 107 108 110 111 112 114 117 119 120 121 
122 124

[39] 125 126 127 129 130 132 133 135 137 140 141 143 145 146 147 151 152
 aqs - subset(aq,!duplicated(aq))
 any(duplicated(aqs))
[1] FALSE
 dim(aqs)
[1] 98  6
 dim(aq)
[1] 153   6

For data frames wit many columns you might want to think more carefully 
about how you recognize duplicates and maybe uses a subset of columns.


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

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


Re: [R] Mixed Latin, Greek and subscript characters in axis label

2009-06-05 Thread baptiste auguie

Jonathan Williams wrote:

Dear R-helpers,

I have been trying to figure out how to plot a graph with an axis label
consisting of a mixture of Latin, Greek and subscript characters.
Specifically, I need to write A[beta]{1-42}, where A is Latin script A,
[beta] is Greek lower case beta and {1-42} is subscript '1-42'.
I can use xlab=expression(beta[1-42]) and obtain the [beta]{1-42} part of
the label. But, I can't add the preceding Latin character A to this
expression.
I have tried xlab=expression(A,beta[1-42]), which simply prints 'A'. I have
tried xlab=paste('A',expression(beta[1-42])), but this prints A
(beta[1-42]).
Anything else that I try returns an error (e.g. xlab=expression(A
beta[1]42]) returns 'Error: unexpected symbol').
So, I would be very grateful if someone can tell me how to write my label.

Thanks,

Jonathan Williams

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


try xlab=expression(A*beta[1-42])

?plotmath entry *

x*y juxtapose x and y

HTH,

baptiste

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

2009-06-05 Thread Rainer M Krug
Hi

I want to create a new generic method, but I end up with an error
(evaluation nested too deeply). see the transcript below.
The function beginYear.Fun() works, but not beginYear.

I have no idea why.

Any ideas welcome,

Rainer


 setClass(fun, representation(x = numeric))
[1] fun
 new(fun)
An object of class “fun”
Slot x:
numeric(0)

 setGeneric(
   beginYear,
   function(object, ...) standardGeneric(beginYear)
)
setGeneric(
+beginYear,
+function(object, ...) standardGeneric(beginYear)
+ )
[1] beginYear

 beginYear.Fun = function(x) x^2
 beginYear.Fun(4)
[1] 16

 setMethod(
  beginYear,
  signature( object = numeric ),
  beginYear
  )
setMethod(
+   beginYear,
+   signature( object = numeric ),
+   beginYear
+   )
[1] beginYear

 beginYear.Fun(4)
[1] 16

 beginYear(4)
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?


-- 
Rainer M. Krug, Centre of Excellence for Invasion Biology,
Stellenbosch University, South Africa

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] p-values from VGAM function vglm

2009-06-05 Thread Steven Matthew Anderson
Anyone know how to get p-values for the t-values from the coefficients  
produced in vglm?
Attached is the code and output — see comment added to output to show  
where I need p-values



+ print(paste(**   Using VGAM function gamma2 **))
+ modl2- 
vglm(MidPoint~Count,gamma2,data=modl.subset,trace=TRUE,crit=c)

+ print(coef(modl2,matrix=TRUE))
+ print(summary(modl2))


[1] **   Using VGAM function gamma2 **
VGLMlinear loop  1 :  coefficients =
 0.408464609241,  3.255887520104, -0.000220585671
VGLMlinear loop  2 :  coefficients =
 2.34723239e-01,  1.28969691e+00, -4.52393778e-05
VGLMlinear loop  3 :  coefficients =
 2.19500481e-01,  1.92534895e+00, -3.02160949e-05
VGLMlinear loop  4 :  coefficients =
 2.19383151e-01,  2.26845910e+00, -3.00838664e-05
VGLMlinear loop  5 :  coefficients =
 2.19383045e-01,  2.34645688e+00, -3.00836087e-05
VGLMlinear loop  6 :  coefficients =
 2.19383045e-01,  2.34977070e+00, -3.00836082e-05
VGLMlinear loop  7 :  coefficients =
 2.19383045e-01,  2.34977637e+00, -3.00836082e-05
VGLMlinear loop  8 :  coefficients =
 2.19383045e-01,  2.34977637e+00, -3.00836082e-05
  log(mu) log(shape)
(Intercept)  2.193830e-01   2.349776
Count   -3.008361e-05   0.00

Call:
vglm(formula = MidPoint ~ Count, family = gamma2, data = modl.subset,
trace = TRUE, crit = c)

Pearson Residuals:
   Min   1Q   Median  3Q Max
log(mu)-1.7037 -0.82997 0.072275 0.78520 1.72834
log(shape) -2.5152 -0.32448 0.254698 0.58772 0.70678


# NEED P-VALUES HERE #

Coefficients:
Value Std. Error  t value
(Intercept):1  2.1938e-01 5.2679e-02  4.16455
(Intercept):2  2.3498e+00 1.7541e-01 13.39574
Count -3.0084e-05 8.9484e-05 -0.33619

Number of linear predictors:  2

Names of linear predictors: log(mu), log(shape)

Dispersion Parameter for gamma2 family:   1

Log-likelihood: -26.39268 on 123 degrees of freedom

Number of Iterations: 8


Steven Matthew Anderson

Anderson Research, LLC
Statistical Programming and Analysis
SAS (R) Certified Professional
adastr...@mac.com

Ad Astra per Aspera

שָׁלוֹם

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


Re: [R] error installing RCurl in SUSE SLES10-SP2

2009-06-05 Thread Duncan Temple Lang


Hi Robert

 As Brian Ripley wrote in a message to the list earlier today,
you will want a more recent version of libcurl.
RCurl can be easily made to check the availability of all the different
options to handle old versions of libcurl, but this slows down the
installation for everyone. But more importantly, it is advisable
to update curl to avoid some security issues in older versions
and to access the improvements.

  D.


Robert Castelo wrote:

dear list,

i'm trying to install the package RCurl into a linux system running SUSE
Linux Enterprise Server 10 SP2 but i get compilation errors which i
guess should be due to some missing additional software. i've been
searching about the R-help archives without success so i hope somebody
can point me out to this missing piece.

in principle, i have the necessary curl software installed:

$ rpm -qa | grep curl
curl-7.15.1-19.11
curl-devel-7.15.1-19.11
curl-32bit-7.15.1-19.11

however as you'll see below, when i try to install it from R the
compilation breaks. i've included at the end also the sessionInfo()
output (it's R-2.9.0). i've also tried to install a newer version of
RCurl (0.98) which i found in http://www.omegahat.org/RCurl but it gives
the same errors.

thanks!
robert.


install.packages(RCurl, repos=http://cran.r-project.org;)

trying URL 'http://cran.r-project.org/src/contrib/RCurl_0.97-3.tar.gz'
Content type 'application/x-gzip' length 1437829 bytes (1.4 Mb)
opened URL
==
downloaded 1.4 Mb

* Installing *source* package 'RCurl' ...
checking for curl-config... /usr/bin/curl-config
checking for gcc... gcc
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 accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
Version has a libidn field
Version has CURLOPT_URL
No CURLOPT_NOPROXY enumeration value.
No CURLINFO_CONDITION_UNMET enumeration value.
No CURLINFO_REDIRECT_URL enumeration value.
No CURLINFO_CERTINFO enumeration value.
No CURLINFO_PRIMARY_IP enumeration value.
No CURLINFO_APPCONNECT_TIME enumeration value.
No CURLOPT_KEYPASSWD enumeration value.
No CURLOPT_DIRLISTONLY enumeration value.
No CURLOPT_APPEND enumeration value.
No CURLOPT_KRBLEVEL enumeration value.
No CURLOPT_USE_SSL enumeration value.
No CURLOPT_TIMEOUT_MS enumeration value.
No CURLOPT_CONNECTTIMEOUT_MS enumeration value.
No CURLOPT_HTTP_TRANSFER_DECODING enumeration value.
No CURLOPT_HTTP_CONTENT_DECODING enumeration value.
No CURLOPT_NEW_FILE_PERMS enumeration value.
No CURLOPT_NEW_DIRECTORY_PERMS enumeration value.
No CURLOPT_POSTREDIR enumeration value.
No CURLOPT_SSH_HOST_PUBLIC_KEY_MD enumeration value.
No CURLOPT_OPENSOCKETFUNCTION enumeration value.
No CURLOPT_OPENSOCKETDATA enumeration value.
No CURLOPT_COPYPOSTFIELDS enumeration value.
No CURLOPT_PROXY_TRANSFER_MODE enumeration value.
No CURLOPT_SEEKFUNCTION enumeration value.
No CURLOPT_SEEKDATA enumeration value.
No CURLOPT_CRLFILE enumeration value.
No CURLOPT_ISSUERCERT enumeration value.
No CURLOPT_ADDRESS_SCOPE enumeration value.
No CURLOPT_CERTINFO enumeration value.
No CURLOPT_USERNAME enumeration value.
No CURLOPT_PASSWORD enumeration value.
No CURLOPT_PROXYUSERNAME enumeration value.
No CURLOPT_PROXYPASSWORD enumeration value.
No CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 enumeration value.
No CURLOPT_NOPROXY enumeration value.
No CURLOPT_TFTP_BLKSIZE enumeration value.
No CURLOPT_SOCKS5_GSSAPI_SERVICE enumeration value.
No CURLOPT_SOCKS5_GSSAPI_NEC enumeration value.
Version has CURLOPT_PROTOCOLS
Version has CURLOPT_REDIR_PROTOCOLS
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/cursos/MBI/soft/R/R-2.9.0/lib64/R/include
-DHAVE_LIBIDN_FIELD=1 -DHAVE_CURLOPT_URL=1 -DHAVE_CURLOPT_PROTOCOLS=1
-DHAVE_CURLOPT_REDIR_PROTOCOLS=1 -I/usr/local/include-fpic  -g -O2
-c base64.c -o base64.o
gcc -std=gnu99 -I/cursos/MBI/soft/R/R-2.9.0/lib64/R/include
-DHAVE_LIBIDN_FIELD=1 -DHAVE_CURLOPT_URL=1 -DHAVE_CURLOPT_PROTOCOLS=1
-DHAVE_CURLOPT_REDIR_PROTOCOLS=1 -I/usr/local/include-fpic  -g -O2
-c curl.c -o curl.o
curl.c:553: warning: 'struct curl_certinfo' declared inside parameter
list
curl.c:553: warning: its scope is only this definition or declaration,
which is probably not what you want
gcc -std=gnu99 -I/cursos/MBI/soft/R/R-2.9.0/lib64/R/include
-DHAVE_LIBIDN_FIELD=1 -DHAVE_CURLOPT_URL=1 -DHAVE_CURLOPT_PROTOCOLS=1
-DHAVE_CURLOPT_REDIR_PROTOCOLS=1 -I/usr/local/include-fpic  -g -O2
-c curlInit.c -o curlInit.o
gcc -std=gnu99 -I/cursos/MBI/soft/R/R-2.9.0/lib64/R/include
-DHAVE_LIBIDN_FIELD=1 -DHAVE_CURLOPT_URL=1 -DHAVE_CURLOPT_PROTOCOLS=1
-DHAVE_CURLOPT_REDIR_PROTOCOLS=1 -I/usr/local/include-fpic  -g -O2
-c 

[R] from 3 numeric variables to a string

2009-06-05 Thread Marc Belisle
Hi there,

I have 3 numeric variables: day (e.g., 05), month (e.g., 06), year (e.g.,
2009).

I would like to create a (string) variable of the following form:
month/day/year (e.g., 06/05/2009).

I would be grateful to anyone who could point me toward a solution.

Sincerely,

Marc

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

Tél: +1-819-821-8000 poste 61313
Fax: +1-819-821-8049
Courriél: marc.m.beli...@usherbrooke.ca

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] from 3 numeric variables to a string

2009-06-05 Thread David Winsemius


?paste

paste(month,day,year, sep=/)

On Jun 5, 2009, at 4:56 PM, Marc Belisle wrote:


Hi there,

I have 3 numeric variables: day (e.g., 05), month (e.g., 06), year  
(e.g.,

2009).

I would like to create a (string) variable of the following form:
month/day/year (e.g., 06/05/2009).

I would be grateful to anyone who could point me toward a solution.

Sincerely,

Marc



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] Chi plot and Kendall plot

2009-06-05 Thread Zhao Nan
Dear R users, 

I was trying to find a library for the Chi-plot and Kendall plot, as described 
in the paper Everything you always wanted to know about Copula Modeling but 
you were afraid to ask, but unsuccessfully. I was wondering if anyone have 
already implemented these 2 functions in R? 

Many thanks in advance, 

Nan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Dependency modeling - chi-plot and kendall-plot

2009-06-05 Thread Zhao Nan
Dear R users, 

I was trying to find a library for the Chi-plot and Kendall plot, 
as described in the paper Everything you always wanted to know about 
Copula Modeling but you were afraid to ask, but unsuccessfully. I 
was wondering if anyone have already implemented these 2 functions in R
and could kindly help me out?  

Many thanks in advance, 

Nan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] S4: When is validObject issued? (or why S4 is killing me:( ..

2009-06-05 Thread Vitalie S.

Dear UseRs,

Does anyone know when exactly the validity is checked in S4? Documentation is silent:(. 


Here is a small example:

setClass(test1,representation(a=numeric))
setMethod(initialize,test1,
  function(.Object,...){
a-runif(1)  ## here  slot a is initialized ##
   callNextMethod(.Object,a=a,...) 
  })



new(test1)

An object of class test1
Slot a:
[1] 0.755

#next new subclass is created with an additional slot b:
setClass(test2,contains=test1,representation(b=numeric)
 ## validity to test a==b ##   
 ,validity=function(object){

 if(obj...@a!=object@b) print(values must be equal!!)
 else TRUE
 })

setMethod(initialize,test2,
  function(.Object,...){
  .Object-callNextMethod(.Object,...)
  .obj...@b-.obj...@a   ## here b is initialized ##
  .Object
  })


new(test2)
Error in if (obj...@a != obj...@b) print(values must be equal!!) else TRUE : 
 argument is of length zero


This could mean only one thing, validity of test2 is checked before it gets to point when b is initialized (i.e. in callNextMethod). But this is absurd (at leas from my point): callNextMethod constructs object of type test and should have nothing to do with validity of test2. 
Shouldn't validity be checked only after the object is created?


Second my slot a is initialized in test1's constructor and b must be 
assigned only after the callNextMethod as in above code. Seemingly unsolvable paradox? How to be?

Many 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] time series, longitudinal data or trajectories

2009-06-05 Thread Christophe Genolini

Hi the list

Strictly speaking, this is not a R question, but I need the 
information for the
creation of a package. My question is about vocabulary: What is the 
difference between

time series, longitudinal data and trajectories?

Sincerely

Christophe

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

2009-06-05 Thread Duncan Temple Lang



Olivier Cailloux wrote:

Duncan Temple Lang a écrit :



Olivier Cailloux wrote:

Dear list,

Sorry about that, my e-mail has been sent too soon by mistake (also from 
an incorrect exp. address). I was planning to add further details.


So I'm running Debian Lenny. sessionInfo() gives:
R version 2.7.1 (2008-06-23)
i486-pc-linux-gnu

locale:
C

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

Version:   0.5-0
Date:  2009/05/04
Package:  XML
Version:  2.3-0
Date: 2009/03/04
Package:  RCurl
Version:  0.97-3
Package:   XMLSchema
Version:   0.1-0

I must be stupid but I can't find XMLSchema on the omegahat website. (I 
just installed the 0.1-0 version a few days ago when trying to use 
SSOAP.) Google gives nothing useful for XMLSchema site:omegahat.org.


 http://www.omegahat.org/XMLSchema/XMLSchema_0.1-1.tar.gz

or from a link in
   http://www.omegahat.org/XMLSchema/

or via the repository using

  install.packages(XMLSchema, repos = http://www.omegahat.org/R;)



I'm beginner in both web services and R programming (my knowledge is 
more in desktop  CORBA Java programming). I am simply trying to make 
Java and R communicate (call Java code from R remotely), for use by 
someone else who works in R. I'd like to provide him with a fully 
functional example. I must recognize that having to step through SSOAP 
code to find where the problem lies might be too difficult considering 
my current knowledge (knowing I don't intend to become an expert R 
programmer). Please don't take it as rude or implying that I'm simply 
expecting someone to solve the problem for me: I am ready to investigate 
but I'd simply like to have an idea of how difficult it will be. If I 
have to patch part of SSOAP or if you think that the functions I need 
are not implemented yet, then I'd better not insist and try to 
communicate from R to Java using an other way. If on the other hand you 
think it should be working and is simply a matter of using the right 
version of the right package, or using an other web services platform on 
the Java side, or configuring something differently, etc., then I'll 
happily dig into it.




Either of Simon Urbanek's rJava  or Rserve packages are worth investigating.

More generally, if someone has a suggestion on what to use to call Java 
over TCP/IP from R, I'd be interested. I am currently considering OSS as 
well as SSOAP. I'd prefer learning an approach that I can reuse for 
other languages, so possibly a standard like SOAP or CORBA would be best.


Thanks for any pointer.
Olivier



 D.




I tried different action values, because I don't know what I should 
put there. But I always get the same error.


Also, FYI, the following command produces the following output:
   smg8Def -  
processWSDL(http://smg8.ulb.ac.be:8080/axis2/services/Version?wsdl;, 
verbose=TRUE)

processing (sub) schema http://axisversion.sample
1 ) Exception
2 ) Exception
3 ) getVersionResponse
Warning message:
In 
processWSDL(http://smg8.ulb.ac.be:8080/axis2/services/Version?wsdl;,  :

 Ignoring additional serviceport ... elements

and then

I also tried a simpler service (WSDL manually created myself, but I 
am not sure it is correct although it validates):
   smg8EchoDef - 
processWSDL(http://smg8.ulb.ac.be:8080/axis2/services/EchoService?wsdl;, 
verbose=TRUE)

processing (sub) schema http://smg8.ulb.ac.be/echoSvc/
1 ) TheString
   genSOAPClientInterface(def = smg8EchoDef)
Error in d...@operations[[1]] : subscript out of bounds
Indeed:
   length(smg8echo...@operations)
[1] 0

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

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




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

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


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


Re: [R] p-values from VGAM function vglm

2009-06-05 Thread David Winsemius


On Jun 5, 2009, at 3:15 PM, Steven Matthew Anderson wrote:

Anyone know how to get p-values for the t-values from the  
coefficients produced in vglm?
Attached is the code and output — see comment added to output to  
show where I need p-values



+ print(paste(**   Using VGAM function gamma2  
**))
+ modl2- 
vglm(MidPoint~Count,gamma2,data=modl.subset,trace=TRUE,crit=c)

+ print(coef(modl2,matrix=TRUE))
+ print(summary(modl2))


[1] **   Using VGAM function gamma2 **
VGLMlinear loop  1 :  coefficients =
0.408464609241,  3.255887520104, -0.000220585671
VGLMlinear loop  2 :  coefficients =
2.34723239e-01,  1.28969691e+00, -4.52393778e-05
VGLMlinear loop  3 :  coefficients =
2.19500481e-01,  1.92534895e+00, -3.02160949e-05
VGLMlinear loop  4 :  coefficients =
2.19383151e-01,  2.26845910e+00, -3.00838664e-05
VGLMlinear loop  5 :  coefficients =
2.19383045e-01,  2.34645688e+00, -3.00836087e-05
VGLMlinear loop  6 :  coefficients =
2.19383045e-01,  2.34977070e+00, -3.00836082e-05
VGLMlinear loop  7 :  coefficients =
2.19383045e-01,  2.34977637e+00, -3.00836082e-05
VGLMlinear loop  8 :  coefficients =
2.19383045e-01,  2.34977637e+00, -3.00836082e-05
 log(mu) log(shape)
(Intercept)  2.193830e-01   2.349776
Count   -3.008361e-05   0.00

Call:
vglm(formula = MidPoint ~ Count, family = gamma2, data = modl.subset,
   trace = TRUE, crit = c)

Pearson Residuals:
  Min   1Q   Median  3Q Max
log(mu)-1.7037 -0.82997 0.072275 0.78520 1.72834
log(shape) -2.5152 -0.32448 0.254698 0.58772 0.70678


# NEED P-VALUES HERE #


Perhaps:

dt(summary( modl2 )@coef3[ , 3], 1)





Coefficients:
   Value Std. Error  t value
(Intercept):1  2.1938e-01 5.2679e-02  4.16455
(Intercept):2  2.3498e+00 1.7541e-01 13.39574
Count -3.0084e-05 8.9484e-05 -0.33619

Number of linear predictors:  2

Names of linear predictors: log(mu), log(shape)

Dispersion Parameter for gamma2 family:   1

Log-likelihood: -26.39268 on 123 degrees of freedom

Number of Iterations: 8


Steven Matthew Anderson

Anderson Research, LLC
Statistical Programming and Analysis
SAS (R) Certified Professional
adastr...@mac.com

--
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] Done: Fast way of finding top-n values of a long vector

2009-06-05 Thread Stavros Macrakis
On Fri, Jun 5, 2009 at 4:09 AM, Allan Engelhardt all...@cybaea.com wrote:

 I'm all done now.  The max2 version below is what I went with in the end
 for my proposed change to caret::nearZeroVar (which used the sort method).
 Max Kuhn will make it available on CRAN soon.  It speeds up that routine by
 a factor 2-5 on my test cases and uses much less memory.


You can save a little in max2 like this:

max2a = {w-which.max(x); x[w]/max(x[-w], na.rm=TRUE);}

If you don't need to handle NA's (or if you know a priori how many there
are), you can also speed up part:

  parta = {sel - length(x)+c(-1,0); a-sort.int(x, partial=sel,
na.last=NA)[2:1]; a[1]/a[2];}

which becomes about as fast as max2.

 library(rbenchmark)
set.seed(1); x - runif(1e7, max=1e8);
benchmark(
  replications=20,
  columns=c(test,elapsed),
  order=elapsed
, sort = {a-sort(x, decreasing=TRUE, na.last=NA)[1:2];
  a[1]/a[2];}
, qsrt = {a-sort(x, decreasing=TRUE, na.last=NA, method=quick)[1:2];
  a[1]/a[2];}
, part = {a-sort.int(-x, partial=1:2, na.last=NA)[1:2];
  a[1]/a[2];}
, parta = {end-length(x)+c(-1,0);
   a-sort.int(x, partial=end, na.last=FALSE)[end];
   a[1]/a[2]; }
, max1 = {m-max(x, na.rm=TRUE);
  w-which(x==m)[1];
  m/max(x[-w],na.rm=TRUE);}
, max2 = {w-which.max(x);
  max(x, na.rm=TRUE)/max(x[-w], na.rm=TRUE);}
, max2a = {w-which.max(x);
  x[w]/max(x[-w], na.rm=TRUE);}
)

   test elapsed
7 max2a7.80
6  max28.94
4 parta9.05
3  part   10.72
5  max1   20.21
2  qsrt   49.33
1  sort   94.18


 For what it is worth, I also made a C version (cmax below) which of
 course is faster yet again and scales nicely for returning the top n values
 of the array:

 cmax - function (v) {max - vector(double,2); max - .C(test,
 as.double(v), as.integer(length(v)), max, NAOK=TRUE)[[3]];
 return(max[1]/max[2]);}

 library(rbenchmark)
 set.seed(1); x - runif(1e7, max=1e8); x[1] - NA;
 benchmark(
 replications=20,
 columns=c(test,elapsed),
 order=elapsed
 , sort = {a-sort(x, decreasing=TRUE, na.last=NA)[1:2]; a[1]/a[2];}
 , qsrt = {a-sort(x, decreasing=TRUE, na.last=NA, method=quick)[1:2];
 a[1]/a[2];}
 , part = {a-sort.int(-x, partial=1:2, na.last=NA)[1:2]; a[1]/a[2];}
 , max1 = {m-max(x, na.rm=TRUE); w-which(x==m)[1];
 m/max(x[-w],na.rm=TRUE);}
 , max2 = {w-which.max(x); max(x, na.rm=TRUE)/max(x[-w], na.rm=TRUE);}
 , cmax = {cmax(x);}
 )
 #   test elapsed
 # 6 cmax   4.394
 # 5 max2   8.954
 # 4 max1  18.835
 # 3 part  21.749
 # 2 qsrt  46.692
 # 1 sort  77.679

 Thanks for all the suggestions and comments.

 Allan.


 PS: Slightly off-topic but is there a way within the syntax of R to set up
 things so that 'sort' (or any function) would know it is called in a partial
 list context in sort(x)[1:2] and it therefore could choose to use the
 partial argument automatically for small [] lists?  The R interpreter of
 course knows full well that it is going to drop all but the first two values
 of the result before it calls 'sort'.  Perl has 'use Want' where howmany()
 and want(n) provides a subset of this functionality (essentially for []
 lists of the form 1:n).

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] from 3 numeric variables to a string

2009-06-05 Thread Marc Schwartz


On Jun 5, 2009, at 3:56 PM, Marc Belisle wrote:


Hi there,

I have 3 numeric variables: day (e.g., 05), month (e.g., 06), year  
(e.g.,

2009).

I would like to create a (string) variable of the following form:
month/day/year (e.g., 06/05/2009).

I would be grateful to anyone who could point me toward a solution.

Sincerely,

Marc


If you want the result just as text:

day - 5
month - 6
year - 2009

 sprintf(%02d/%02d/%4d, day, month, year)
[1] 05/06/2009


Note that the day/month integers will of course not have the leading  
zeros, so using sprintf() allows you to specify that the results  
should include them (the '%02d' in the format string).


See ?sprintf for more information.

If you further want to use them as actual date objects, you can use  
as.Date() on the result:


 as.Date(sprintf(%02d/%02d/%4d, day, month, year), format = %d/%m/ 
%Y)

[1] 2009-06-05

Note that the above is now of Class 'Date':

 str(as.Date(sprintf(%02d/%02d/%4d, day, month, year), format =  
%d/%m/%Y))

Class 'Date'  num 14400

which then enables you to perform date based operations on the results.

See ?as.Date for more information on converting text to dates.

HTH,

Marc Schwartz

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] S4: Initialization method called during setClass??

2009-06-05 Thread Wacek Kusnierczyk
Martin Morgan wrote:
 Hi Vitalie --

 Vitalie S. wrote:
   
 Dear UseRs,

 A simple class inheritance example:

 
 setClass(test,representation(a=numeric))
 setMethod(initialize,test,
   
   function(.Object,x,...){
   print(Initialization!!!)
   callNextMethod(.Object,a=x,...)
   })

 
 new(test,x=23)
   
 [1] Initialization!!!
 An object of class test
 Slot a:
 [1] 23
 

 the implicit contract is that the initialize method is written so that
 new(test) works. This contract comes up at several points during class
 definition and instantiation. You've identified one of those points.

   
 setClass(test2,contains=test,representation(b=integer))
   
 [1] Initialization!!!
 Error in .nextMethod(.Object, a = x, ...) : argument x is missing,
 with no default
 

 I'm not sure of the details, but part of the class definition is a
 coercion method, and in defining this new() is called, without
 arguments, on the contained classes.
   

it sounds approximately ok that defining a subclass fails if its
initalizer does not provide a value required by the initializer of the
superclass.  pardon me my ignorance, but here's an obvious question: 
what if i *do* want to extend a class that has an initializer with an
argument without a default?  (it does not seem to be a particularly
extravagant idea, does it?)  i can't define the subclass with setClass,
because it fails, as above, due to a violation of the contract.  but i
can't define an appropriate initializer for the subclass that would
fulfil the contract before i define the subclass itself.  deadlock?

there is another quirk here, or -- in case the above is not a quirk --
there is a quirk here.  imagine i want to implement a class that counts
its instances as they are created, assigning to each a unique identifier
from a contiguous sequence of integers, starting at 1 (this doesn't seem
to be a particularly extravagant idea either):

setClass('foo', representation(id='integer'))
setMethod('initialize', 'foo', local({
id=0L
function(.Object, ...) {
   id - id+1L
   .obj...@id = id
   return(.Object) } }))

foos = replicate(3, new('foo'))
sapply(foos, slot, 'id')
# 1 2 3

setClass('bar', contains='foo', representation(name='character'))
setMethod('initialize', 'bar', function(.Object, name='bar', ...) {
   .obj...@name = name
   callNextMethod() })
bars = replicate(3, new('bar'))
sapply(bars, slot, 'id')
# 6 7 8

what??  why on earth creating a subclass *calls* (twice!) the
superclass's initializer?  is there no other way for checking the
contract without actually calling the initializer, as if an instance
(two!) was created?  suppose one creates a package defining a hierarchy
of classes with something like 'foo' at the top, and a user of the
package loads it and creates a new -- the first -- instance which
suddenly has 17 as the id -- just imagine the curses.

pardon me for the usual harshness, but this is seems irrational, plain
and simple.  i can imagine that this is a well-documented behaviour
(even if that's only in fine print), but the motivation...?


btw.,

sapply(foos, `...@`, 'id')
# Error in lapply(X, FUN, ...) :
#  no slot of name ... for this object of class foo

even though
   
`...@`(foos[[1]], 'id')
# 1

`slot`(foos[[1]], 'id')
# 1

and sapply works fine with slot.  what's wrong here?

deeply confused,
vQ

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

2009-06-05 Thread heyi xiao




Thanks Prof. Ripley,

I installed the current version curl-7.19.2,
still got the same problem.

I am installing RCurl_0.97-3 and my system
is x86_64/CentOS 5.

Looking forward to more suggestions/ideas. 



--- On Fri, 6/5/09, Prof Brian Ripley rip...@stats.ox.ac.uk wrote:

From: Prof Brian Ripley rip...@stats.ox.ac.uk
Subject: Re: [R] Install RCurl in Linux
To: heyi xiao xiaohey...@yahoo.com
Cc: r-help@r-project.org, dun...@wald.ucdavis.edu
Date: Friday, June 5, 2009, 1:50 AM

It seems you need a later curl -- 7.15 is rather old (and I think 
incomplete as a version number) and 7.19.5 is current.

It is helpful to tell us what version of packages (here RCurl) you are 
trying to use, as well as your precise OS.

On Thu, 4 Jun 2009, heyi xiao wrote:









 Hello all,

 I had both curl and curl-devel
 (both 7.15) installed on my x86_64/CentOS machine. However, I still got 
 problem
 when I do

 R CMD INSTALL RCurl

 ??

 Error message below,
 since library and/or include path is missing. I tried

 R CMD INSTALL RCurl
 --configure-args='--libdir=/usr/lib64/??
 --includedir=/usr/include/'

That should be part of the default paths.

 Same result. Any
 hint/suggestion would be appreciated.

 ...

 No CURLOPT_NOPROXY
 enumeration value.

 No
 CURLINFO_CONDITION_UNMET enumeration value.

 No
 CURLINFO_REDIRECT_URL enumeration value.

 No CURLINFO_CERTINFO
 enumeration value.

 No
 CURLINFO_PRIMARY_IP enumeration value.

 No
 CURLINFO_APPCONNECT_TIME enumeration value.

 No CURLOPT_KEYPASSWD
 enumeration value.

 No
 CURLOPT_DIRLISTONLY enumeration value.

 No CURLOPT_APPEND
 enumeration value.

 No CURLOPT_KRBLEVEL
 enumeration value.

 ...

 Version has
 CURLOPT_PROTOCOLS

 Version has
 CURLOPT_REDIR_PROTOCOLS

 configure: creating
 ./config.status

 config.status:
 creating src/Makevars

 ** libs

 gcc -std=gnu99
 -I/usr/local/lib64/R/include??
 -DHAVE_LIBIDN_FIELD=1 -DHAVE_CURLOPT_URL=1 -DHAVE_CURLOPT_PROTOCOLS=1
 -DHAVE_CURLOPT_REDIR_PROTOCOLS=1 -I/usr/local/include?? -fpic??
 -g -O2 -c enums.c -o enums.o

 In file included
 from CurlOptEnums.h:10,

  from enums.c:79:

 CURLOptTable.h:145:
 error: ??CURLOPT_SOCKOPTFUNCTION?? undeclared here (not in a function)

 CURLOptTable.h:146:
 error: ??CURLOPT_SOCKOPTDATA?? undeclared here (not in a function)

 CURLOptTable.h:147:
 error: ??CURLOPT_SSL_SESSIONID_CACHE?? undeclared here (not in a function)

 CURLOptTable.h:148:
 error: ??CURLOPT_SSH_AUTH_TYPES?? undeclared here (not in a function)

 CURLOptTable.h:149:
 error: ??CURLOPT_SSH_PUBLIC_KEYFILE?? undeclared here (not in a function)

 CURLOptTable.h:150:
 error: ??CURLOPT_SSH_PRIVATE_KEYFILE?? undeclared here (not in a function)

 CURLOptTable.h:151:
 error: ??CURLOPT_FTP_SSL_CCC?? undeclared here (not in a function)

 make: *** [enums.o]
 Error 1

 ERROR: compilation
 failed for package ??RCurl??

 * Removing
 ??/usr/local/lib64/R/library/RCurl??





     [[alternative HTML version deleted]]



-- 
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, UK                Fax:  +44 1865 272595



  
[[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] from 3 numeric variables to a string

2009-06-05 Thread Wacek Kusnierczyk
Marc Belisle wrote:
 Hi there,

 I have 3 numeric variables: day (e.g., 05), month (e.g., 06), year (e.g.,
 2009).

 I would like to create a (string) variable of the following form:
 month/day/year (e.g., 06/05/2009).

 I would be grateful to anyone who could point me toward a solution.
   

?sprintf

vQ

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

2009-06-05 Thread eric hernaez
My apologies if this is not the correct venue for this type of question. 

I am looking for a software consultant to assist in our project to 
integrate R with an existing Java data collection application.  So far, 
I have not been able to find a directory of software consultants who 
have R experience.   Ideally, the consultant would be located in the New 
York area, but it is not necessary.  Would appreciate if anyone could 
point me in the right direction.  


Thank You,
Eric Hernaez

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

2009-06-05 Thread Uwe Ligges



Rainer M Krug wrote:

Hi

I want to create a new generic method, but I end up with an error
(evaluation nested too deeply). see the transcript below.
The function beginYear.Fun() works, but not beginYear.

I have no idea why.

Any ideas welcome,

Rainer



setClass(fun, representation(x = numeric))

[1] fun

new(fun)

An object of class “fun”
Slot x:
numeric(0)


setGeneric(

   beginYear,
   function(object, ...) standardGeneric(beginYear)
)
setGeneric(
+beginYear,
+function(object, ...) standardGeneric(beginYear)
+ )
[1] beginYear


beginYear.Fun = function(x) x^2
beginYear.Fun(4)

[1] 16


setMethod(

  beginYear,
  signature( object = numeric ),
  beginYear
  )
setMethod(
+   beginYear,
+   signature( object = numeric ),
+   beginYear
+   )
[1] beginYear



 because the method function you want to call is beginYear.Fun 
rather than beginYear as declared in the method specification?


Uwe Ligges



beginYear.Fun(4)

[1] 16


beginYear(4)

Error: evaluation nested too deeply: infinite recursion / options(expressions=)?



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Dependency modeling - chi-plot and kendall-plot

2009-06-05 Thread David Winsemius

At least for chi-plot:

http://lmgtfy.com/?q=genest+%20copula+r-project+%22chi-plot%22

Genest and Favre cite R in that article. Have you contacted them?


On Jun 5, 2009, at 5:29 PM, Zhao Nan wrote:


Dear R users,

I was trying to find a library for the Chi-plot and Kendall plot,
as described in the paper Everything you always wanted to know about
Copula Modeling but you were afraid to ask, but unsuccessfully. I
was wondering if anyone have already implemented these 2 functions  
in R

and could kindly help me out?

Many thanks in advance,

Nan



--
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] Problem with generic methods

2009-06-05 Thread Martin Morgan
Rainer M Krug r.m.k...@gmail.com writes:

 Hi

 I want to create a new generic method, but I end up with an error
 (evaluation nested too deeply). see the transcript below.
 The function beginYear.Fun() works, but not beginYear.

 I have no idea why.

 Any ideas welcome,

 Rainer


 setClass(fun, representation(x = numeric))
 [1] fun
 new(fun)
 An object of class “fun”
 Slot x:
 numeric(0)

 setGeneric(
beginYear,
function(object, ...) standardGeneric(beginYear)
 )
 setGeneric(
 +beginYear,
 +function(object, ...) standardGeneric(beginYear)
 + )
 [1] beginYear

 beginYear.Fun = function(x) x^2
 beginYear.Fun(4)
 [1] 16

Are you confusing S3 and S4 method systems? The .Fun has no special
meaning in S4

 setMethod(
   beginYear,
   signature( object = numeric ),
   beginYear
   )

here the beginYear,numeric-method is defined to invoke the beginYear
generic, so you end up calling yourself. You might have meant

  setMethod(beginYear, signature(object=numeric), beginYear.Fun)

but I would have written

  setMethod(beginYear, signature(object=numeric),
function(object, ...) object^2)

Martin

 setMethod(
 +   beginYear,
 +   signature( object = numeric ),
 +   beginYear
 +   )
 [1] beginYear

 beginYear.Fun(4)
 [1] 16

 beginYear(4)
 Error: evaluation nested too deeply: infinite recursion / 
 options(expressions=)?


-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

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

2009-06-05 Thread ryan

   How do you fit a Weibull distribution in R?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] OT: a weighted rank-based, non-paired test statistic ?

2009-06-05 Thread Dylan Beaudette
Hi,

Is anyone aware of a rank-based, non-paired test such as the Krustal-Wallis, 
that can accommodate weights?

Alternatively, would it make sense to simulate a dataset by duplicating 
observations in proportion to their weight, and then using the Krustal-Wallis 
test?

thanks!
Dylan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] S4: When is validObject issued? (or why S4 is killing me:( ..

2009-06-05 Thread Martin Morgan
Vitalie S. vitosm...@rambler.ru writes:

 Dear UseRs,

 Does anyone know when exactly the validity is checked in S4?
 Documentation is silent:(. 

It gets called as part of initialize,ANY-method, i.e., at the bottom
of your 'callNextMethod'. It is NOT called when there are no arguments
in addition to .Object, e.g., in a call like new(test).

 Here is a small example:

  setClass(test1,representation(a=numeric))
  setMethod(initialize,test1,
function(.Object,...){
   a-runif(1)  ## here  slot a is initialized ##
 callNextMethod(.Object,a=a,...)  })

 new(test1)
 An object of class test1
 Slot a:
 [1] 0.755

 #next new subclass is created with an additional slot b:
  setClass(test2,contains=test1,representation(b=numeric)
   ## validity to test a==b ##
  ,validity=function(object){
   if(obj...@a!=object@b) print(values must be equal!!)
   else TRUE
   })

  setMethod(initialize,test2,
function(.Object,...){
.Object-callNextMethod(.Object,...)

validity is checked in the preceeding line

.obj...@b-.obj...@a   ## here b is initialized ##

.Object
})

 new(test2)
 Error in if (obj...@a != obj...@b) print(values must be equal!!)
 else TRUE : argument is of length zero

 This could mean only one thing, validity of test2 is checked before
 it gets to point when b is initialized (i.e. in callNextMethod). But
 this is absurd (at leas from my point): callNextMethod constructs
 object of type test and should have nothing to do with validity of
 test2. Shouldn't validity be checked only after the object is
 created?

The class of .Object is test2, and initialize should return a (valid)
instance of test2, right? So the validity check on test2 has to have
been performed before returning from callNextMethod.

 Second my slot a is initialized in test1's constructor and b
 must be assigned only after the callNextMethod as in above
 code. Seemingly unsolvable paradox? How to be?

My own solution would avoid using initialize (because as you're
discovering the contract is hard to satisfy in general) and instead
use constructors

  test2 - function(a=runif(1), b=a, ...) new(test2, a=a, b=b, ...)

or similar, which I think helps to provide a bit of an interface
between the class and it's implementation.

One could think of additional solutions (creating a new 'test' inside
'test2', and not using callNextMethod(), for instance) but this is
unlikely to be robust (e.g., when derived classes are relying on
initialize,ANY-method to fill in slots with supplied arguments).

Martin


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

-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] time series, longitudinal data or trajectories

2009-06-05 Thread Robert A LaBudde

At 04:02 PM 6/5/2009, Christophe Genolini wrote:

Hi the list

Strictly speaking, this is not a R question, but I need the 
information for the
creation of a package. My question is about vocabulary: What is the 
difference between

time series, longitudinal data and trajectories?

Sincerely

Christophe


Longitudinal data are measurements over long periods of time, often 
at irregular periods, but consistent across subjects.


Repeated measures data are replicates at the same point in time, or 
over a short period of time (e.g., laboratory experiments).


Time series typically have constant increments of time and 
typically a stochastic character, although this term might be 
considered all-encompassing for all measurements at different times.


Trajectory implies a continuous curve in time, as opposed to 
discrete times. Trajectory also implies an underlying causal model, 
as it is a term from kinematics.


I hope this helps.


Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: r...@lcfltd.com
Least Cost Formulations, Ltd.URL: http://lcfltd.com/
824 Timberlake Drive Tel: 757-467-0954
Virginia Beach, VA 23464-3239Fax: 757-467-2947

Vere scire est per causas scire

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] S4: Initialization method called during setClass??

2009-06-05 Thread Martin Morgan
Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no writes:

 Martin Morgan wrote:
 Hi Vitalie --

 Vitalie S. wrote:
   
 Dear UseRs,

 A simple class inheritance example:

 
 setClass(test,representation(a=numeric))
 setMethod(initialize,test,
   
   function(.Object,x,...){
   print(Initialization!!!)
   callNextMethod(.Object,a=x,...)
   })

 
 new(test,x=23)
   
 [1] Initialization!!!
 An object of class test
 Slot a:
 [1] 23
 

 the implicit contract is that the initialize method is written so that
 new(test) works. This contract comes up at several points during class
 definition and instantiation. You've identified one of those points.

   
 setClass(test2,contains=test,representation(b=integer))
   
 [1] Initialization!!!
 Error in .nextMethod(.Object, a = x, ...) : argument x is missing,
 with no default
 

 I'm not sure of the details, but part of the class definition is a
 coercion method, and in defining this new() is called, without
 arguments, on the contained classes.
   

 it sounds approximately ok that defining a subclass fails if its
 initalizer does not provide a value required by the initializer of the
 superclass.  pardon me my ignorance, but here's an obvious question: 
 what if i *do* want to extend a class that has an initializer with an
 argument without a default?  (it does not seem to be a particularly
 extravagant idea, does it?)  i can't define the subclass with setClass,
 because it fails, as above, due to a violation of the contract.  but i

I'm speaking as a user, so my understanding is not meant to be
definitive. I'd say the class with the intializer with an argument
without a default is broken, and you should not want to extend it.

 can't define an appropriate initializer for the subclass that would
 fulfil the contract before i define the subclass itself.  deadlock?


 there is another quirk here, or -- in case the above is not a quirk --
 there is a quirk here.  imagine i want to implement a class that counts
 its instances as they are created, assigning to each a unique identifier

remembering that R has copy-on-change semantics that are only
approximately adhered to (e.g., some copying even without change),
this objective would not likely be useful, e.g., it would not be a
good identifier to know that you were dealing with the 'same'
instance, and it would not be the way you'd want to track references
for garbage collection or other clean-up, for instance.

 from a contiguous sequence of integers, starting at 1 (this doesn't seem
 to be a particularly extravagant idea either):

 setClass('foo', representation(id='integer'))
 setMethod('initialize', 'foo', local({
 id=0L
 function(.Object, ...) {
id - id+1L
.obj...@id = id
return(.Object) } }))

 foos = replicate(3, new('foo'))
 sapply(foos, slot, 'id')
 # 1 2 3

 setClass('bar', contains='foo', representation(name='character'))
 setMethod('initialize', 'bar', function(.Object, name='bar', ...) {
.obj...@name = name
callNextMethod() })
 bars = replicate(3, new('bar'))
 sapply(bars, slot, 'id')
 # 6 7 8

 what??  why on earth creating a subclass *calls* (twice!) the
 superclass's initializer?  is there no other way for checking the

once when the superclass is instantiated (fair enough!) and once when
the validity of the subclass is checked -- the way that valildity
checking works is that subclass is validated according to the subclass
validity method, then the subclass is coerced to the superclass, and
the superclass is checked for validity. The user can define the coerce
method, but the default, for class hierarchies where it is
appropriate, involves a call to new(), and hence to initialize and
validObject.

 setClass(A)
[1] A
 setClass(B, contains=A, representation(y=numeric))
[1] B
 b - as(new(B), A)
 showMethods(coerce, class=B, includeDef=TRUE)
Function: coerce (package methods)
from=B, to=A
function (from, to = A, strict = TRUE) 
if (strict) {
value - new(A)
for (what in x) slot(value, what) - slot(from, what)
value
} else from

Martin
-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] OT: a weighted rank-based, non-paired test statistic ?

2009-06-05 Thread Thomas Lumley

On Fri, 5 Jun 2009, Dylan Beaudette wrote:

Is anyone aware of a rank-based, non-paired test such as the Krustal-Wallis,
that can accommodate weights?


You don't say what sort of weights, but basically, no.

Whether you have precision weights or sampling weights, the test will no 
longer be distribution-free.



Alternatively, would it make sense to simulate a dataset by duplicating
observations in proportion to their weight, and then using the Krustal-Wallis
test?


No.

-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle

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

2009-06-05 Thread babelproofreader

Is there a circular shift function in R similar to the shift function in
Octave? From my reading of the manual there does not appear to be one, but
if I am mistaken, can someone point out the relevant section?
-- 
View this message in context: 
http://www.nabble.com/Circular-shift-function--tp23896972p23896972.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] Fitting a Weibull Distribution

2009-06-05 Thread Mike Lawrence
http://lmgtfy.com/?q=fit+weibull+distribution+R

Hit #8:
http://cran.r-project.org/doc/contrib/Ricci-distributions-en.pdf


On Fri, Jun 5, 2009 at 7:21 PM, r...@rstatx.com wrote:

   How do you fit a Weibull distribution in R?

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




-- 
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University

Looking to arrange a meeting? Check my public calendar:
http://tr.im/mikes_public_calendar

~ Certainty is folly... I think. ~

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] OT: a weighted rank-based, non-paired test statistic ?

2009-06-05 Thread Dylan Beaudette
On Friday 05 June 2009, Thomas Lumley wrote:
 On Fri, 5 Jun 2009, Dylan Beaudette wrote:
  Is anyone aware of a rank-based, non-paired test such as the
  Krustal-Wallis, that can accommodate weights?

 You don't say what sort of weights, but basically, no.

 Whether you have precision weights or sampling weights, the test will no
 longer be distribution-free.

  Alternatively, would it make sense to simulate a dataset by duplicating
  observations in proportion to their weight, and then using the
  Krustal-Wallis test?

 No.

   -thomas

 Thomas Lumley Assoc. Professor, Biostatistics
 tlum...@u.washington.edu  University of Washington, Seattle

Thanks,

Perhaps I am thinking about the problem incorrectly. Here are some more 
details. 

I have a series of values, each associated with a polygon that represents an 
area on the ground. A sample is made by collecting the polygons (i.e. the 
values associated with each polygon) and the area fraction of each polygon 
(i.e. the observation's weight). In this past I have used this method to 
compute a weighted average, or weighted standard deviation.

However, I now have a case where a subset of individuals from the region are 
selected, and re-assigned an area fraction. I would like to evaluate if the 
subsets are representative of the original data-- so far I have been 
comparing weighted means. 

Unfortunately, the data are prone to having highly skewed distributions-- 
possibly making my comparisons of weighted-means invalid. 

I posted a question about this a while back, but just in case here are some 
data that approximately resemble the problem at hand:

# generate some data
# note lack of balance
x.1 - rnorm(n=100, mean=0, sd=1)
x.2 - rnorm(n=10, mean=4, sd=3)
x.3 - rnorm(n=10, mean=0, sd=1.5)

# generate some weights that sum to 1 for each treatment
# c/o this post: 
# https://stat.ethz.ch/pipermail/r-help/2008-July/167044.html
#
w.1 - diff(c(0,sort(sample(seq(1,99,1),99,replace=T)),100)) / 100
w.2 - diff(c(0,sort(sample(seq(1,99,1),9,replace=T)),100)) / 100
w.3 - diff(c(0,sort(sample(seq(1,99,1),9,replace=T)),100)) / 100

# generate treatment labels:
trt - factor(c(rep('baseline', 100), rep(c('data1','data2'), each=10)))

# combine into dataframe
d - data.frame(values=c(x.1,x.2,x.3), wts=c(w.1,w.2,w.3), treatment=trt)

# compute means and wt.means
d.means - sapply(by(d, d$treatment, function(i) mean(i$value)), '[')
d.wt.means - sapply(by(d, d$treatment, function(i) weighted.mean(i$value, 
w=i$wts)), '[')


# quick check:
boxplot(values~ treatment, data=d, varwidth=TRUE, border=grey(0.5), 
main='symbol size is proportional to observation weight')
points(1:3, d.means, col='green', pch=15, cex=1.2)
points(1:3, d.wt.means, col='blue', pch=15, cex=1.2)
points(jitter(as.numeric(d$treatment)), d$values, col='red', 
cex=sqrt(d$wts*100))
legend('topleft', legend=c('original data','mean','wt.mean'), pch=c(1,15,15), 
col=c('red','green','blue'))

# another way of looking at the data:
library(lattice)
densityplot(~ values, groups=treatment, data=d, auto.key=list(columns=3), 
pch='|')

# comparison of means (without weights):
# effects are equal to treatment means
summary(lm(values ~ treatment, data=d))

# comparison with means
# effects are equal to treatment weighted-means
summary(lm(values ~ treatment, data=d, weights=wts))

Cheers,
Dylan


-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] S4: Initialization method called during setClass??

2009-06-05 Thread Wacek Kusnierczyk
Martin Morgan wrote:

[...]


 it sounds approximately ok that defining a subclass fails if its
 initalizer does not provide a value required by the initializer of the
 superclass.  pardon me my ignorance, but here's an obvious question: 
 what if i *do* want to extend a class that has an initializer with an
 argument without a default?  (it does not seem to be a particularly
 extravagant idea, does it?)  i can't define the subclass with setClass,
 because it fails, as above, due to a violation of the contract.  but i
 

 I'm speaking as a user, so my understanding is not meant to be
 definitive. I'd say the class with the intializer with an argument
 without a default is broken, and you should not want to extend it.
   

broken?  in which sense?  do you want to say that it is essential, in an
oo system, to provide a default for each parameter in a
constructor/initializer for the respective class not to be broken? 

   
 there is another quirk here, or -- in case the above is not a quirk --
 there is a quirk here.  imagine i want to implement a class that counts
 its instances as they are created, assigning to each a unique identifier
 

 remembering that R has copy-on-change semantics that are only
 approximately adhered to (e.g., some copying even without change),
 this objective would not likely be useful, e.g., it would not be a
 good identifier to know that you were dealing with the 'same'
 instance, and it would not be the way you'd want to track references
 for garbage collection or other clean-up, for instance.
   

yes, i've visited this issue it in one of my earlier examples posted
here.  to me, the fact that you can clone an instance of a class without
the class's constructor/initializer being called (and without using
low-level memory copy operations) is a candidate to be considered a flaw
in the language.  the fact that it breaks the simple instance-counting
pattern (or any similar pattern) is a problem with the language, not the
pattern.

in c++, for example, you can obtain a copy of the representation of an
object, but not without a constructor being called at some point --
either before the copy operation or during it (where the copy
constructor is called):

class Foo {
private:
static int count;
int id;
public:
Foo() { id = ++count; }
Foo(const Foo foo) { id = ++count; } };

Foo foo;  // foo.id is 1
Foo bar = foo; // bar.id is 2
Foo yee(bar); // yee.id is 3
Foo daa; // daa.id is 4
Foo.daa = foo; // daa.id is 1


i find the r way, where you can create a copy of an instance without the
object system being involved, potentially confusing for users.


   
 from a contiguous sequence of integers, starting at 1 (this doesn't seem
 to be a particularly extravagant idea either):

 setClass('foo', representation(id='integer'))
 setMethod('initialize', 'foo', local({
 id=0L
 function(.Object, ...) {
id - id+1L
.obj...@id = id
return(.Object) } }))

 foos = replicate(3, new('foo'))
 sapply(foos, slot, 'id')
 # 1 2 3

 setClass('bar', contains='foo', representation(name='character'))
 setMethod('initialize', 'bar', function(.Object, name='bar', ...) {
.obj...@name = name
callNextMethod() })
 bars = replicate(3, new('bar'))
 sapply(bars, slot, 'id')
 # 6 7 8

 what??  why on earth creating a subclass *calls* (twice!) the
 superclass's initializer?  is there no other way for checking the
 

 once when the superclass is instantiated (fair enough!) 

fair?  what's fair here?  that just creating a subclass involves
instantiation of the superclass?  makes little sense to me.

 and once when
 the validity of the subclass is checked -- the way that valildity
 checking works is that subclass is validated according to the subclass
 validity method, then the subclass is coerced to the superclass, and
 the superclass is checked for validity. 

but you're talking classes here;  is coercing a *class* to another
*class* implying instantiation?  makes little sense to me. 

 The user can define the coerce
 method, but the default, for class hierarchies where it is
 appropriate, involves a call to new(), and hence to initialize and
 validObject.
   

i consider this a flaw in the object system.  if subclass validation
goes on at the instance level, why couldn't it be postponed until the
user actually creates a new instance?  otherwise, why couldn't it be
done without creating two dummy instances just for the purpose of
validation?



   
 setClass(A)
 
 [1] A
   
 setClass(B, contains=A, representation(y=numeric))
 
 [1] B
   
 b - as(new(B), A)
 showMethods(coerce, class=B, includeDef=TRUE)
 
 Function: coerce (package methods)
 from=B, to=A
 function (from, to = A, strict = TRUE) 
 if (strict) {
 value - new(A)
 for (what in x) slot(value, what) - slot(from, what)
 value
 } else from
   

well, i see i can define a coerce on my own, and that's fine, but (a)

Re: [R] p-values from VGAM function vglm

2009-06-05 Thread David Winsemius

?str

It's a pretty fundamental function for understanding R objects.

 str(summary(vglm.D93))
Formal class 'summary.vglm' [package VGAM] with 43 slots
 ..@ coef3   : num [1:5, 1:3] 3.04 -4.54e-01 -2.93e-01  
1.00e-15 9.33e-16 ...

 .. ..- attr(*, dimnames)=List of 2
 .. .. ..$ : chr [1:5] (Intercept) outcome2 outcome3  
treatment2 ...

 .. .. ..$ : chr [1:3] Value Std. Error t value
 ..@ cov.unscaled: num [1:5, 1:5] 0.0292 -0.0159 -0.0159 -0.02  
-0.02 ...

 .. ..- attr(*, dimnames)=List of 2
 .. .. ..$ : chr [1:5] (Intercept) outcome2 outcome3  
treatment2 ...
 .. .. ..$ : chr [1:5] (Intercept) outcome2 outcome3  
treatment2 ...


snipped about three pages of further output



On Jun 5, 2009, at 7:28 PM, Steven Matthew Anderson wrote:

Thank you for your reply.  Related question ... how do you know the  
matrix of values in the summary(modl2) was called coef3?  Is there a  
function for extracting that information?


dt(summary( modl2 )@coef3[ , 3], 1)

Thank you,

Steve







On Jun 5, 2009, at 2:18 PM, David Winsemius wrote:



On Jun 5, 2009, at 3:15 PM, Steven Matthew Anderson wrote:

Anyone know how to get p-values for the t-values from the  
coefficients produced in vglm?
Attached is the code and output — see comment added to output to  
show where I need p-values



+ print(paste(**   Using VGAM function gamma2  
**))
+ modl2- 
vglm(MidPoint~Count,gamma2,data=modl.subset,trace=TRUE,crit=c)

+ print(coef(modl2,matrix=TRUE))
+ print(summary(modl2))


[1] **   Using VGAM function gamma2 **
VGLMlinear loop  1 :  coefficients =
0.408464609241,  3.255887520104, -0.000220585671
VGLMlinear loop  2 :  coefficients =
2.34723239e-01,  1.28969691e+00, -4.52393778e-05
VGLMlinear loop  3 :  coefficients =
2.19500481e-01,  1.92534895e+00, -3.02160949e-05
VGLMlinear loop  4 :  coefficients =
2.19383151e-01,  2.26845910e+00, -3.00838664e-05
VGLMlinear loop  5 :  coefficients =
2.19383045e-01,  2.34645688e+00, -3.00836087e-05
VGLMlinear loop  6 :  coefficients =
2.19383045e-01,  2.34977070e+00, -3.00836082e-05
VGLMlinear loop  7 :  coefficients =
2.19383045e-01,  2.34977637e+00, -3.00836082e-05
VGLMlinear loop  8 :  coefficients =
2.19383045e-01,  2.34977637e+00, -3.00836082e-05
  log(mu) log(shape)
(Intercept)  2.193830e-01   2.349776
Count   -3.008361e-05   0.00

Call:
vglm(formula = MidPoint ~ Count, family = gamma2, data =  
modl.subset,

trace = TRUE, crit = c)

Pearson Residuals:
   Min   1Q   Median  3Q Max
log(mu)-1.7037 -0.82997 0.072275 0.78520 1.72834
log(shape) -2.5152 -0.32448 0.254698 0.58772 0.70678


# NEED P-VALUES HERE #


Perhaps:

dt(summary( modl2 )@coef3[ , 3], 1)





Coefficients:
Value Std. Error  t value
(Intercept):1  2.1938e-01 5.2679e-02  4.16455
(Intercept):2  2.3498e+00 1.7541e-01 13.39574
Count -3.0084e-05 8.9484e-05 -0.33619

Number of linear predictors:  2

Names of linear predictors: log(mu), log(shape)

Dispersion Parameter for gamma2 family:   1

Log-likelihood: -26.39268 on 123 degrees of freedom

Number of Iterations: 8


Steven Matthew Anderson

Anderson Research, LLC
Statistical Programming and Analysis
SAS (R) Certified Professional
adastr...@mac.com

--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT



Steven Matthew Anderson

Anderson Research, LLC
Statistical Programming and Analysis
SAS (R) Certified Professional
adastr...@mac.com

Ad Astra per Aspera

שָׁלוֹם






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] S4: Initialization method called during setClass??

2009-06-05 Thread Martin Morgan
Wacek Kusnierczyk wrote:
 Martin Morgan wrote:
 
 [...]
 

 from a contiguous sequence of integers, starting at 1 (this doesn't seem
 to be a particularly extravagant idea either):

 setClass('foo', representation(id='integer'))
 setMethod('initialize', 'foo', local({
 id=0L
 function(.Object, ...) {
id - id+1L
.obj...@id = id
return(.Object) } }))

 foos = replicate(3, new('foo'))
 sapply(foos, slot, 'id')
 # 1 2 3

 setClass('bar', contains='foo', representation(name='character'))
 setMethod('initialize', 'bar', function(.Object, name='bar', ...) {
.obj...@name = name
callNextMethod() })
 bars = replicate(3, new('bar'))
 sapply(bars, slot, 'id')
 # 6 7 8

 what??  why on earth creating a subclass *calls* (twice!) the
 superclass's initializer?  is there no other way for checking the
 
 once when the superclass is instantiated (fair enough!) 
 
 fair?  what's fair here?  that just creating a subclass involves
 instantiation of the superclass?  makes little sense to me.

I completely misread your post, sorry. Martin

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


[R] SAS CMO and SVP Jim Davis on Open Source, BI , competition, leadership succession others

2009-06-05 Thread Ajay ohri
An interview with Chief Marketing Officer of SAS Institute, Jim Davis.

Here is an extract-

http://www.decisionstats.com/2009/06/05/interview-jim-davis-sas-institute/

*Ajay -It is rare to find a major software company that has zero involvement
with open source movement (or as I call it with peer-reviewed code). Could
you name some of SAS Institute’s contribution to open source? What could be
further plans to enhance this position with the global community of
scientists?*

* Jim -* SAS does support open source and open standards too. Open standards
typically guide open source implementations (e.g., the OASIS work is guiding
some of the work in Eclipse Cosmos, some of the JCP standards guide the
Tomcat implementation, etc.).

Some examples of SAS’s contributions to open source and open standards
include:

* Apache Software Foundation* – a senior SAS developer has been a committer
on multiple releases of the Apache Tomcat project, and has also acted as
Release Coordinator.

*Eclipse Foundation* — SAS developers were among the early adopters of
Eclipse. One senior SAS developer wrote a tutorial whitepaper on using
Eclipse RCP, and was named “Top Ambassador” in the 2006 Eclipse Community
Awards. Another is a committer on the Eclipse Web Tools project. A third
proposed and led Eclipse’s Albireo project. SAS is a participant in the
Eclipse Cosmos project, with three RD employees as committers. Finally,
SAS’ Rich Main served on the board of directors of the Eclipse Foundation
from 2003 to 2006, helping write the Eclipse Bylaws, Development Process,
Membership Agreement, Intellectual Property Policy and Public License.

*Java Community Process *– SAS has been a Java licensee partner since 1997
and has been active in the Java Community Process. SAS has participated in
approximately 25 Java Specification Requests spanning both J2SE and J2EE
technology. Rich Main of SAS also served on the JCP Executive Committee from
2005 through 2008.

*OASIS* — A senior SAS developer serves as secretary of the OASIS Solution
Deployment Descriptor (SDD) Technical Committee. In total, six SAS employees
serve on this committee.

*XML for Analysis* — SAS co-sponsored XML for Analysis standard with
Microsoft and Hyperion.

*Others *– A small SAS team developed Cobertura, an open source coverage
analysis tool for Java. SAS (through our database access team) is one of the
top corporate contributors to Firebird, an open source relational database.
Another developer contributes to Slide WebDav. We’ve had people work on
HtmlUnit (another testing framework) and FreeBSD.

In addition, there are dozens if not hundreds of contributed bug reports,
fixes/patches from SAS developers using open source software. SAS will
continue to expand our work with and contribute to open-source tools and
communities.
For example, we know a number of our customers use R as well as SAS. So we
decided to make it easier for them to access R by .

http://www.decisionstats.com/2009/06/05/interview-jim-davis-sas-institute/

[[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] Fitting a Weibull Distribution

2009-06-05 Thread Jorge Ivan Velez
Dear ryan,
See the third example in

require(survival)
?survreg

HTH,

Jorge


On Fri, Jun 5, 2009 at 6:21 PM, r...@rstatx.com wrote:


   How do you fit a Weibull distribution in R?

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


[R] Installation of R in Redhat Linux (64 bit)

2009-06-05 Thread Santosh
Dear R experts..
I would highly appreciate your help in troubleshooting errors as shown
below..
When I type R at shell prompt, I get the following error:

The version of R in 64bit Linux is: R version 2.9.0 (2009-04-17)
***
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared library '/usr/lib64/R/library/stats/libs/stats.so':
  /usr/lib64/R/library/stats/libs/stats.so: undefined symbol:
_gfortran_copy_string
During startup - Warning message:
package stats in options(defaultPackages) was not found


When I run the following:
nm /usr/lib64/R/library/stats/libs/stats.so | grep _gfortran_copy_string

gives  the result:
 U _gfortran_copy_string

Thanks so much in advance..

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] Installation of R in Redhat Linux (64 bit)

2009-06-05 Thread Zeljko Vrba
On Fri, Jun 05, 2009 at 08:27:45PM -0700, Santosh wrote:
 
 When I run the following:
 nm /usr/lib64/R/library/stats/libs/stats.so | grep _gfortran_copy_string
 
You probably need to install libraries related to gfortran.

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