Re: [R] ploting a comparison of two scores, including the labels in the plot

2007-11-05 Thread Hans Ekbrand
On Mon, Nov 05, 2007 at 10:51:08AM -0700, Greg Snow wrote:
> Does the following do what you want (or at least start you in the correct 
> direction)?
> 
> mydata <- data.frame( job=c("Ambassadör","Läkare","Domare",  
> "Professor","Advokat","Pilot","Verkställande direktör","Forskare",
> "Civilingenjör","Statsråd"), SAMHM= c(8.32, 8.15, 8.14, 8.13, 7.95,
>  7.81, 7.78, 7.60, 7.47, 7.41),INDM= c( 7.2771, 8.1029, 7.5965,
>  7.5618, 7.1876, 7.4380, 6.8361, 7.6630, 6.8802, 6.3916))
> 
>  
> tmp <- c(rbind( mydata$SAMHM, mydata$INDM, NA ))
> tmp2 <- rep( c(1,2,NA), nrow(mydata) )
> 
> plot(tmp2, tmp, type='b', xlim=c(0,3), xlab='', ylab='rating')
> text(0.9, mydata$SAMHM, mydata$job, adj=1, cex=0.75)
> text(2.1, mydata$INDM, mydata$job, adj=0, cex=0.75)

Yes, definately! Thanks Greg, now I'll just increase the smallest
differences to a minimum so the labels becomes readable.

-- 
Hans Ekbrand (http://sociologi.cjb.net) <[EMAIL PROTECTED]>
A. Because it breaks the logical sequence of discussion
Q. Why is top posting bad?


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


[R] Pass Array input to web service

2007-11-05 Thread Rohan7

Hello everybody,
   I'm using SSOAP and RCurl to call webservice. I got success in calling
webservice with string as
an input. Now i want to pass array as an input(can be single or
multidimensional). When i do that i get
error.
 unable to find an inherited method for function "toSOAP", for signature
"data.frame", "textConnection", "NULL"

  When i remove argument part then it doesn't give any error.

here is the code

inputarray <- read.table("path/to/file")
Server <- SOAPServer("http://192.168.100.1/abc.php";)
result <-  .SOAP(Server, "FunctionName", .soapArgs=list('tempInput' =
inputarray),action="/abc.php")

Any suggestions.:working:

Thanks and regards,
Rohan7


-- 
View this message in context: 
http://www.nabble.com/Pass-Array-input-to-web-service-tf4756480.html#a13601890
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] How to know created time of object in R?

2007-11-05 Thread Prof Brian Ripley
On Tue, 6 Nov 2007, Dong-hyun Oh wrote:

> Dear UseRs,
>
> I would like to know the created time and date of specific object.
> Is there any function for it?

There isn't even the concept.  Most objects in R are a collection of 
SEXPRECs created at different times.  Suppose you create a data frame out 
of existing columns, and then later change the names? What does 'created' 
mean for the data frame?

In any case, none of the possibly relevant date-times is stored.

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

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


Re: [R] R2HTML package and Open Office: text only pasted

2007-11-05 Thread Graham Smith
Max,

Thanks, a few people have suggested this offlist and I am having a look at
this, but I just trying to quickly get results into a word processor in a
more easily read  format than a straight copy and paste.

Open Office Writer was ideal in the past, because a straight paste produced
a formatted table, something must have changed in the more recent version
but so far no reply from the Open Offfice help list.

However, now that I have grasped how ODFWeave works I can certainly see that
being useful for more formal document creation.

Graham

On 06/11/2007, Kuhn, Max <[EMAIL PROTECTED]> wrote:
>
> Graham,
>
> I'm not sure what the issue is, but I would suggest using OpenOffice
> directly with the odfWeave package.
>
> Max
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Graham Smith
> Sent: Monday, November 05, 2007 3:02 AM
> To: [EMAIL PROTECTED]
> Subject: [R] R2HTML package and Open Office: text only pasted
>
> I am trying to use R2HTML (just downloaded from CRAN) to paste R (2.6.0)
> results output via the clipboard to OpenOffice Writer and Calc
> (version 2.3on WinXPPro)
>
> Pasting into Excel gives a formatted table of results (as expected), but
> pasting into Calc simply pastes  the HTML code. Trying paste special
> only
> gives an option to paste unformatted text.
>
> Equally, with Writer, in the past when I tried this, the results were
> pasted
> as a table, but now they are pasted as HTML code. Again trying to use
> paste
> special, there is only an unformatted text option.
>
> I am using the simplest R2HTML code option, which as a I said, works
> with
> Excel
>
> HTML2clip(x)
>
> I suspect this is more an OOo issue, but hopefully someone has
> experience of
> using this combination and can help.
>
> Thanks,
>
> Graham
>
> [[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] How to know created time of object in R?

2007-11-05 Thread Dong-hyun Oh
Dear UseRs,

I would like to know the created time and date of specific object.
Is there any function for it?

Thank you in advance.


Sincerely,

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Discrepancy of Neg. Binomial Estimation in R

2007-11-05 Thread Xiaobo Lu
Dear all,

I have a puzzle regarding the estimation of Neg. Binomial event count 
model in R. I would greatly appreciate if anyone could shed some light 
on my puzzle.

Using the glm.nb command, or the zelig command developed by Gary King 
et. al., I obtain the same point estimates in R as well as in Stata. 
However, if I write my own likelihood function to estimate a neg. 
binomial event count model, my coefficient estimates are a little bit 
different (more than 5%), and my log-likelihood score is actually 
better. When I run Monte Carlo simulation, I found the coefficient 
estimates of my likelihood function have smaller variance and are closer 
to the true values than the glm.nb or Stata results do.

I don't quite understand why my neg. binomial likelihood function 
produce different result from glm.nb or Stata, because I have written 
log-likelihood function for OLS, Logit, Probit, Poisson event count 
model, and my point estimates are all very close to the results produced 
by glm.nb or Stata, and I think the tiny difference might be due to 
different optimization algorithm used. In the negative binomial case, 
the difference is too big to be credit to optimization algorithm.

Here is my code for data generating process as well as estimation.

**
# Data Generation
obs=500
beta = c(0,1)

# Generate the independent variable
z= runif(obs)

# Generate X matrix
x = cbind(rep(1,obs),z)


# Generate the dependent variable from a neg. binomial distribution
phi = exp(x%*%beta)
sigma_2 = 10
y = rnbinom(obs,size=phi/(sigma_2-1),mu=phi)


# Neg. Binomial log-likelihood function
like.nb=function(par,x,y)
{
  phi_e=exp(x%*%par[1:2])
  sig2_e=exp(par[3])+1
sum(lgamma(phi_e/(sig2_e-1)+y)-lgamma(phi_e/(sig2_e-1))+y*log((sig2_e-1)/sig2_e)-(phi_e/(
 
sig2_e-1))*log(sig2_e))
}

# Ng. Binomial regression
b = solve(t(x)%*%x,(t(x)%*%y))  
b = matrix(c(b,var(y)/mean(y)),nrow=3) # set initial value for means and 
variance
nb.res = optim(b,like.nb, y=y, x=x, method="BFGS", 
control=list(fnscale=-1), hessian=T)
nbcoef=nb.res$par
nbvcovm=solve(-nb.res$hessian)

# Alternative glm function
library(MASS)
summary(glm.nb(y~z))

**

Thanks a lot in advance for your help.


Best,
Xiaobo

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


Re: [R] Mac OS X Leopard and C compiling

2007-11-05 Thread elw


Notable that your commandline is trying to use the 10.4u sdk, while ld is 
trying to use libdylib "10.5" - aka leopard dynamic linker.

The two probably don't go all that groovily together... :)

is the -isysroot /Developer/SDKs/MacOSX10.4u.sdk bit being generated by R 
CMD SHLIB?

Where'd the R come from?  Built on Tiger or Leopard?  My guess = Tiger... 
maybe try a source build of R with current XCode, and then use that?

--e

On Mon, 5 Nov 2007, Daniel McDonald wrote:

> Date: Mon, 5 Nov 2007 20:10:29 -0500
> From: Daniel McDonald <[EMAIL PROTECTED]>
> To: r-help@r-project.org
> Subject: [R] Mac OS X Leopard and C compiling
> 
> I recently bought a new Intel Mac with OSX Leopard. I reinstalled the
> latest version of R and the Xcode tools. I'm trying to compile a C
> source code with the R compiler in X11, and I receive the following
> error message:
>
> [Macintosh:School Work 07-08/36-711/HW 3] dajmcdon% R CMD SHLIB McDonaldHW3.c
> gcc-4.0 -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
> -std=gnu99 -no-cpp-precomp
> -I/Library/Frameworks/R.framework/Resources/include
> -I/Library/Frameworks/R.framework/Resources/include/i386  -msse3
> -fPIC  -g -O2 -march=nocona -c McDonaldHW3.c -o McDonaldHW3.o
> gcc-4.0 -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
> -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names
> -Wl,-macosx_version_min -Wl,10.3 -undefined dynamic_lookup
> -single_module -multiply_defined suppress -L/usr/local/lib -o
> McDonaldHW3.so McDonaldHW3.o   -F/Library/Frameworks/R.framework/..
> -framework R
> ld: library not found for -ldylib1.10.5.o
> collect2: ld returned 1 exit status
> make: *** [McDonaldHW3.so] Error 1
>
> McDonaldHW3.c is the code I am trying to compile. It works fine on my
> old machine but not on the new one. Any ideas?
>
> Thanks,
> Daniel
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Save and load workspace in R: strange error.

2007-11-05 Thread Hongxiao Zhu
Hi,

I finally figured out where the problem is. It was because the 
user account has a 10GB quota for the systerm that I used.
Once the space limit is reached, R will have this error whenever you
want to save or load.
Gosh! It took me so long to realize this.

Hongxiao 
**
  *  Hongxiao Zhu  *
  *  Department of Statistics, Rice Univeristy *
  *  Office: DH 3136, Phone: 713-348-2839  *
  *  http://www.stat.rice.edu/~hxzhu/  *
  **

On Wed, 3 Oct 2007, Tony Plate wrote:

> Did you check whether 'junk4.RData' was created and what its length was - 
> maybe an empty file is being created.  Is there some sort of quota or 
> permissions problem?  My suggestion would be to look at the size and 
> permissions on the directory and the file.  If you need more help, I would 
> suggest posting more details back to the list, e.g., what OS you are using, 
> and a directory listing that shows file sizes and permissions (i.e., as you 
> get with 'ls -l' on Unix systems.)
>
> -- Tony Plate
>
> Hongxiao Zhu wrote:
>> Hi,
>> 
>> I tried to load a .RData object on unix system using R, it gives error:
>> 
>> Error: restore file may be empty -- no data loaded
>> In addition: Warning message:
>> file 'junk3.RData' has magic number ''
>> Use of save versions prior to 2 is deprecated
>> 
>> This happens only for using MY user account for the Unix system. I tried 
>> to use a friends's user account to load the same data object, it is
>> fine. And it never happened to me before until sometime last week.
>> And This error happens even when I generate a simple random number
>> from my user account and save it, and load it again.(So obviously it is 
>> not a R version mismatch problem). Does anybody know what happened?
>> 
>> Here is an example what happened:
>> 
>>> x=rnorm(100)
>>> save.image('junk4.RData')
>>> load('junk4.RData')
>> Error: restore file may be empty -- no data loaded
>> In addition: Warning message:
>> file 'junk4.RData' has magic number ''
>> Use of save versions prior to 2 is deprecated
>> 
>> Thanks for any suggestion.
>> 
>> Hongxiao
>> 
>> 
>> **
>>   *  Hongxiao Zhu  *
>>   *  Department of Statistics, Rice Univeristy *
>>   *  Office: DH 3136, Phone: 713-348-2839  *
>>   *  http://www.stat.rice.edu/~hxzhu/  *
>> 
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>> 
>
>
> !DSPAM:4703b16f15261021468!
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Mac OS X Leopard and C compiling

2007-11-05 Thread Daniel McDonald
I recently bought a new Intel Mac with OSX Leopard. I reinstalled the
latest version of R and the Xcode tools. I'm trying to compile a C
source code with the R compiler in X11, and I receive the following
error message:

[Macintosh:School Work 07-08/36-711/HW 3] dajmcdon% R CMD SHLIB McDonaldHW3.c
gcc-4.0 -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-std=gnu99 -no-cpp-precomp
-I/Library/Frameworks/R.framework/Resources/include
-I/Library/Frameworks/R.framework/Resources/include/i386  -msse3
-fPIC  -g -O2 -march=nocona -c McDonaldHW3.c -o McDonaldHW3.o
gcc-4.0 -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names
-Wl,-macosx_version_min -Wl,10.3 -undefined dynamic_lookup
-single_module -multiply_defined suppress -L/usr/local/lib -o
McDonaldHW3.so McDonaldHW3.o   -F/Library/Frameworks/R.framework/..
-framework R
ld: library not found for -ldylib1.10.5.o
collect2: ld returned 1 exit status
make: *** [McDonaldHW3.so] Error 1

McDonaldHW3.c is the code I am trying to compile. It works fine on my
old machine but not on the new one. Any ideas?

Thanks,
Daniel

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Unique Pairs based on a Minimum Value

2007-11-05 Thread Chuck Cleland
Bret Collier wrote:
> RUsers,
> 
> I am trying (with little success) to determine how to combine unique and 
> min to do some data frame manipulations and I could use a little advice. 
>   I have tried various combinations of 'unique', 'min' and 'apply' with 
> no luck.
> 
> Given this simple example data (x, y)
> 
> x<-c(10, 10, 12, 13, 15, 16 ,17, 17, 17)
> y<-c(112, 117, 111, 117, 114, 113, 119, 121, 130)
> 
> as.data.frame(cbind(x, y))
> 
> x   y
> 1 10 112
> 2 10 117
> 3 12 111
> 4 13 117
> 5 15 114
> 6 16 113
> 7 17 119
> 8 17 121
> 9 17 130
> 
> I have been attempting to get all those unique 'x-y' combinations for 
> which the y column is the minimum of the values y takes for each unique 
> x (ID variable), such as below.
> 
> x   y
> 1 10 112
> 3 12 111
> 4 13 117
> 5 15 114
> 6 16 113
> 7 17 119
> 
> Any advice/directions I could look would be appreciated.

x<-c(10, 10, 12, 13, 15, 16 ,17, 17, 17)
y<-c(112, 117, 111, 117, 114, 113, 119, 121, 130)
df <- data.frame(x,y)

aggregate(df, list(df$x), min)[,c("x","y")]
   x   y
1 10 112
2 12 111
3 13 117
4 15 114
5 16 113
6 17 119

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

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

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


[R] Bootstrap CI of Slope in a Weighted Simple Linear Regression

2007-11-05 Thread Tom La Bone

Greetings,

I would like to use the "boot" function to generate a bootstrap confidence
interval for the slope in a SLR that has a zero intercept. My attempt to do
this is shown below. Is this the correct implementation of the boot function
to solve this problem? In particular, should I be doing anything with the
residuals in the "bs" function (e.g., using weighted residuals)? Thanks for
the help.

X <- c(0.875691867,0.871198003,0.814833892,0.788439976,0.738949275,
0.662589259,0.625487458,0.596570413,0.573693499,0.541569432,0.490628528,
0.440835275,0.397729163,0.358838088,0.323749892,0.24980067,0.213632079,
0.159989195,0.127709133,0.109218152,0.104276109,0.086467125,0.075718558,
0.059271067,0.05441905,0.049097803,0.044388138,0.014282204,0.004744354)

Y <-
c(1.710091172,1.719901584,1.677683515,1.586374357,1.492977191,1.327498848,
1.301327304,1.25174086,1.149220115,1.130543366,0.974774745,0.912550499,0.752369319,
0.745150543,0.639280298,0.478799628,0.433639966,0.346051447,0.280818024,0.230285038,
0.201046915,0.179974417,0.163766453,0.102048289,0.75621,0.100711353,0.072401066,
0.023761328,0.013927331)

W <- 1/X

fit <- lm(Y ~ X - 1,weights=W)
Y.hat <- predict(fit)
r <- resid(fit)
data.df <- as.data.frame(cbind(X,Y,W))
bs <- function(data, indices) {
  Y.b <- Y.hat + r[indices]
  fit.b <- lm(Y.b ~ X - 1,weights=W)
  return(coef(fit.b))}
results <- boot(data=data.df, statistic=bs,R=1000)

boot.ci(results, type="perc", index=1)

-- 
View this message in context: 
http://www.nabble.com/Bootstrap-CI-of-Slope-in-a-Weighted-Simple-Linear-Regression-tf4755456.html#a13598953
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] Unique Pairs based on a Minimum Value

2007-11-05 Thread jim holtman
Here is one way of doing it:

> z <- as.data.frame(cbind(x, y))
> a <- by(z, z$x, function(b) b[which.min(b$y),])
> do.call('rbind', a)
x   y
10 10 112
12 12 111
13 13 117
15 15 114
16 16 113
17 17 119
>


On 11/5/07, Bret Collier <[EMAIL PROTECTED]> wrote:
> RUsers,
>
> I am trying (with little success) to determine how to combine unique and
> min to do some data frame manipulations and I could use a little advice.
>  I have tried various combinations of 'unique', 'min' and 'apply' with
> no luck.
>
> Given this simple example data (x, y)
>
> x<-c(10, 10, 12, 13, 15, 16 ,17, 17, 17)
> y<-c(112, 117, 111, 117, 114, 113, 119, 121, 130)
>
> as.data.frame(cbind(x, y))
>
>x   y
> 1 10 112
> 2 10 117
> 3 12 111
> 4 13 117
> 5 15 114
> 6 16 113
> 7 17 119
> 8 17 121
> 9 17 130
>
> I have been attempting to get all those unique 'x-y' combinations for
> which the y column is the minimum of the values y takes for each unique
> x (ID variable), such as below.
>
>x   y
> 1 10 112
> 3 12 111
> 4 13 117
> 5 15 114
> 6 16 113
> 7 17 119
>
> Any advice/directions I could look would be appreciated.
>
> TIA,
> Bret
> R 2.6.0; platform i386-pc-mingw32
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


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

What is the problem you are trying to solve?

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


[R] Unique Pairs based on a Minimum Value

2007-11-05 Thread Bret Collier
RUsers,

I am trying (with little success) to determine how to combine unique and 
min to do some data frame manipulations and I could use a little advice. 
  I have tried various combinations of 'unique', 'min' and 'apply' with 
no luck.

Given this simple example data (x, y)

x<-c(10, 10, 12, 13, 15, 16 ,17, 17, 17)
y<-c(112, 117, 111, 117, 114, 113, 119, 121, 130)

as.data.frame(cbind(x, y))

x   y
1 10 112
2 10 117
3 12 111
4 13 117
5 15 114
6 16 113
7 17 119
8 17 121
9 17 130

I have been attempting to get all those unique 'x-y' combinations for 
which the y column is the minimum of the values y takes for each unique 
x (ID variable), such as below.

x   y
1 10 112
3 12 111
4 13 117
5 15 114
6 16 113
7 17 119

Any advice/directions I could look would be appreciated.

TIA,
Bret
R 2.6.0; platform i386-pc-mingw32

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

2007-11-05 Thread jim holtman
Do

?"Memory-limits"

and then look at

?memory.limit

I have an icon that starts R and have that as the command line
parameter.  You should be able to set that up.  You should be able to
use

memory.limit(2000)  # set limit to 2GB

in .Rprofile.



On 11/5/07, Johan Jackson <[EMAIL PROTECTED]> wrote:
> Aha. Thanks Jim you rock. So my system is probably hitting that upper
> limit of 2-3GB (a 32 bit issue I assume). Looks like I need to go 64
> bit.
>
> BTW, --max-mem-size looks like a command line command. Can I execute
> something similar from within .Rprofile so that it does this each time
> I start R?
>
> Thanks again for your help,
>
> Johan Jackson
>
>
> On 11/5/07, jim holtman <[EMAIL PROTECTED]> wrote:
> > Even when it does start using virtual memory (which you never want it
> > to do from a performance standpoint), there is still the physical
> > limitation (e.g., a 2-3GB on Windows depending on how you have it
> > configured) that you can not exceed.  Also the maximum memory is set
> > to:
> >
> > --max-mem-size=N
> > (Windows only) Specify a limit for the amount of memory to be used
> > both for R objects and working areas. This is set by default to the
> > smaller of 1.5Gb24 and the amount of physical RAM in the machine, and
> > must be between 32Mb and 3Gb.
> >
> > This is a parameter on the startup command.  On my machine I have 2GB
> > and let it default to 1.5GB.  This number should be less than the
> > physical memory on your system.  This is what is "runs out of".
> >
> >
> >
> > On 11/5/07, Johan Jackson <[EMAIL PROTECTED]> wrote:
> > > Hi all,
> > >
> > > R newbie, but have been reading the boards and learning lots. I have
> > > read all documents & list-serve responses I could about R and memory
> > > but still no answer.
> > >
> > > QUESTION:
> > >
> > > When the sizes of your objects exceeds your available RAM, R switches
> > > to Virtual Memory right? If so, why does it so often run out of memory
> > > and return an "unable to allocate XXX KB" error shortly after
> > > switching to virtual memory when there is PLENTY of virtual memory to
> > > be had (I think)?
> > >
> > > I have noticed this on both my mac and my pc, so it doesn't seem to be
> > > OS specific.
> > >
> > > Any help in understanding this would be most appreciated!
> > >
> > >
> > >  - J Jackson
> > >
> > > __
> > > R-help@r-project.org mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide 
> > > http://www.R-project.org/posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.
> > >
> >
> >
> > --
> > Jim Holtman
> > Cincinnati, OH
> > +1 513 646 9390
> >
> > What is the problem you are trying to solve?
> >
>


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

What is the problem you are trying to solve?

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


Re: [R] R2HTML package and Open Office: text only pasted

2007-11-05 Thread Kuhn, Max
Graham,

I'm not sure what the issue is, but I would suggest using OpenOffice
directly with the odfWeave package.

Max

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Graham Smith
Sent: Monday, November 05, 2007 3:02 AM
To: [EMAIL PROTECTED]
Subject: [R] R2HTML package and Open Office: text only pasted

I am trying to use R2HTML (just downloaded from CRAN) to paste R (2.6.0)
results output via the clipboard to OpenOffice Writer and Calc
(version 2.3on WinXPPro)

Pasting into Excel gives a formatted table of results (as expected), but
pasting into Calc simply pastes  the HTML code. Trying paste special
only
gives an option to paste unformatted text.

Equally, with Writer, in the past when I tried this, the results were
pasted
as a table, but now they are pasted as HTML code. Again trying to use
paste
special, there is only an unformatted text option.

I am using the simplest R2HTML code option, which as a I said, works
with
Excel

HTML2clip(x)

I suspect this is more an OOo issue, but hopefully someone has
experience of
using this combination and can help.

Thanks,

Graham

[[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] question about running out of memory on R

2007-11-05 Thread Johan Jackson
Aha. Thanks Jim you rock. So my system is probably hitting that upper
limit of 2-3GB (a 32 bit issue I assume). Looks like I need to go 64
bit.

BTW, --max-mem-size looks like a command line command. Can I execute
something similar from within .Rprofile so that it does this each time
I start R?

Thanks again for your help,

Johan Jackson


On 11/5/07, jim holtman <[EMAIL PROTECTED]> wrote:
> Even when it does start using virtual memory (which you never want it
> to do from a performance standpoint), there is still the physical
> limitation (e.g., a 2-3GB on Windows depending on how you have it
> configured) that you can not exceed.  Also the maximum memory is set
> to:
>
> --max-mem-size=N
> (Windows only) Specify a limit for the amount of memory to be used
> both for R objects and working areas. This is set by default to the
> smaller of 1.5Gb24 and the amount of physical RAM in the machine, and
> must be between 32Mb and 3Gb.
>
> This is a parameter on the startup command.  On my machine I have 2GB
> and let it default to 1.5GB.  This number should be less than the
> physical memory on your system.  This is what is "runs out of".
>
>
>
> On 11/5/07, Johan Jackson <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > R newbie, but have been reading the boards and learning lots. I have
> > read all documents & list-serve responses I could about R and memory
> > but still no answer.
> >
> > QUESTION:
> >
> > When the sizes of your objects exceeds your available RAM, R switches
> > to Virtual Memory right? If so, why does it so often run out of memory
> > and return an "unable to allocate XXX KB" error shortly after
> > switching to virtual memory when there is PLENTY of virtual memory to
> > be had (I think)?
> >
> > I have noticed this on both my mac and my pc, so it doesn't seem to be
> > OS specific.
> >
> > Any help in understanding this would be most appreciated!
> >
> >
> >  - J Jackson
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem you are trying to solve?
>

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


Re: [R] Help with Error Message

2007-11-05 Thread Matthew Keller
Not having run your script, it looks to me like you have an extra
comma after the final element of legend.list...

On 11/5/07, Patrick Richardson <[EMAIL PROTECTED]> wrote:
> Hoping someone can offer me some assistance.  I'm trying to execute a script
> and I keep getting this error message about "Error: element 12 is empty".
> I'm wondering if my syntax is incorrect within legend.list.  If anyone has
> any suggestions to sees something obvious that I am missing, I would greatly
> appreciate any help.
>
> Many Thanks,
>
> Patrick
>
> > # These are the symbols and colors to use for each phenotype in the model
> and test sets
> > #  model samples:   square symbols
> > #  color symbol  phenotype
> > legend.list <- c("green", 22,# ALL-B
> +  "steelblue", 22,# ALL-T
> +  "red",   22,# AML
> + #  test samples:cicle symbols
> + #  color symbol  phenotype
> +  "lightgreen",21,# ALL-B
> +  "lightblue", 21,# ALL T
> +  "orange",21,# AML
> + )
> Error: element 12 is empty;
>the part of the args list of 'c' being evaluated was:
>(22, "steelblue", 22, "red", 22, "lightgreen", 21, "lightblue", 21,
> "orange", 21, )
> >
> > col <- legend.list[seq(1, length(legend.list), 2)]
> Error: object "legend.list" not found
> > symbs <- as.numeric(legend.list[seq(2, length(legend.list), 2)])
> Error: object "legend.list" not found
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Matthew C Keller
Asst. Professor of Psychology
University of Colorado at Boulder
www.matthewckeller.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] question about running out of memory on R

2007-11-05 Thread jim holtman
Even when it does start using virtual memory (which you never want it
to do from a performance standpoint), there is still the physical
limitation (e.g., a 2-3GB on Windows depending on how you have it
configured) that you can not exceed.  Also the maximum memory is set
to:

--max-mem-size=N
(Windows only) Specify a limit for the amount of memory to be used
both for R objects and working areas. This is set by default to the
smaller of 1.5Gb24 and the amount of physical RAM in the machine, and
must be between 32Mb and 3Gb.

This is a parameter on the startup command.  On my machine I have 2GB
and let it default to 1.5GB.  This number should be less than the
physical memory on your system.  This is what is "runs out of".



On 11/5/07, Johan Jackson <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> R newbie, but have been reading the boards and learning lots. I have
> read all documents & list-serve responses I could about R and memory
> but still no answer.
>
> QUESTION:
>
> When the sizes of your objects exceeds your available RAM, R switches
> to Virtual Memory right? If so, why does it so often run out of memory
> and return an "unable to allocate XXX KB" error shortly after
> switching to virtual memory when there is PLENTY of virtual memory to
> be had (I think)?
>
> I have noticed this on both my mac and my pc, so it doesn't seem to be
> OS specific.
>
> Any help in understanding this would be most appreciated!
>
>
>  - J Jackson
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


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

What is the problem you are trying to solve?

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


[R] Help with Error Message

2007-11-05 Thread Patrick Richardson
Hoping someone can offer me some assistance.  I'm trying to execute a script
and I keep getting this error message about "Error: element 12 is empty".
I'm wondering if my syntax is incorrect within legend.list.  If anyone has
any suggestions to sees something obvious that I am missing, I would greatly
appreciate any help.

Many Thanks,

Patrick

> # These are the symbols and colors to use for each phenotype in the model
and test sets 
> #  model samples:   square symbols
> #  color symbol  phenotype
> legend.list <- c("green", 22,# ALL-B 
+  "steelblue", 22,# ALL-T 
+  "red",   22,# AML   
+ #  test samples:cicle symbols
+ #  color symbol  phenotype 
+  "lightgreen",21,# ALL-B 
+  "lightblue", 21,# ALL T 
+  "orange",21,# AML 
+ )
Error: element 12 is empty;
   the part of the args list of 'c' being evaluated was:
   (22, "steelblue", 22, "red", 22, "lightgreen", 21, "lightblue", 21,
"orange", 21, )
> 
> col <- legend.list[seq(1, length(legend.list), 2)]
Error: object "legend.list" not found
> symbs <- as.numeric(legend.list[seq(2, length(legend.list), 2)])
Error: object "legend.list" not found

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

2007-11-05 Thread Dennis . Burian

Dear all,

Want to update to 2.6 on a RedHat EL4 64 bit system.  When the RPM tries to
install, I get a message that R2.5.1-dev is necessary.  I don't have
2.5.1-dev installed so the 2.6 install quits.  I couldn't find 2.5.1-dev at
CRAN so I'm stuck.  Any help would be appreciated.

Thanks in advance,

Dennis Burian, Ph.D.
Functional Genomics Group
Civil Aerospace Medical Institute, AAM-610
6500 S. MacArthur Blvd.
Oklahoma City OK  73169
405-954-6087
[EMAIL PROTECTED]

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


[R] Combining Density plots

2007-11-05 Thread Gareth Campbell
Hello,

What I am trying to do is:

Generate a density plot of a population of data.  This data has a bimodal
distribution so I've isolated a couple of possible sub-populations and I
want to overlay these two density plots over the first to see whether they
are contributing to the bimodal population.

I can do this fine with plot(density(...)) and lines(density(...)) .  But
the resulting plots seem to NOT share the same scale or something.  I've had
a read up on bandwidth and fiddled with this but I can't quite get them how
they should look.  Needless to say that the sub-populations are smaller (n)
than the overall population.

Does anyone know how to scale the populations so they all plot on the same
scale with the density function?

Thanks very much

-- 
Gareth Campbell
PhD Candidate
The University of Auckland

P+649 815 3670
M+6421 256 3511
E   [EMAIL PROTECTED]
 [EMAIL PROTECTED]

[[alternative HTML version deleted]]

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


Re: [R] perl module for R

2007-11-05 Thread Duncan Temple Lang
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



Lux Zhang wrote:
> On 06/11/2007, Adrian Dusa <[EMAIL PROTECTED]> wrote:
>> On Monday 05 November 2007, you wrote:
>>> On 04/11/2007, Andrew Perrin <[EMAIL PROTECTED]> wrote:
 http://www.omegahat.org/RSPerl/

 --
 Andrew J Perrin - andrew_perrin (at) unc.edu -
 http://perrin.socsci.unc.edu
 Associate Professor of Sociology; Book Review Editor, _Social Forces_
 University of North Carolina - CB#3210, Chapel Hill, NC 27599-3210 USA
>>> hi, can some one convert this R command into perl for me?
>>>
>>> layout(matrix(1,2,3,4,5,6), 2,3, byrow=TRUE)
>>
>> I don't think anyone can possibly translate it into Perl (or in any other
>> language), simply because your command is faulty.
>> What are you trying to achieve:
>> - produce a matrix, or
>> - create a graphics device split into rows and columns?
>>
>> Either way, your matrix command is wrong, eg:
>> matrix(c(1,2,3,4,5,6), 2, 3, byrow=TRUE)
>>   ^^^
>> (notice the c() function)
> 
> 
> thanks, that was a typo.
> What I want to to convert
> layout(matrix(c(1,2,3,4), 2,2,, byrow=TRUE) ) to a perl code.
> 
> I tried it as
> &R::call ("layout", "(matrix(c(1,2,3), 1,3, byrow=TRUE))" );
> 
> It is not working.
> 
> BUT the following is working
> 
> &R::eval ("layout (matrix(c(1,2,3), 1,3, byrow=TRUE))" );


The RSPerl interface is designed to allow the Perl programmer
to avoid the R syntax and to make calls to R functions in the
Perl style, managing variables in Perl rather than in both Perl
and R's namespace.
That said, since you want to evaluate an R expression
you can call an R function which takes that R command
as a string and both parses it and evaluates the expression.

So
&R::parseEval("layout(matrix(c(1,2,3,4), 2,2,, byrow=TRUE) )");

will do it.

Or if you want to use the function invocation mechanism,

  R::layout(R::matrix([1, 3, 2, 4], 2, 2))

(or something close...)

Note that the 1, 2, 3, 4 are coming from a Perl array (if that is the
correct Perl syntax for an array)

I reorganized the elements to simplify the example as specifying an R
argument by name (i.e. byrow) in Perl is annoying as Perl does not have
named arguments.





> 
> The R Call involves 3 layers of R function c(), matrix() and layout(). The
> essential question is how to implement the R functions in a logical order
> into perl?
> 
> Hope some one can exmplify this.
> 
> 
> 
> 
> 
> Adrian
>> --
>> Adrian Dusa
>> Romanian Social Data Archive
>> 1, Schitu Magureanu Bd
>> 050025 Bucharest sector 5
>> Romania
>> Tel./Fax: +40 21 3126618 \
>>   +40 21 3120210 / int.101
>>
> 
>   [[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.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHL5sj9p/Jzwa2QP4RAt6JAJwNmHZspWmBDgs82vO6j5/9lmxdTwCfXK0f
UUsUvQlPFhLUXoIOSgCo/zU=
=bfk8
-END PGP SIGNATURE-

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


[R] perl module for R

2007-11-05 Thread Lux Zhang
On 06/11/2007, Adrian Dusa <[EMAIL PROTECTED]> wrote:
>
> On Monday 05 November 2007, you wrote:
> > On 04/11/2007, Andrew Perrin <[EMAIL PROTECTED]> wrote:
> > > http://www.omegahat.org/RSPerl/
> > >
> > > --
> > > Andrew J Perrin - andrew_perrin (at) unc.edu -
> > > http://perrin.socsci.unc.edu
> > > Associate Professor of Sociology; Book Review Editor, _Social Forces_
> > > University of North Carolina - CB#3210, Chapel Hill, NC 27599-3210 USA
>
> >
> > hi, can some one convert this R command into perl for me?
> >
> > layout(matrix(1,2,3,4,5,6), 2,3, byrow=TRUE)
>
>
> I don't think anyone can possibly translate it into Perl (or in any other
> language), simply because your command is faulty.
> What are you trying to achieve:
> - produce a matrix, or
> - create a graphics device split into rows and columns?
>
> Either way, your matrix command is wrong, eg:
> matrix(c(1,2,3,4,5,6), 2, 3, byrow=TRUE)
>   ^^^
> (notice the c() function)


thanks, that was a typo.
What I want to to convert
layout(matrix(c(1,2,3,4), 2,2,, byrow=TRUE) ) to a perl code.

I tried it as
&R::call ("layout", "(matrix(c(1,2,3), 1,3, byrow=TRUE))" );

It is not working.

BUT the following is working

&R::eval ("layout (matrix(c(1,2,3), 1,3, byrow=TRUE))" );

The R Call involves 3 layers of R function c(), matrix() and layout(). The
essential question is how to implement the R functions in a logical order
into perl?

Hope some one can exmplify this.





Adrian
>
> --
> Adrian Dusa
> Romanian Social Data Archive
> 1, Schitu Magureanu Bd
> 050025 Bucharest sector 5
> Romania
> Tel./Fax: +40 21 3126618 \
>   +40 21 3120210 / int.101
>

[[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 translating S-Plus command

2007-11-05 Thread Prof Brian Ripley
It would help if we knew what that command was supposed to do.  My guess 
is that you want the Tr$size with the smallest value of Tr$dev, in which 
case

Tr$size[which.min(Tr$dev)]

would seem to do it.  However, there are details like what is to happen if 
there are ties for the smallest value.

(There are simpler ways in S-PLUS to sort one variable by the values of 
another, for example Tr$size[sort.list(Tr$dev)] which works the same way 
as in R.)

On Mon, 5 Nov 2007, [EMAIL PROTECTED] wrote:

> Dear all
> I have a small routine in S-Plus that I would like to use in R.  There are 
> some small changes I've been able to adapt, but I don't know how to translate 
> the line starting with "g1<-sort.col" and the one "Size<- c(Size...")  (I 
> also add some lines before)
> (...)
> Size<-NULL
> g<-cbind(Tr$dev,Tr$size)
> (...)
> g<-data.frame(g)
>
> # these next two lines are the ones I need help for
>
> g1 <- sort.col(target=g, columns.to.sort="@ALL", columns.to 
> sort.by=list("g.1"), ascending=T)
> Size<-c(Size,g1[1,2])
>
> Thanks in advance
> Bernat
>
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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

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


[R] question about running out of memory on R

2007-11-05 Thread Johan Jackson
Hi all,

R newbie, but have been reading the boards and learning lots. I have
read all documents & list-serve responses I could about R and memory
but still no answer.

QUESTION:

When the sizes of your objects exceeds your available RAM, R switches
to Virtual Memory right? If so, why does it so often run out of memory
and return an "unable to allocate XXX KB" error shortly after
switching to virtual memory when there is PLENTY of virtual memory to
be had (I think)?

I have noticed this on both my mac and my pc, so it doesn't seem to be
OS specific.

Any help in understanding this would be most appreciated!


 - J Jackson

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

2007-11-05 Thread Ben Bolker



Josh Kalish wrote:
> 
> Hi,
> 
>  
> 
> Has anyone used R to send out an email via an SMTP server?  I run R from a
> script and would like to be able to send out an email from there also.  I
> could shell out to an email program, but was hoping maybe someone had a
> package for R or a smooth way to do it.
> 
>  
> 

  I have a solution that seems to be 'better' (at least more self-contained)
than the blat solution ...  I've posted code at
http://www.zoo.ufl.edu/bolker/Rmail.R

  I'm not sure about security issues -- it does allow a password to be sent,
but I don't think it does anything with TLS/SSL etc -- at some point it
stops making
sense to keep re-inventing the wheel and interfacing to an outside package
makes more sense

  Ben

-- 
View this message in context: 
http://www.nabble.com/Sending-E-Mail-from-R-tf4749238.html#a13596138
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 translating S-Plus command

2007-11-05 Thread bernat
Dear all
I have a small routine in S-Plus that I would like to use in R.  There are some 
small changes I've been able to adapt, but I don't know how to translate the 
line starting with "g1<-sort.col" and the one "Size<- c(Size...")  (I also 
add some lines before)
(...)
Size<-NULL
g<-cbind(Tr$dev,Tr$size)
(...)
g<-data.frame(g)

# these next two lines are the ones I need help for

g1 <- sort.col(target=g, columns.to.sort="@ALL", columns.to 
sort.by=list("g.1"), ascending=T)
Size<-c(Size,g1[1,2])

Thanks in advance
Bernat


[[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] its does not recognize POSIXct w/ both time and Date?

2007-11-05 Thread Gabor Grothendieck
On Nov 5, 2007 3:50 PM, B. Bogart <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I'm getting much further with my time-series work, but still getting
> into some problems.
>
> I'm using POSIXct time format with both date and time.
>
> I'd like to use that in an its object but It seems its only processes
> the date part of the POSIX time stamps:
>
> BMU_its_data <-  its(data[BMUindex,2-4],dates=data[BMUindex,1])
> Error in `row.names<-.data.frame`(`*tmp*`, value = c("2007-10-31",
> "2007-10-31",  :
>
>
> The first column of the data is certainly correct, with both date and time:
>
>  > summary(data[BMUindex,1])
> Min.   1st Qu.
> Median
> "2007-10-31 07:00:00 UTC" "2007-11-01 07:00:00 UTC" "2007-11-03 07:00:00
> UTC"
> Mean   3rd Qu.
> Max.
> "2007-11-02 21:44:12 UTC" "2007-11-04 07:00:00 UTC" "2007-11-05 08:00:00
> UTC"
>
> Perhaps the functions used in its are unable to see the time field. I
> noticed that using unique() on the same data gives me only 6 different
> values, one for each day, with the times ignored.
>
> Is there any time format I can use in R (through its or zoo or fCalendar
> or anything) that allows me to use tools such as unique() and so on and
> have the times (not only dates) considered?
>
> I've chosen its because it seems to have pretty good ts specific
> plotting stuff in there, but I'd be willing to use anything that allows
> me to work with my POSIX dates down to the second. (or even msec)
>

Please provide reproducible examples as asked in last line on every
message to r-help.

Its unlikely that 'its' ignores date fields but perhaps this will get
you going.
Each of these gives the first value and its time for each value that occurs
in the series:

> # its
> library(its)
> ii <- its(rep(1:2, 5), Sys.time() + 1:10)
> ii[!duplicated(ii)]
An object of class "its"
 1
20071105 1
20071105 2
Slot "dates":
[1] "2007-11-05 16:03:09 Eastern Standard Time"
[2] "2007-11-05 16:03:10 Eastern Standard Time"

> # zoo
> library(zoo)
> z <- zoo(rep(1:2, 5), Sys.time() + 1:10)
> z[!duplicated(z)]
2007-11-05 16:03:10 2007-11-05 16:03:11
  1   2

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


Re: [R] Implementing R through Oracle

2007-11-05 Thread elw


> I have looked through all the ROracle documentation, R-help, R-dev, 
> Googled the world and still cannot figure out this issue. Everything I 
> read it is about connecting to an Oracle database and pulling data, 
> processing it, and then pushing it back to Oracle. I am running in 
> pl/sql code so I already have a Oracle session open. What I want to do 
> is from Oracle call R. I am having a mental challenge in seeing how this 
> can be done. Any words of wisdon?


EXTPROC in Oracle, calling an R CMD BATCH session?

Dirty but workable.

[p.s. I don't normally do Oracle but the stuff at

http://www.idevelopment.info/data/Oracle/DBA_tips/PL_SQL/PLSQL_1.shtml

shows basically how to do it...]


--elijah

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

2007-11-05 Thread Sandrine-et-Francois
Dear Irene,
May be I misunderstand your problem, but are you not describing here a 
classical hierarchical model ?
Do you know the book recently published, entitled 'Data Analysis Using 
Regression and Multilevel/Hierarchical Models', written by Gelman and Hill ?
I think the section 12 can provide an answer to your question.
Best regards
François


- Original Message - 
From: "Irene Mantzouni" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 04, 2007 10:48 PM
Subject: [R] hierarchical mixed model


>
> I would like to fit a 2-level mixed model:
>
> yit=a+a[i]+a[it] +(b+b[i]+b[it])*xit+eps[it]
>
> However, the variance of the second level components should depend on the 
> group, i.e. sigma for a[it] and b[it] should be [i] specific.
> I do not know whether this is conceptually right in the mixed model 
> context...
> In case it stands, how should the formula look like?
>
> Also, the data are unbalanced with different number of observations t 
> nested in each i group and I get the warning when trying to fit the model 
> in the traditional way.
> How much should I worry about this?
>
> Thank you!
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

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


Re: [R] Implementing R through Oracle

2007-11-05 Thread Jeffrey Horner
jah wrote on 11/05/2007 02:41 PM:
> I have looked through all the ROracle documentation, R-help, R-dev, Googled
> the world and still cannot figure out this issue. Everything I read it is
> about connecting to an Oracle database and pulling data, processing it, and
> then pushing it back to Oracle. I am running in pl/sql code so I already
> have a Oracle session open. What I want to do is from Oracle call R. I am
> having a mental challenge in seeing how this can be done. Any words of
> wisdon? 

I understand that one can write user defined functions for Oracle in 
java, so you might be able to bridge over to R via the rJava package. If 
you can write them in C, then you'll have the enviable task of embedding 
R into Oracle using the OCI, since no package exists. Now THAT would be 
a programming challenge.

Jeff
-- 
http://biostat.mc.vanderbilt.edu/JeffreyHorner

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


Re: [R] Implementing R through Oracle

2007-11-05 Thread Duncan Temple Lang
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


You might want to take a look at PL/R or REmbeddedPostgres
(the former being a reimplementation of the latter).
AFAIK, nobody has done this for Oracle, but we did do it
as an experiment for MySQL and Postgres and so the ideas are
there but there will be some work involved in implementing it.

 D.


jah wrote:
> I have looked through all the ROracle documentation, R-help, R-dev, Googled
> the world and still cannot figure out this issue. Everything I read it is
> about connecting to an Oracle database and pulling data, processing it, and
> then pushing it back to Oracle. I am running in pl/sql code so I already
> have a Oracle session open. What I want to do is from Oracle call R. I am
> having a mental challenge in seeing how this can be done. Any words of
> wisdon? 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHL4T29p/Jzwa2QP4RAsVlAJwNttd3NTGkFqVchC+lF48jfkHWvgCeOYak
yqPvEdwhnZVMV0AYNUmc3a4=
=8/Q7
-END PGP SIGNATURE-

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


Re: [R] its does not recognize POSIXct w/ both time and Date?

2007-11-05 Thread Armstrong, Whit
can you please give an example that I can cut from your email and run on
my machine?
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of B. Bogart
> Sent: Monday, November 05, 2007 3:51 PM
> To: r-help@r-project.org
> Subject: [R] its does not recognize POSIXct w/ both time and Date?
> 
> Hello all,
> 
> I'm getting much further with my time-series work, but still 
> getting into some problems.
> 
> I'm using POSIXct time format with both date and time.
> 
> I'd like to use that in an its object but It seems its only 
> processes the date part of the POSIX time stamps:
> 
> BMU_its_data <-  its(data[BMUindex,2-4],dates=data[BMUindex,1])
> Error in `row.names<-.data.frame`(`*tmp*`, value = 
> c("2007-10-31", "2007-10-31",  :
> 
> 
> The first column of the data is certainly correct, with both 
> date and time:
> 
>  > summary(data[BMUindex,1])
>  Min.   1st Qu.   
>  
> Median
> "2007-10-31 07:00:00 UTC" "2007-11-01 07:00:00 UTC" 
> "2007-11-03 07:00:00 
> UTC"
>  Mean   3rd Qu.   
>
> Max.
> "2007-11-02 21:44:12 UTC" "2007-11-04 07:00:00 UTC" 
> "2007-11-05 08:00:00 
> UTC"
> 
> Perhaps the functions used in its are unable to see the time field. I 
> noticed that using unique() on the same data gives me only 6 
> different 
> values, one for each day, with the times ignored.
> 
> Is there any time format I can use in R (through its or zoo 
> or fCalendar 
> or anything) that allows me to use tools such as unique() and 
> so on and 
> have the times (not only dates) considered?
> 
> I've chosen its because it seems to have pretty good ts specific 
> plotting stuff in there, but I'd be willing to use anything 
> that allows 
> me to work with my POSIX dates down to the second. (or even msec)
> 
> Thanks.
> B. Bogart
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 




This e-mail message is intended only for the named recipient(s) above. It may 
contain confidential information. If you are not the intended recipient you are 
hereby notified that any dissemination, distribution or copying of this e-mail 
and any attachment(s) is strictly prohibited. If you have received this e-mail 
in error, please immediately notify the sender by replying to this e-mail and 
delete the message and any attachment(s) from your system. Thank you.

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


[R] its does not recognize POSIXct w/ both time and Date?

2007-11-05 Thread B. Bogart
Hello all,

I'm getting much further with my time-series work, but still getting 
into some problems.

I'm using POSIXct time format with both date and time.

I'd like to use that in an its object but It seems its only processes 
the date part of the POSIX time stamps:

BMU_its_data <-  its(data[BMUindex,2-4],dates=data[BMUindex,1])
Error in `row.names<-.data.frame`(`*tmp*`, value = c("2007-10-31", 
"2007-10-31",  :


The first column of the data is certainly correct, with both date and time:

 > summary(data[BMUindex,1])
 Min.   1st Qu.
Median
"2007-10-31 07:00:00 UTC" "2007-11-01 07:00:00 UTC" "2007-11-03 07:00:00 
UTC"
 Mean   3rd Qu.  
Max.
"2007-11-02 21:44:12 UTC" "2007-11-04 07:00:00 UTC" "2007-11-05 08:00:00 
UTC"

Perhaps the functions used in its are unable to see the time field. I 
noticed that using unique() on the same data gives me only 6 different 
values, one for each day, with the times ignored.

Is there any time format I can use in R (through its or zoo or fCalendar 
or anything) that allows me to use tools such as unique() and so on and 
have the times (not only dates) considered?

I've chosen its because it seems to have pretty good ts specific 
plotting stuff in there, but I'd be willing to use anything that allows 
me to work with my POSIX dates down to the second. (or even msec)

Thanks.
B. Bogart

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


Re: [R] Implementing R through Oracle

2007-11-05 Thread jah

I have looked through all the ROracle documentation, R-help, R-dev, Googled
the world and still cannot figure out this issue. Everything I read it is
about connecting to an Oracle database and pulling data, processing it, and
then pushing it back to Oracle. I am running in pl/sql code so I already
have a Oracle session open. What I want to do is from Oracle call R. I am
having a mental challenge in seeing how this can be done. Any words of
wisdon? 
-- 
View this message in context: 
http://www.nabble.com/Implementing-R-through-Oracle-tf4719929.html#a13595057
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] R on OS X Leopard?

2007-11-05 Thread Thomas Adams
Benson,

Apparently it's a break with the installer for Leopard. See this:

"Refer to R Mac SIG list, the mpkg installer in 2.6 binary is broken in Leopard.
Until an updated version is release, you can install R by install each
package in "Packages" folder one by one.
Hope it helps."

https://stat.ethz.ch/pipermail/r-sig-mac/2007-October/004203.html

Regards,
Tom

[EMAIL PROTECTED] wrote:
> Hi,
>
> I've been using R on my OS X machine this school year, and have been
> really enjoying it.  I recently formatted my machine and installed OS X
> Leopard.  When I try to install the OS X R package on Leopard, R's
> installer tells me I have the wrong version of R for my version of OS X.
> I downloaded the most recent version, and looked for a Leopard-specific
> one, but haven't found one.  Is there a workaround for this, or a patch
> in the works?  
>
> Thanks much,
> Benson
>   
> 
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>   


-- 
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

EMAIL:  [EMAIL PROTECTED]

VOICE:  937-383-0528
FAX:937-383-0033

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Identify() : How to set the offset , or a reference

2007-11-05 Thread Greg Snow
You need to supply both x and y to the identify function.  The suprising
thing is that the first call worked.

So try:

> plot(F$x,F$y)
> I=identify(F$x,F$y)
> Fnew=F[I[1]:I[2],]
> plot(Fnew$x,Fnew$y)
> I=identify(Fnew$x,Fnew$y)

Hope this helps,

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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of allergen
> Sent: Monday, November 05, 2007 5:50 AM
> To: r-help@r-project.org
> Subject: [R] Identify() : How to set the offset , or a reference
> 
> 
> Hello,
> 
> I try to make several zoom in chosen region. 
> So i use identify to indicate in which area to zoom.
> i want o make it several time.
> But once I zoom one time, the identify fonction gives bad results.
> 
> There is a short example, when i try to identify in Fnew  it 
> sems that there is an offset , or a bad reference. 
> So the given result is "No point in 0,25inch"
> 
> thanks
> 
> 
> F=read.table.
> >
> xy
> 1   3
> 2   5
> 
> 3999   8
> 4000   9
> 
> plot(F$x,F$y)
> I=identify(F$x)
> Fnew=F[I[1]:I[2],]
> >Fnew
> x  y
> 2000  5
> ...
> 3000  9
> 
> plot(Fnew$x,Fnew$y)
> I=identify(Fnew$x)
> 
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://www.nabble.com/Identify%28%29--%3A-How-to-set-the-offse
> t-%2C-or-a-reference-tf4751411.html#a13586185
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

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


Re: [R] xtable.by

2007-11-05 Thread Richard M. Heiberger
## I would use latex() for this example.

library(Hmisc)
team.dat <- '
GK Paul Robinson
LB Lucus Radebe
DC Michael Duberry
DC Dominic Matteo
RB Didier Domi
MC David Natty
MC Eirik Bakke
MC Jody Morris
FW Jamie Mcmaster
ST Alan Smith
ST Mark Viduka
'

team <- read.table(textConnection(team.dat),
   col.names=c("position", "first", "last"))
team$name <- paste(team$first, team$last)
team <- team[c("position","name")]
team 
team.latex <-
  latex(team,
rowlabel="",
rowname="",
 
rgroup=c("Goalkeeper","Defenders","Midfielders","Forward","Strikers"),
n.rgroup=c(1,4,3,1,2))


## The file named in print.default(team.latex) has the complete tabular
## environment for the example.  There are many more arguments for fine
tuning the
## appearance of the table.


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of A Friedman
Sent: Monday, November 05, 2007 11:32 AM
To: r-help@r-project.org
Subject: [R] xtable.by

http://www.andy-roberts.net/misc/latex/tutorial4/multirow.png

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

2007-11-05 Thread Gabor Grothendieck
If you look at the latex output associated with the page you
posted you need to:

- eliminated all repeated elements in column 1
- replace each non-repeated element, say X, which spans 3 rows, say, to
  \hline\multirow{3}{*}{X}
- add an \hline after the last row

Using the first 10 rows of the builtin Orange data frame try the
following.  Adjust align= appropriately for your case.

DF <- head(Orange, 10)
DF[[1]] <- as.character(DF[[1]])

rle.lengths <- rle(DF[[1]])$lengths
first <- !duplicated(DF[[1]])

DF[[1]][!first] <- ""
DF[[1]][first] <-
   paste("\\hline\\multirow{", rle.lengths, "}{*}{", DF[[1]][first], "}")

print(xtable(DF, align = "l|r|r|r|"),
   include.rownames = FALSE, include.colnames = FALSE,
   sanitize.text.function = force,
   hline.after = nrow(DF)
   )


On Nov 5, 2007 11:31 AM, A Friedman <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>  I have a series of measurements made over different types of road surfaces
> and capacity that I want to summarize in tables via LaTeX.  Ideally I'd like
> a table similar to this (
> http://www.andy-roberts.net/misc/latex/tutorial4/multirow.png ) with mean/SD
> of the measurement broken down by road type (both surface and capacity).
> Ideally it would be extensible so that when I add layers of heirarchy on top
> the complexity does not increase exponentially (e.g. measurement by road
> surface/capacity by month by neighborhood), but rather take those additional
> levels as arguments.
>
> xtable() is a wonderful thing, but it seems to lack a method for displaying
> the results broken down by a factor as in the table above.  One can easily
> write code to add lines between the segments, but then the levels are
> repeated for each row.  Has anyone written a method for xtable() to handle
> this (assuming not, otherwise it'd be in the package)?  Is there any way to
> pass a \multirow call to xtable() (assuming not, otherwise it'd be in the
> documentation)?
>
> If the answers to both of the above are "no," then can someone give me a
> pointer to a basic but thorough explanation of how generic functions and
> methods are structured (S3, I believe), preferably online.  I tried doing
> this via getS3method("xtable","data.frame") and working from there, but the
> method merely sets up things for the generic function to render (it's likely
> I'm getting my terminology somewhat wrong here; please forgive) and what I
> want to do is beyond the bounds of modifying it in this way.  I've looked
> through _Writing R Extensions_, but the Generic Functions and Methods
> chapter is only about a page long.
>
> Thanks on behalf of all the lurkers.  I've learned much just by reading the
> daily digests over the last few weeks.
> Ari
>
> Ari Friedman
> [EMAIL PROTECTED]
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Fw: Creating a barplot--advice needed

2007-11-05 Thread Rolf Turner

On 4/11/2007, at 1:15 PM, Thomas L Jones, PhD wrote:

>
>
> Subject: Creating a barplot--advice needed
>
>
>> Advice needed: I am preparing a computer program to do a barchart.  
>> Advice
>> needed: Should I learn the lattice package, or try to? As a
>> non-statistician, much of the terminology is unfamiliar to me.  
>> "grouping
>> variable," "object of class trellis," etc. Or, is there a more easily
>> learned way to do it? It is a simple, vanilla-flavored barplot.  
>> Each of
>> the bars has the same width. I knos how to create the barplot using a
>> speadsheet program (MS Excel or equivalent), but I do not know how  
>> to put
>> the barplot on  top of a R graphics windows. I have a PhD in Computer
>> Science, but am no statistician.


What (on earth!) do you mean by ``put the barplot on top of an
R graphics window''?

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

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


Re: [R] Help with cochran.test

2007-11-05 Thread Peter Dalgaard
Stephanie Bernard wrote:
> Hi,
> I have been trying to use the function cochran.test from the Outliers 
> package to test for homogeneity of variance. This works well except when 
> I use transformed data. Would anyone have an idea why it doesn't work 
> and how I could do the cochran test on transformed data?
>   
Sounds like the code has a buglet in the handling of nontrivial left
hand sides. Report to the package maintainer.
> Thanks,
> Stephanie
>
>  >library(outliers)
>  > set.seed(1234)
>  > x=rnorm(100)
>  > d=data.frame(x=x,group=rep(1:10,10))
>  > cochran.test(x~group,d)
>
> Cochran test for outlying variance
>
> data:  x ~ group
> C = 0.1619, df = 10, k = 10, p-value = 0.935
> alternative hypothesis: Group 10 has outlying variance
> sample estimates:
> 1 2 3 4 5 6 
> 7 8 910
> 0.9702567 1.0762180 0.9489474 0.9098832 1.1665495 0.9753678 1.2960769 
> 0.8036918 0.7193931 1.7127172
>
>  > cochran.test(log(x)~group,d)
> Error in tapply(data[[bn[1]]], by.factor, var) :
> arguments must have same length
>   
The straightforward workaround would seem to be

d2 <- transform(d, logx=log(x))
cochran.test(logx~group, d2)

or (maybe)

with(d, {logx <- log(x); cochran.test(logx~group)})



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

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


[R] Help with cochran.test

2007-11-05 Thread Stephanie Bernard
Hi,
I have been trying to use the function cochran.test from the Outliers 
package to test for homogeneity of variance. This works well except when 
I use transformed data. Would anyone have an idea why it doesn't work 
and how I could do the cochran test on transformed data?
Thanks,
Stephanie

 >library(outliers)
 > set.seed(1234)
 > x=rnorm(100)
 > d=data.frame(x=x,group=rep(1:10,10))
 > cochran.test(x~group,d)

Cochran test for outlying variance

data:  x ~ group
C = 0.1619, df = 10, k = 10, p-value = 0.935
alternative hypothesis: Group 10 has outlying variance
sample estimates:
1 2 3 4 5 6 
7 8 910
0.9702567 1.0762180 0.9489474 0.9098832 1.1665495 0.9753678 1.2960769 
0.8036918 0.7193931 1.7127172

 > cochran.test(log(x)~group,d)
Error in tapply(data[[bn[1]]], by.factor, var) :
arguments must have same length

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

2007-11-05 Thread Bernardo Rangel Tura

On Mon, 2007-11-05 at 17:50 +0100, Duccio - wrote:
> I would like to fit a power model of type:
> y=b*x(^z)
> to my data (having y as the response and x as the predictor variables).
> I could not use linear models like y~x since R should estimate the parameter
> z and not only the coefficient b.
> Thus I need a package and a function! Any suggestions?
> Thanks
> Duccio

Ducio

I think two solutions:

1- log(y)=log(b*x^z)=log(b)+z*log(x)
In this case lm(log(y)~log(x) ) solve your problem

2- use nls
nls(y~b*x^z,start = list(b = 0, z = 1),data=your database)


-- 
Bernardo Rangel Tura, M.D,Ph.D
National Institute of Cardiology
Brazil

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] add histograms or distributions on regression line

2007-11-05 Thread Greg Snow
Here are a couple of options that may get you started:

library(TeachingDemos)

plot(1:10, 1:10, type='n')
abline(0,1)

rhist <- function(x){
tmp <- hist(x, plot=FALSE)
barplot(tmp$counts, horiz=TRUE, axes=FALSE, space=0)
}

subplot( rhist(rnorm(100)), 2,2, hadj=0 )
subplot( rhist(rnorm(100)), 5,5, hadj=0 )
subplot( rhist(rnorm(100)), 7,7, hadj=0 )

y <- seq(-3,3, len=100)
x <- dnorm(y)
x <- x/(max(x))
ms.norm <- cbind(x,y)

plot(1:10,1:10, type='n')
abline(0,1)

my.symbols( 1:10, 1:10, ms.norm, inches=0.3 )

plot(1:10,1:10, type='n')
abline(0,1)

my.symbols( 1:10, 1:10, ms.norm, inches=seq(.2,.5,len=10) )



Hope this helps,

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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Chang jun xiang
> Sent: Friday, November 02, 2007 8:09 AM
> To: r-help@r-project.org
> Subject: [R] add histograms or distributions on regression line
> 
> hello, does anyone know how to add histograms or 
> distributions on regression like just like quantiles 
> regression in RGraphGallery below, a very delicate codes. Thanks alot.
> 
> http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=109
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] R on OS X Leopard?

2007-11-05 Thread bensonk
Hi,

I've been using R on my OS X machine this school year, and have been
really enjoying it.  I recently formatted my machine and installed OS X
Leopard.  When I try to install the OS X R package on Leopard, R's
installer tells me I have the wrong version of R for my version of OS X.
I downloaded the most recent version, and looked for a Leopard-specific
one, but haven't found one.  Is there a workaround for this, or a patch
in the works?  

Thanks much,
Benson


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


Re: [R] Print list structure

2007-11-05 Thread Duncan Murdoch
On 11/5/2007 12:01 PM, Martin Morgan wrote:
> Hi Antje,
> 
> I know you have a solution, but
> 
>> l <- list(list(L=1,list(L=2)))
>> f <- function() { i=1; function(...) {cat("level", i, ":", ...); i<<-i+1 }}
>> r=rapply(l, f(), "..."="\n")
> level 1 : 1 
> level 2 : 2 
> 
> lets you use R scoping rules and a relatively new addition to the
> 'apply' family of functions. It also points to a bit of awkwardness in
> the signature for rapply (maybe it would have been more consistent
> with rapply(X, FUN, ..., classes="ANY", etc)

That doesn't work in the sense that "level" doesn't report on the 
recursion level.  For example,

 > l <- list(list(L=1,list(L=2), M=3))
 > str(l)
List of 1
  $ :List of 3
   ..$ L: num 1
   ..$  :List of 1
   .. ..$ L: num 2
   ..$ M: num 3

 > f <- function() { i=1; function(...) {cat("level", i, ":", ...); 
i<<-i+1 }}
 > r=rapply(l, f(), "..."="\n")
level 1 : 1
level 2 : 2
level 3 : 3

The i variable ends up being a simple counter, it doesn't get reset when 
you go back up a level.  I don't know how to make rapply do what we want 
here.

Duncan Murdoch


> 
> Martin
> 
> Duncan Murdoch <[EMAIL PROTECTED]> writes:
> 
>> On 11/5/2007 8:34 AM, Antje wrote:
>>> Hello again,
>>> 
>>> I was wondering whether there is a command with which I can print the 
>>> structure 
>>> of a list, containing list of list of ...
>>> If you have any hint let me know...
>>
>> str() can print the structure of any R object.
>>
>> Duncan Murdoch
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] order a matrix

2007-11-05 Thread Christian Hennig
That solved it!

Thank you very much!

On Mon, 5 Nov 2007, Prof Brian Ripley wrote:

> On Mon, 5 Nov 2007, Christian Hennig wrote:
>
>> Dear list,
>> 
>> order(x,y,z) returns a permutation to order x, ties broken by y, remaining
>> ties broken by z. (And so on.)
>> 
>> What I'd like to do is
>> order(X), where X is a matrix (or a list or data frame if necessary) of
>> unspecified size, which orders X[,1], ties broken by X[,2], remaining ties
>> broken by X[,3] and so on - without having to know and to write down how
>> many columns  X has.
>> 
>> Any ideas how to achieve that?
>
> For a list or data frame, do.call("order", X).
> For a matrix, do.call("order", split(A, col(A))).
>
> -- 
> Brian D. Ripley,  [EMAIL PROTECTED]
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel:  +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UKFax:  +44 1865 272595
>

*** --- ***
Christian Hennig
University College London, Department of Statistical Science
Gower St., London WC1E 6BT, phone +44 207 679 1698
[EMAIL PROTECTED], www.homepages.ucl.ac.uk/~ucakche

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] ploting a comparison of two scores, including the labels in the plot

2007-11-05 Thread Greg Snow
Does the following do what you want (or at least start you in the correct 
direction)?

mydata <- data.frame( job=c("Ambassadör","Läkare","Domare",  
"Professor","Advokat","Pilot","Verkställande direktör","Forskare",
"Civilingenjör","Statsråd"), SAMHM= c(8.32, 8.15, 8.14, 8.13, 7.95,
 7.81, 7.78, 7.60, 7.47, 7.41),INDM= c( 7.2771, 8.1029, 7.5965,
 7.5618, 7.1876, 7.4380, 6.8361, 7.6630, 6.8802, 6.3916))

 
tmp <- c(rbind( mydata$SAMHM, mydata$INDM, NA ))
tmp2 <- rep( c(1,2,NA), nrow(mydata) )

plot(tmp2, tmp, type='b', xlim=c(0,3), xlab='', ylab='rating')
text(0.9, mydata$SAMHM, mydata$job, adj=1, cex=0.75)
text(2.1, mydata$INDM, mydata$job, adj=0, cex=0.75)




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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Hans Ekbrand
> Sent: Thursday, November 01, 2007 7:13 AM
> To: r-help@r-project.org
> Subject: [R] ploting a comparison of two scores,including the 
> labels in the plot
> 
> Hello r-help!
> 
> I have data with two kind of ratings on status of 100 
> occupations. The first kind of rating is on the percieved 
> "objective" status that these occupations have in society at 
> large, and the second kind or rating is on the status that 
> the respondents think that these occuption *should* have.
> 
> The ratings were originally integer values in the rage 1-9, 
> but in the current data, I use their mean values.
> 
> Here is an printout for the first 10 occupations: (the 
> occupation names are in swedish)
> 
> > data.frame(myobj[1:10, c("YRKE", "SAMHM", "INDM")], row.names = 
> > "YRKE")
>   SAMHM   INDM
> Ambassadör 8.32 7.2771
> Läkare ("doctor")  8.15 8.1029
> Domare ("judge")   8.14 7.5965
> Professor  8.13 7.5618
> Advokat ("lawyer") 7.95 7.1876
> Pilot  7.81 7.4380
> Verkställande direktör 7.78 6.8361
> Forskare ("scientist"  7.60 7.6630
> Civilingenjör ("engineer") 7.47 6.8802
> Statsråd ("minister")  7.41 6.3916
> > 
> 
> I would like to make a plot with two lists. The first list 
> should list the occupations ordered by "SAMHM" (as in the 
> printout above) and the values of SAMH. The linespacing in 
> this list should be increased by the difference in SAMH 
> between the the occupations (i.e. between "Ambassadör" and 
> "Läkare" (eng. "doctor") there should be a larger 
> linespaceing than between "Läkare" and "Domare" (eng. "judge")).
> 
> The second list should be like the first, but based on "INDM" 
> instead of "SAMH".
> 
> These two list should ideally be plotted side by side with 
> lines connecting each occuption.
> 
> Here is an ascii-art illustration of what I intend (excluding 
> the connecting lines, which are hard to draw with ascii :-)
> 
> --
> Ambassadör 
> 
> Läkare ("doctor")  
> Domare ("judge")
> Professor  Läkare
> 
> Advokat ("lawyer") 
> 
> Pilot 
> Verkställande direktör 
> 
> Forskare ("scientist") Forskare
>Domare
> Civilingenjör ("engineer") Professor
> Statsråd ("minister")  Pilot
>Ambassadör
>Advokat
> 
> 
>Civilingenjör
>Verkställande direktör
> 
> 
>Statsråd
> --
> 
> If printing strings (labels) with different linespacing turns 
> out to be problematic, another solution would be to print a 
> list of the occupations ordered by "SAMH", points of "SAMH" 
> values (with Y="SAMH"), points of "INDM" (with Y="INDM") and 
> a list of occupations ordered by "INDM", with a line for each 
> occupation connecting the labels with the points and the two 
> points that represents the occupation.
> 
> Since there are a lot of functions for ploting and I am new 
> to R, I would like advise on what packages/functions that 
> should be used to get what I want (if what I want is possible 
> to achieve with R, if it is not, then please let me know).
> 
> Sample code is, of course, also very much appreciated.
> 
> kind regards,
> 
> --
> Hans Ekbrand (http://sociologi.cjb.net) 
> <[EMAIL PROTECTED]> A. Because it breaks the logical 
> sequence of discussion Q. Why is top posting bad?
> 

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

2007-11-05 Thread Charles C. Berry



See

?ftable

and do

RSiteSearch("latex ftable")

to find some posts relevant to what you need.


Chuck

On Mon, 5 Nov 2007, A Friedman wrote:

> Hi all,
>
>  I have a series of measurements made over different types of road surfaces
> and capacity that I want to summarize in tables via LaTeX.  Ideally I'd like
> a table similar to this (
> http://www.andy-roberts.net/misc/latex/tutorial4/multirow.png ) with mean/SD
> of the measurement broken down by road type (both surface and capacity).
> Ideally it would be extensible so that when I add layers of heirarchy on top
> the complexity does not increase exponentially (e.g. measurement by road
> surface/capacity by month by neighborhood), but rather take those additional
> levels as arguments.
>
> xtable() is a wonderful thing, but it seems to lack a method for displaying
> the results broken down by a factor as in the table above.  One can easily
> write code to add lines between the segments, but then the levels are
> repeated for each row.  Has anyone written a method for xtable() to handle
> this (assuming not, otherwise it'd be in the package)?  Is there any way to
> pass a \multirow call to xtable() (assuming not, otherwise it'd be in the
> documentation)?
>
> If the answers to both of the above are "no," then can someone give me a
> pointer to a basic but thorough explanation of how generic functions and
> methods are structured (S3, I believe), preferably online.  I tried doing
> this via getS3method("xtable","data.frame") and working from there, but the
> method merely sets up things for the generic function to render (it's likely
> I'm getting my terminology somewhat wrong here; please forgive) and what I
> want to do is beyond the bounds of modifying it in this way.  I've looked
> through _Writing R Extensions_, but the Generic Functions and Methods
> chapter is only about a page long.
>
> Thanks on behalf of all the lurkers.  I've learned much just by reading the
> daily digests over the last few weeks.
> Ari
>
> Ari Friedman
> [EMAIL PROTECTED]
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

Charles C. Berry(858) 534-2098
 Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

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


Re: [R] order a matrix

2007-11-05 Thread Prof Brian Ripley
On Mon, 5 Nov 2007, Christian Hennig wrote:

> Dear list,
>
> order(x,y,z) returns a permutation to order x, ties broken by y, remaining
> ties broken by z. (And so on.)
>
> What I'd like to do is
> order(X), where X is a matrix (or a list or data frame if necessary) of
> unspecified size, which orders X[,1], ties broken by X[,2], remaining ties
> broken by X[,3] and so on - without having to know and to write down how
> many columns  X has.
>
> Any ideas how to achieve that?

For a list or data frame, do.call("order", X).
For a matrix, do.call("order", split(A, col(A))).

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

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


[R] Heat map with PNGs instead of numbers on axis?

2007-11-05 Thread Karen.Green
Dear R Community,
 
I am trying to create a heat map where, instead of normal text labels, I
will use small PNG images.
 
(I know there is a function "heatmap" in the stats package (and also a
heatmap.plus package), but it is unclear how to modify it to accomplish
the task.)
 
Would anyone have any advice on how to implement this?
 
I am wondering if I need to re-write the functionality to accomplish
this or if I can merely make a small modification to what is already
there.
 
Thank you for your help,
 
Karen
---

 Karen M. Green, Ph.D.

 [EMAIL PROTECTED]

 Research Investigator

 Drug Design Group

 Sanofi Aventis Pharmaceuticals

 Tucson, AZ  85737-9525


[[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] OT: Best applied MCMC textbooks?

2007-11-05 Thread Gregory. R. Warnes

Hi All,

I'm preparing to co-teach a class on applied MCMC using R as the  
computational engine in the spring.  As a consequence, I'm starting  
to look at MCMC textbooks.   Please send along your recommendations!

I will collate the responses and post a summary, so please reply to  
me directly.

Thanks,

-G

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


[R] vector graphics/ SVG plots via RSvgDevice

2007-11-05 Thread Sam McClatchie
System:
Linux Ubuntu 7.10 Gibbon
kernel  2.6.22-14-generic
Emacs ver. 22.1.1
ESS ver. 5.3.0
R version 2.6.0 (2007-10-03)


Colleagues

This is a follow-up note to my earlier post under this header, giving my
solution.

First, with some trepidation I upgraded my ubuntu distro, and this time
did a full reinstall, so I did not break my system, as I have done in
the past.

Then I tried to get the contributed package Cairo to work, but still had
issues with libraries that I failed to fix. However, the upgrade had
other advantages. Thanks for the push, Brian.

I went back to RSvgDevice and produced nice SVG plots that imported into
Inkscape and could be edited to meet all the fussy journal requirements
for my figures. However, both the Inkscape and the plain SVG files did
not display properly on conversion from LyX to DVI or PDF, although they
look fine in LyX. My work around is to export a bitmap from Inkscape and
use this in LyX. Export creates a PNG file, and an advantage here is
that the graphics file size reduced from  2.1 MB for the SVG file to 320
KB for the PNG file.  This is good where the journal wants your graphics
files separately and may not be  able to deal with SVG files, or very
large files.

I have one caveat. It seems to me that RSvgDevice had problems writing
to file when the data were unreasonably voluminous. I produced another
graphic using bathymetry and coastlines recommended in the PBSmapping
package. These files are high resolution and large (85 and 64 MB
respectively). The plot took too long and the resulting SVG could not be
loaded by Inkscape, nor converted to EPS using Image Magick (suggesting
failure somewhere?).  I'm not criticizing the packages here, just making
an observation. I can either create smaller bathymetry and coastline
files, or use the big linux beast downstairs.

Best fishes

Sam

-- 
Sam McClatchie (Fisheries oceanographer, SWFSC, NOAA)
& Elena Turin (Internal controls accountant, UCSD)
work: SWFSC, 8604 La Jolla Shores Drive, La Jolla, CA 92037-1508, USA
home: 12723 Salmon River Rd, San Diego, CA 92129, USA
web: 
Sam's cell: 858 752 8495
Elena's cell: 858 752 8689
  /\
   >>
   /// \\\
   
 ///  <%)Xx><<
/  \\
  ><(((@>
><(((%>  ..>>O<<

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


[R] order a matrix

2007-11-05 Thread Christian Hennig
Dear list,

order(x,y,z) returns a permutation to order x, ties broken by y, remaining 
ties broken by z. (And so on.)

What I'd like to do is
order(X), where X is a matrix (or a list or data frame if necessary) of 
unspecified size, which orders X[,1], ties broken by X[,2], remaining ties 
broken by X[,3] and so on - without having to know and to write down how 
many columns  X has.

Any ideas how to achieve that?

Thanks,
Christian

*** --- ***
Christian Hennig
University College London, Department of Statistical Science
Gower St., London WC1E 6BT, phone +44 207 679 1698
[EMAIL PROTECTED], www.homepages.ucl.ac.uk/~ucakche

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

2007-11-05 Thread Martin Morgan
Hi Antje,

I know you have a solution, but

> l <- list(list(L=1,list(L=2)))
> f <- function() { i=1; function(...) {cat("level", i, ":", ...); i<<-i+1 }}
> r=rapply(l, f(), "..."="\n")
level 1 : 1 
level 2 : 2 

lets you use R scoping rules and a relatively new addition to the
'apply' family of functions. It also points to a bit of awkwardness in
the signature for rapply (maybe it would have been more consistent
with rapply(X, FUN, ..., classes="ANY", etc)

Martin

Duncan Murdoch <[EMAIL PROTECTED]> writes:

> On 11/5/2007 8:34 AM, Antje wrote:
>> Hello again,
>> 
>> I was wondering whether there is a command with which I can print the 
>> structure 
>> of a list, containing list of list of ...
>> If you have any hint let me know...
>
> str() can print the structure of any R object.
>
> Duncan Murdoch
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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

2007-11-05 Thread Duccio -
I would like to fit a power model of type:
y=b*x(^z)
to my data (having y as the response and x as the predictor variables).
I could not use linear models like y~x since R should estimate the parameter
z and not only the coefficient b.
Thus I need a package and a function! Any suggestions?
Thanks
Duccio

[[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] xtable.by

2007-11-05 Thread A Friedman
Hi all,

  I have a series of measurements made over different types of road surfaces
and capacity that I want to summarize in tables via LaTeX.  Ideally I'd like
a table similar to this (
http://www.andy-roberts.net/misc/latex/tutorial4/multirow.png ) with mean/SD
of the measurement broken down by road type (both surface and capacity).
Ideally it would be extensible so that when I add layers of heirarchy on top
the complexity does not increase exponentially (e.g. measurement by road
surface/capacity by month by neighborhood), but rather take those additional
levels as arguments.

xtable() is a wonderful thing, but it seems to lack a method for displaying
the results broken down by a factor as in the table above.  One can easily
write code to add lines between the segments, but then the levels are
repeated for each row.  Has anyone written a method for xtable() to handle
this (assuming not, otherwise it'd be in the package)?  Is there any way to
pass a \multirow call to xtable() (assuming not, otherwise it'd be in the
documentation)?

If the answers to both of the above are "no," then can someone give me a
pointer to a basic but thorough explanation of how generic functions and
methods are structured (S3, I believe), preferably online.  I tried doing
this via getS3method("xtable","data.frame") and working from there, but the
method merely sets up things for the generic function to render (it's likely
I'm getting my terminology somewhat wrong here; please forgive) and what I
want to do is beyond the bounds of modifying it in this way.  I've looked
through _Writing R Extensions_, but the Generic Functions and Methods
chapter is only about a page long.

Thanks on behalf of all the lurkers.  I've learned much just by reading the
daily digests over the last few weeks.
Ari

Ari Friedman
[EMAIL PROTECTED]

[[alternative HTML version deleted]]

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


[R] A question regarding two dimensional optimization with constraints

2007-11-05 Thread Saptarshi Guha
Hello,
I have an optimization problem which I would like to solve in R but  
am not sure how to approach this.
I have a cost function C which is quadratic in rx and ry (if it  
helps, the cost function is separable in rx and ry) and is always  
positive for all rx,ry.
I wish to maximize C subject to two convex constraints both of which  
are quadratic in rx and ry (if it helps, both are separable in rx and  
ry) and always positive.

I do realize that because the intersection of the two constraints is  
convex and the solutions lie on the boundary of the intersection and  
it is possible to arrive at the optima analytically.

However I would like a numerical approach via some optimization  
libraries in R.
Could someone suggest some pointers as to how i could go about   
solving this in R? Which libraries should I use?

Thank you for your time and help.
Regards
Saptarshi

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


Re: [R] subsetting problem with multiple criteria: Works in some but not all cases.

2007-11-05 Thread John Kane
Excellent, thank you .
--- jim holtman <[EMAIL PROTECTED]> wrote:

> You can use apropos to find then and then list out
> their help pages:
> 
> > apropos("%")
> [1] "%%"   "%*%"  "%/%"  "%in%" "%o%"  "%x%"
> 
> 
> On 11/2/07, John Kane <[EMAIL PROTECTED]> wrote:
> > Thank you Jim.  That seems to work perfectly.
> >
> > I had looked at %in% and apparently misunderstood
> what
> > it would do.  Is there any place where I can read
> on
> > the various %XX% functions?
> >
> > --- jim holtman <[EMAIL PROTECTED]> wrote:
> >
> > > I think the problem is with your use of "=="
> instead
> > > of "%in%"; try
> > >
> > > matching <- subset(mydata[,c(j+1,j+7)],
> mydata[,j+1]
> > > %in% lone.word)
> > >
> > >
> > >
> > > On 11/1/07, John Kane <[EMAIL PROTECTED]>
> wrote:
> > > > I am trying to compare some word lists which
> have
> > > an
> > > > associate set of numbers. I want to compare
> word
> > > list
> > > > aa with bb and find only those words which are
> > > > unique to bb, then compare bb with cc, etc.
> > > >
> > > > I thought that I should be able to do this by
> > > using
> > > > setdiff to get the unique words and then
> subset
> > > the
> > > > data frame to get the unique names and
> > > corresponding
> > > > numbers but I am misunderstanding something.
> > > >
> > > > When I run the code below a) I get lots of
> warning
> > > and
> > > > b) I get the correct results for 4 of the 5
> > > > comparisons. However the comparison of  three
> with
> > > > four (cc,dd) gives me an empty subset.
> > > >
> > > > Can anyone point out my error or suggest a
> better
> > > way
> > > > to do this?
> > > > Thanks
> > > >
> > > >
> > >
> >
>

> > > >
> > > > mydata  = data.frame(aa = Cs(cat, dog, horse,
> > > cow),
> > > > bb = c("mouse", "dog", "cow", "pigeon"),
> > > > cc  =c("emu", "rat", "crow", "cow"),
> > > > dd = c("cow", "camel", "manatee", "parrot") ,
> > > > ee = c( "coat", "hat", "dog", "camel") ,
> > > > ff = c("knife","dog", "cow", "pigeon"),
> > > > ann = c(1,2,3,4),
> > > > bnn = c(5,6,7,8),
> > > > cnn = c(9,10,11,12),
> > > > dnn = c(13,14,15,16),
> > > > enn = c(17,18,19,20),
> > > > fnn = c(21,22,23,24))
> > > >
> > > > wordnames <- c("word", "number")
> > > > word.list  <- rep(vector("list", 1), 5)
> > > >
> > > > for(j in 1:5) {
> > > > lone.word <- setdiff(mydata[,j+1],mydata[,j]);
> > > > lone.word
> > > > matching <- subset(mydata[,c(j+1,j+7)],
> > > > mydata[,j+1]==lone.word); matching
> > > > word.list[[j]] <- matching;
> > > names(word.list[[j]])<-
> > > > wordnames
> > > > }
> > > > word.list
> > > >
> > > >
> > >
> >
>
=
> > > > R version 2.6.0 (2007-10-03)
> > > > i386-pc-mingw32
> > > >
> > > > locale:
> > > >
> > >
> >
>
LC_COLLATE=English_Canada.1252;LC_CTYPE=English_Canada.1252;LC_MONETARY=English_Canada.1252;LC_NUMERIC=C;LC_TIME=English_Canada.1252
> > > >
> > > > attached base packages:
> > > > [1] stats graphics  grDevices utils
> > > datasets
> > > > methods   base
> > > >
> > > > other attached packages:
> > > > [1] Hmisc_3.4-2 gdata_2.3.1
> > > >
> > > > loaded via a namespace (and not attached):
> > > > [1] cluster_1.11.9 grid_2.6.0 gtools_2.4.0
> > > > lattice_0.17-1
> > > >
> > > >
> > > > R version 2.6.0 (2007-10-03)
> > > > i386-pc-mingw32
> > > >
> > > > locale:
> > > >
> > >
> >
>
LC_COLLATE=English_Canada.1252;LC_CTYPE=English_Canada.1252;LC_MONETARY=English_Canada.1252;LC_NUMERIC=C;LC_TIME=English_Canada.1252
> > > >
> > > > attached base packages:
> > > > [1] stats graphics  grDevices utils
> > > datasets
> > > > methods   base
> > > >
> > > > other attached packages:
> > > > [1] Hmisc_3.4-2 gdata_2.3.1
> > > >
> > > > loaded via a namespace (and not attached):
> > > > [1] cluster_1.11.9 grid_2.6.0 gtools_2.4.0
> > > > lattice_0.17-1
> > > >
> > > > __
> > > > R-help@r-project.org mailing list
> > > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > > PLEASE do read the posting guide
> > > http://www.R-project.org/posting-guide.html
> > > > and provide commented, minimal,
> self-contained,
> > > reproducible code.
> > > >
> > >
> > >
> > > --
> > > Jim Holtman
> > > Cincinnati, OH
> > > +1 513 646 9390
> > >
> > > What is the problem you are trying to solve?
> > >
> >
> >
> >
> >  Ask a question on any topic and get answers


> >
> 
> 
> -- 
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
> 
> What is the problem you are trying to solve?
>

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


Re: [R] Print list structure

2007-11-05 Thread Duncan Murdoch
On 11/5/2007 8:34 AM, Antje wrote:
> Hello again,
> 
> I was wondering whether there is a command with which I can print the 
> structure 
> of a list, containing list of list of ...
> If you have any hint let me know...

str() can print the structure of any R object.

Duncan Murdoch

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


Re: [R] Print list structure

2007-11-05 Thread Antje
I found the solution ... "str" does what I need...
(sorry for the request)


Antje schrieb:
> Hello again,
> 
> I was wondering whether there is a command with which I can print the 
> structure 
> of a list, containing list of list of ...
> If you have any hint let me know...
> 
> Antje
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Print list structure

2007-11-05 Thread Antje
Hello again,

I was wondering whether there is a command with which I can print the structure 
of a list, containing list of list of ...
If you have any hint let me know...

Antje

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


Re: [R] Where to ask general stats questions?

2007-11-05 Thread Frank E Harrell Jr
francogrex wrote:
> I see that some people ask general statistics questions here sometimes. As I
> understand this list is only for "technical" help with R-related issues. But
> does anyone know of a list/forum where we can ask help/questions regarding
> general statistics problems (and where solutions are offered possibly in the
> R language) . I know that usenet has some forums/groups but though those
> groups offer good solutions they are not necessarily in the context of the
> R/S langauge, in fact they are mostly either general hints without computer
> solution or if so then they mostly offer non-R codes.
> Thanks.

Look at the Usenet news group sci.stat.consult

-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Identify() : How to set the offset , or a reference

2007-11-05 Thread allergen

Hello,

I try to make several zoom in chosen region. 
So i use identify to indicate in which area to zoom.
i want o make it several time.
But once I zoom one time, the identify fonction gives bad results.

There is a short example, when i try to identify in Fnew  it sems that there
is an offset , or a bad reference. 
So the given result is "No point in 0,25inch"

thanks


F=read.table.
>
xy
1   3
2   5

3999   8
4000   9

plot(F$x,F$y)
I=identify(F$x)
Fnew=F[I[1]:I[2],]
>Fnew
x  y
2000  5
...
3000  9

plot(Fnew$x,Fnew$y)
I=identify(Fnew$x)






-- 
View this message in context: 
http://www.nabble.com/Identify%28%29--%3A-How-to-set-the-offset-%2C-or-a-reference-tf4751411.html#a13586185
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] Dringende Aufmerksamkeit BITTE LESEN

2007-11-05 Thread MR ANDREW BARENDS
MR. ANDREW L. J. BARENDS
Standard Bank Plc.
Johannesburg, South Africa1
ID Number: 0092-042.
UNTERSTÜTZUNG. 
 
Dringend  GESCHAEFTSANGEBOT
 
Mein Name ist Andrew L. J. Barends und ich bin der
Leiter des Corporate Affairs Committee in der Standard
Bank of South-Africa PLC in Südafrika. Ich kontaktiere
Sie bezüglich des Transfers einer sehr großen Summe
Geldes vom Konto eines Verstorbenen. Ich weiß, daß
eine Transaktion dieser Größenordnung zunächst bei
jedem Besorgnis erregen wird und versichere ich Ihnen,
daß sich um alles gekümmert wird.Aufgrund der
Dringlichkeit der Angelegenheit habe ich mich
entschlossen, Sie zu kontaktieren.
Es geht um folgendes:

Einer meiner Kollegen ist für das Konto von Gerald
Erbes zuständig, im Oktober bei einem Flugzeugabsturz
ums Leben kam. Er befand sich gemeinsam mit anderen
Passagieren an Bord einer Egyptian Airline 990. Seit
diesem Vorfall ist niemand seiner nächsten Verwandten
mehr am Leben, der als sein Erbe Ansprüche auf das
Guthaben auf seinem Konto erheben könnte. Wir können
jedoch gemäß unserer Richtlinien das Geld nicht
auszahlen, bevor jemand als Angehöriger und Erbe
auftritt und seinen Anspruch geltend macht. Aufgrund
dieser Entdeckung und der Übereinstimmung Ihres Namens
mit dem des Verstorbenen bitten meine Kollegen und ich
Sie nun um Ihre Erlaubnis, Sie als nächsten
Angehörigen des Verstorbenen anzugeben. Die gesamte
Abwicklung und Dokumentation wird sorgfältig von mir
durchgeführt, damit das Guthaben von 25.5 Millionen
US$ an Sie als nächsten Angehörigen ausgezahlt werden
kann.

Andernfalls wird die gesamte Summe nach fünf Jahren in
das Eigentum der Bank übergehen und die Direktoren der
Bank werden sie untereinander aufteilen. Aufgrund
dieser Tatsache habe ich mich entschlossen, mich an
Sie zu wenden, damit Sie als Erbe auftreten können und
nicht alles den Direktoren zugute kommt. Da aber die
Person, die im Testament als Erbin genannt wird, mit
ihm gemeinsam verstorben ist, haben wir vom
Nachlaßverwalter den Auftrag bekommen, ein
Familienmitglied des Verstorbenen ausfindig zu machen,
daß das Erbe antreten kann. 

Wir bitten Sie, unseren Vorschlag anzunehmen und
versichern Ihnen, daß alles absolut risikofrei für Sie
ablaufen wird.
Wir werden Sie mit 5 Millionen US$ an der Transaktion
beteiligen, den restlichen Betrag werden meine
Kollegen und ich für.
Falls Sie interessiert sind, schicken Sie mir bitte
folgende Angaben:

1. Name/Firmen name um die erforderlichen Dokumente
vorzubereitenp

2. Persönliche Telefon- und Fax-Nummern 

Zu meinem privat email : [EMAIL PROTECTED]  mit
seinem email address, damit ich die weiteren
relevanten Details in dieser Sache zu Ihnen mitteilen
kann. Danke im voraus.
Wir bitten sie eindringlich, die Angelegenheit
vertraulich zu behandeln.
Bitte antworten Sie mir schnellstmöglich und Gott
segne sie.
Mit freundlichen grussen.

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


Re: [R] Why can repeated measures anova with within & between subjects design not be done if group sizes are unbalanced?

2007-11-05 Thread Jonathan Baron
On 11/04/07 16:34, Gilbert G wrote:
> Dear R people:
> 
> I wish to switch from SPSS to R, but there is one particular type of
> ANOVA design that cannot be done in R.  Or more likely, it can be
> done, but it is nowhere documented.
> 
> The problem is typical for psychologists:
> You have a repeated measures design with different groups of subjects.
>  Now, this can be done with the aov command, but the number of
> subjects in both groups must be equal (i.e., balanced design).  SPSS
> allows for unbalanced designs as well.
> 
> If you are still with me, let me just give you an example of what R
> can and cannot do so far.  Imagine I have a 2x2 within subjects design
> and I have 2 groups (e.g., group healthy and patients, which is stored
> in MyGroup).  And imagine I measure reaction time RT in four
> conditions, say, in a color condition (red vs green) and in a shape
> condition (square vs circle).

At the risk of getting in trouble, let me suggest another approach.
Compute the relevant terms for each subject, then do a t test
comparing your two groups.  The t test does not assume equal sized
groups.  Yuelin Li, in our "Notes on the use of R ..." shows how to
use a t test to check a design very similar to what you suggest:
http://www.psych.upenn.edu/~baron/rpsych/rpsych.html (section 6.10, I
think, perhaps elsewhere too).

You can do this either with a loop or with the lmList() function in
the lme4 package (which is not discussed yet in our "Notes...").

For example, with a loop, you would compute
CS[i] <- RTredsquare[i] - RTbluesquare[i] - RTredcircle[i] +
 RTbluecircle[i]
and then do t.test(CS ~ Group) to see if your two groups differ in the
interaction effect.  It is easier with lmList.  You don't need the
loop.

I do think that nlme is going to replace a lot of standard approaches
in psychology.  (I am almost to the point of understanding it.)  But I
don't think it is necessary for the kind of design you describe.

Jon
-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron

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


Re: [R] R CMD Check fails under Windows XP *under R 2.3.1*

2007-11-05 Thread Prof Brian Ripley
Please note the R posting guide: none of the helpers will still be on R 
2.3.1.  This looks like a bug in the shell you have 'make' set up to use: 
it is not an OS-specific issue as that should be sh.exe from the Rtools 
distribution (and that recommended for R 2.3.1 is no longer available).


On Mon, 5 Nov 2007, Susanne Töpfer wrote:


Hello,

I have a problem with the checking and building of R packages that contain C or 
FORTRAN code.

I have implemented R 2.3.1 (2006-06-01) and the corresponding toolset under 
Windows XP and Windows 2000.
The MinGW compiler components are (exactly as recommended for R 2.3.1)

gcc-core-3.4.5-20051220-1.tar.gz
gcc-g++-3.4.5-20051220-1.tar.gz
gcc-g77-3.4.5-20051220-1.tar.gz
binutils-2.16.91-20050827-1.tar.gz
mingw-runtime-3.9.tar.gz
w32api-3.6.tar.gz

Under Windows 2000, everything works fine. Under Windows XP, R packages without 
C or FORTRAN code can be built without any problem.
Also, the C or FORTRAN code can be compiled using the command R CMD SHLIB.

The problem is, that building packages that contain C or FORTRAN code fails 
(only under Windows XP).
The command “R CMD Check test” gives

* using log directory 'F:/test.Rcheck'
* using Version 2.3.1 (2006-06-01)
* checking for file 'test/DESCRIPTION' ... OK
* this is package 'test' version '0.1-1'
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking whether package 'test' can be installed ... ERROR
Installation failed.
See 'F:/test.Rcheck/00install.out' for details.


The file 00install.out contains the message:

-- Making package test 
 adding build stamp to DESCRIPTION
 making DLL ...
Syntax error: "elif" unexpected (expecting "then")
make[2]: *** [srcDynlib] Error 2
make[1]: *** [all] Error 2
make: *** [pkg-test] Error 2
*** Installation of test failed ***

I have already tested different (recommended) orders in the path variable, the 
actual value is
C:\Programme\RTools\bin;C:\Programme\Perl\bin;C:\Programme\R\R-2.3.1\bin;
C:\Programme\Texmf\miktex\bin;C:\Programme\HTML_Help_Workshop;
/* other things */;C:\Programme\MinGW\bin

Does anybody can give me a hint?

Thank you very much for your time!
Susanne Toepfer


_
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=0066

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



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


[R] RE : Help about exception handling in r-project.

2007-11-05 Thread GOUACHE David
?try
?tryCatch

worked for me

David Gouache
Arvalis - Institut du Végétal
Station de La Minière
78280 Guyancourt
Tel: 01.30.12.96.22 / Port: 06.86.08.94.32


-Message d'origine-
De : ANUSHA AIYALU KANNAN [mailto:[EMAIL PROTECTED] 
Envoyé : dimanche 4 novembre 2007 04:50
À : [EMAIL PROTECTED]
Objet : [R] Help about exception handling in r-project.


Respected Sir,
 
I am working on something in R. I am getting the following error.
 
Warning messages:1: the standard deviation is zero in: cor(x, y, na.method, 
method == "kendall") 
 
I like to handle this error.
 
I like to know how to do error handling in R. 
 
I want to write the WARNING MESSAGES to a text file and exit R. Please help me 
with a solution.
 
My mailid is [EMAIL PROTECTED]
 
Thanking you,
Anusha
_
Climb to the top of the charts!  Play Star Shuffle:  the word scramble 
challenge with star power.

[[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 CMD Check fails under Windows XP

2007-11-05 Thread Susanne Töpfer
Hello,

I have a problem with the checking and building of R packages that contain C or 
FORTRAN code.

I have implemented R 2.3.1 (2006-06-01) and the corresponding toolset under 
Windows XP and Windows 2000. 
The MinGW compiler components are (exactly as recommended for R 2.3.1)

gcc-core-3.4.5-20051220-1.tar.gz
gcc-g++-3.4.5-20051220-1.tar.gz
gcc-g77-3.4.5-20051220-1.tar.gz
binutils-2.16.91-20050827-1.tar.gz
mingw-runtime-3.9.tar.gz
w32api-3.6.tar.gz

Under Windows 2000, everything works fine. Under Windows XP, R packages without 
C or FORTRAN code can be built without any problem. 
Also, the C or FORTRAN code can be compiled using the command R CMD SHLIB.

The problem is, that building packages that contain C or FORTRAN code fails 
(only under Windows XP). 
The command “R CMD Check test” gives

* using log directory 'F:/test.Rcheck'
* using Version 2.3.1 (2006-06-01)
* checking for file 'test/DESCRIPTION' ... OK
* this is package 'test' version '0.1-1'
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking whether package 'test' can be installed ... ERROR
Installation failed.
See 'F:/test.Rcheck/00install.out' for details. 


The file 00install.out contains the message:

-- Making package test 
  adding build stamp to DESCRIPTION
  making DLL ...
Syntax error: "elif" unexpected (expecting "then")
make[2]: *** [srcDynlib] Error 2
make[1]: *** [all] Error 2
make: *** [pkg-test] Error 2
*** Installation of test failed *** 

I have already tested different (recommended) orders in the path variable, the 
actual value is
C:\Programme\RTools\bin;C:\Programme\Perl\bin;C:\Programme\R\R-2.3.1\bin;
C:\Programme\Texmf\miktex\bin;C:\Programme\HTML_Help_Workshop; 
/* other things */;C:\Programme\MinGW\bin

Does anybody can give me a hint?

Thank you very much for your time!
Susanne Toepfer


_
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=0066

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

2007-11-05 Thread Uwe Ligges


ANUSHA AIYALU KANNAN wrote:
> Respected Sir,
>  
> I am working on something in R. I am getting the following error.
>  
> Warning messages:1: the standard deviation is zero in: cor(x, y, na.method, 
> method == "kendall") 
>  
> I like to handle this error.
>  
> I like to know how to do error handling in R. 
>  
> I want to write the WARNING MESSAGES to a text file and exit R. Please help 
> me with a solution.
>


See ?warning, ?stop and particularly ?try and the other links and 
references given on those help pages.

Uwe Ligges

> My mailid is [EMAIL PROTECTED]
>  
> Thanking you,
> Anusha
> _
> Climb to the top of the charts!  Play Star Shuffle:  the word scramble 
> challenge with star power.
> 
>   [[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] do.call without arguments?

2007-11-05 Thread Antje
Thank you very much! This is exactly what I need... I did not know that there 
is such a simple way :)

Antje


Peter Dalgaard schrieb:
> Antje wrote:
>> Hello,
>>
>> I have a vector containing strings of simple operation methods.
>>
>> methods <- c("mean","sd","median")e.g.
>>
>> Now, I'd like to apply these methods to my data and I thought, I could make 
>> a 
>> do.call. But these methods don't need any further arguments... Do I have to 
>> create an empty argument list?
>>
>> I wanted to use a tapply( data, factor, ??? do.call ??? )
>>
>> Can anybody help how to solve this problem?
>>
>>   
> Not sure what you mean by "any further arguments", but I wouldn't use
> do.call here:
> 
>> names(methods)<-methods
>> with(airquality,
> +  lapply(methods, function(f) tapply(Ozone,Month,FUN=f, na.rm=T)))
> $mean
>56789
> 23.61538 29.4 59.11538 59.96154 31.44828
> 
> $sd
>56789
> 22.22445 18.20790 31.63584 39.68121 24.14182
> 
> $median
>  5  6  7  8  9
> 18 23 60 52 23
> 
> 
>

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

2007-11-05 Thread Peter Dalgaard
Antje wrote:
> Hello,
>
> I have a vector containing strings of simple operation methods.
>
> methods <- c("mean","sd","median")e.g.
>
> Now, I'd like to apply these methods to my data and I thought, I could make a 
> do.call. But these methods don't need any further arguments... Do I have to 
> create an empty argument list?
>
> I wanted to use a tapply( data, factor, ??? do.call ??? )
>
> Can anybody help how to solve this problem?
>
>   
Not sure what you mean by "any further arguments", but I wouldn't use
do.call here:

> names(methods)<-methods
> with(airquality,
+  lapply(methods, function(f) tapply(Ozone,Month,FUN=f, na.rm=T)))
$mean
   56789
23.61538 29.4 59.11538 59.96154 31.44828

$sd
   56789
22.22445 18.20790 31.63584 39.68121 24.14182

$median
 5  6  7  8  9
18 23 60 52 23



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

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


[R] do.call without arguments?

2007-11-05 Thread Antje
Hello,

I have a vector containing strings of simple operation methods.

methods <- c("mean","sd","median")e.g.

Now, I'd like to apply these methods to my data and I thought, I could make a 
do.call. But these methods don't need any further arguments... Do I have to 
create an empty argument list?

I wanted to use a tapply( data, factor, ??? do.call ??? )

Can anybody help how to solve this problem?

Antje

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

2007-11-05 Thread Petr PIKAL
Hi

If your barplot is simple, why not to use plain barplot from basic 
graphics. Try to look at

?barplot

Petr
[EMAIL PROTECTED]

[EMAIL PROTECTED] napsal dne 04.11.2007 01:15:20:

> 
> 
> Subject: Creating a barplot--advice needed
> 
> 
> > Advice needed: I am preparing a computer program to do a barchart. 
Advice 
> > needed: Should I learn the lattice package, or try to? As a 
> > non-statistician, much of the terminology is unfamiliar to me. 
"grouping 
> > variable," "object of class trellis," etc. Or, is there a more easily 
> > learned way to do it? It is a simple, vanilla-flavored barplot. Each 
of 
> > the bars has the same width. I knos how to create the barplot using a 
> > speadsheet program (MS Excel or equivalent), but I do not know how to 
put 
> > the barplot on  top of a R graphics windows. I have a PhD in Computer 
> > Science, but am no statistician.
> >
> > Your advice?
> >
> > Tom Jones
> >
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] How to reconstitute a Product-Outcome table?

2007-11-05 Thread Gabor Grothendieck
This does not answer your question but here is a shorter
version of your code:

xx <- xtabs(Count ~ Outcome + Product, x)
yy <- sum(xx) * xx / outer(rowSums(xx), colSums(xx))
subset(as.data.frame(yy), Freq != 0)


On Nov 5, 2007 3:18 AM, francogrex <[EMAIL PROTECTED]> wrote:
>
> Hi, my question is technical but maybe a little complicated to express it
> well. I have written this small code to calculate a relative risk (RR) of a
> Product-Outcome pairs that I am given:
> example dataset called test.txt in tab-delimited format:
> -
> Product Outcome Count
> P.A O.A 1
> P.A O.D 16
> P.B O.A 7
> P.B O.C 23
> P.C O.B 6
> P.C O.B 25
> P.D O.A 3
> P.D O.O 1
> P.E O.O 31
> P.F O.D 2
> P.G O.C 1
> P.G O.D 1
>
> ## The code:
> x=read.table(file="test.txt",header=TRUE)
> yy=reshape(x,direction="wide",idvar="Product",timevar="Outcome")
> dat <- sapply(yy, function(x) {x[is.na(x)] <- 0; x})
> dat=subset(dat,select=-Product)
> ni=apply(dat,1,sum)
> nj=as.vector(apply(dat,2,sum))
> nij=as.vector(x$Count)
> ntot=sum(nij)
> pi=ni/ntot
> pj=nj/ntot
> pij=nij/ntot
> mat=cbind(Product=as.vector(x$Product),Outcome=as.vector(x$Outcome))
> mat=as.data.frame(mat);mat$pij=pij
> zaz=reshape(mat,direction="wide",idvar="Outcome",timevar="Product")
> smat<- as.data.frame(sapply(zaz, function(x)
> {x[is.na(x)] <- 0; x}) );
> smat=subset(smat,select=-Outcome)
> smat$pj=pj; smat[length(nj)+1,1:length(ni)]=pi;
> result <- matrix(NA,nrow=length(nj),ncol=length(ni))
> for(i in 1:length(ni)){
> for(j in 1:length(nj)){
> result[j,i]=smat[j,i]/(smat[length(nj)+1,i]*smat[j,length(ni)+1])}
> }
> colnames(result)<-as.vector(unique(x$Product))
> rownames(result)<-as.vector(unique(x$Outcome))
> result1=ftable(result)
> result1=as.data.frame(result1);result1=subset(result1,Freq>0)
> names(result1)=c("Outcome","Product", "RR")
> result1
>
> ##OUTPUT:
>   Outcome Product RR
> 1  O.A P.A  0.6256684
> 2  O.D P.A  5.7956656
> 6  O.A P.B  2.4818182
> 8  O.C P.B  3.7375000
> 14 O.B P.C 19.500
> 16 O.A P.D  7.9772727
> 20 O.O P.D  0.9140625
> 25 O.O P.E  3.6562500
> 27 O.D P.F  6.1578947
> 32 O.D P.G  3.0789474
> 33 O.C P.G  2.4375000
> ---
>
> My question now is: Suppose I have only some values of Count and RR:
> [example like 2 vectors generated randomly:Count=c(1, 16, 7, 23, 6, 25, 3,
> 1, 31, 2, 1, 1) and RR=c(0.625668449197861, 5.79566563467492,
> 2.48181818181818, 3.7375, 19.5, 7.97727272727273, 0.9140625, 3.65625,
> 6.1578947368421, 3.07894736842105, 2.4375)]
> Is there a way to reconstitute the count table as the one called test.txt in
> the beginning. I mean to reconstitute Product-Outcome-Count table from just
> the two vectors of Count and RR?
> Thanks.
> --
> View this message in context: 
> http://www.nabble.com/How-to-reconstitute-a-Product-Outcome-table--tf4750151.html#a13582738
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] Trellis dotplot label keys

2007-11-05 Thread Patrick Connolly
On Thu, 25-Oct-2007 at 04:25PM +0100, Omar Baqueiro wrote:

|> Hello,
|> 
|> I am trying to plot a chart similar to the typical barley yield dotplot:
|> dotplot(variety ~ yield | site, data = barley,
|> groups = year, auto.key = list(space = "right"),
|> xlab = "Barley Yield (bushels/acre) ",
|> aspect=0.5, layout = c(1,5))
|> 
|> However, I need the plot have different shapes for the different keys
|> and currently I just get circles with different colours as the keys.
|> Can someone tell me the way to indicate R how to assign automatically
|> keys which are black/white printer friendly?

?trellis.par.get


-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___Patrick Connolly   
 {~._.~} Great minds discuss ideas
 _( Y )_Middle minds discuss events 
(:_~*~_:)Small minds discuss people  
 (_)-(_)   . Anon
  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

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

2007-11-05 Thread ONKELINX, Thierry
apply(matrix, 2, cumsum)




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

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

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Namens threshold
Verzonden: zaterdag 3 november 2007 12:42
Aan: r-help@r-project.org
Onderwerp: [R] cumsum


Hi, my problem belongs to the basic ones. I want to get cumulated sum
over the matrix columns by one command (if such exists). Ordinary R's
cumsum(x) when x is:
 [,1] [,2]
[1,]15
[2,]26
[3,]37
[4,]48

yields:  1  3  6 10 15 21 28 36
I want:
 [,1] [,2]
[1,]15
[2,]3   11
[3,]6   18
[4,]   10   26
Is there any command to do so??

best, robert



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

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

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


Re: [R] Installing R on Mac OS X Leopard

2007-11-05 Thread Chung-hong Chan
I answered a similar question this morning.

"Refer to R Mac SIG list, the mpkg installer in 2.6 binary is broken in Leopard.
Until an updated version is release, you can install R by install each
package in "Packages" folder one by one.
Hope it helps."

https://stat.ethz.ch/pipermail/r-sig-mac/2007-October/004203.html


Regards,
CH

On 11/4/07, Mitch Ohriner <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I've used R before, but I just got a new computer with Leopard and I'm
> having trouble installing.  I download the installer, but when I reach the
> end of the install process, the "install" button remains gray and
> unclickable.  I've tried both standard and custom, as well as installing on
> my flash disk, to no avail.
>
> Any suggestions?  I'd rather not build from source, as that is likely beyond
> my abilities.
>
> Thanks a lot,
>
> Mitch
>
> [[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.
>


-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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] Installing R on Mac OS X Leopard

2007-11-05 Thread Mitch Ohriner
Hi there,

I've used R before, but I just got a new computer with Leopard and I'm
having trouble installing.  I download the installer, but when I reach the
end of the install process, the "install" button remains gray and
unclickable.  I've tried both standard and custom, as well as installing on
my flash disk, to no avail.

Any suggestions?  I'd rather not build from source, as that is likely beyond
my abilities.

Thanks a lot,

Mitch

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

2007-11-05 Thread Maura E Monville
I have got R GUI working on SuSE 10.3
The workaround is to set an environment variable that prevents the java
related error.
See http://en.opensuse.org/Xlib.lock

I tried to install 3 packages that I need through the R GUI.
When I installed "cluster" I noticed on R console the error messages I'm
copying
in the following:

* Installing *source* package 'cluster' ...
** libs
Loading required package: JavaGD
Loading required package: iplots
gcc -std=gnu99 -I/usr/local/lib64/R/include -I/usr/local/lib64/R/include
-I/usr/local/include
gcc: no input files
make: *** [clara.o] Error 1
ERROR: compilation failed for package 'cluster'
** Removing '/usr/local/lib64/R/library/cluster'
** Restoring previous '/usr/local/lib64/R/library/cluster'

In spite of the above the help(cluster) works, as well as help(pam),
help(hclust) , help(cluster), help(dist).
I haven't tried to run such commands on my data yet.

Regards,
Maura

-- 
Maura E.M

[[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] Garch() function of tseries package doesnt work anymore

2007-11-05 Thread José Augusto Morais de Andrade J únior - JAMAJ
Hi all,

I recently updated my to R 2.6.0 and tseries package ‘tseries’ version: 0.10-11.

When i was using R Version 2.3.1 (2006-06-01) with tseries 'tseries' version: 
0.10-7, the code
> garch(dflnRCLC1)
 * ESTIMATION WITH ANALYTICAL GRADIENT *

Call:
garch(x = dflnRCLC1)
Coefficient(s):
   a0 a1 b1
4.985e+00  1.880e-01  6.210e-14
>
worked very quick and well.

Now, with the newer version of R and tseries, this code hungs and doesnt give 
any result

> garch(dflnRCLC1)
 * ESTIMATION WITH ANALYTICAL GRADIENT *
its hungs forever...


What happens?

Regards,

José Augusto Jr.
University of São Paulo

[[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] Fw: Creating a barplot--advice needed

2007-11-05 Thread Thomas L Jones, PhD


Subject: Creating a barplot--advice needed


> Advice needed: I am preparing a computer program to do a barchart. Advice 
> needed: Should I learn the lattice package, or try to? As a 
> non-statistician, much of the terminology is unfamiliar to me. "grouping 
> variable," "object of class trellis," etc. Or, is there a more easily 
> learned way to do it? It is a simple, vanilla-flavored barplot. Each of 
> the bars has the same width. I knos how to create the barplot using a 
> speadsheet program (MS Excel or equivalent), but I do not know how to put 
> the barplot on  top of a R graphics windows. I have a PhD in Computer 
> Science, but am no statistician.
>
> Your advice?
>
> Tom Jones
>

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

2007-11-05 Thread ANUSHA AIYALU KANNAN

Respected Sir,
 
I am working on something in R. I am getting the following error.
 
Warning messages:1: the standard deviation is zero in: cor(x, y, na.method, 
method == "kendall") 
 
I like to handle this error.
 
I like to know how to do error handling in R. 
 
I want to write the WARNING MESSAGES to a text file and exit R. Please help me 
with a solution.
 
My mailid is [EMAIL PROTECTED]
 
Thanking you,
Anusha
_
Climb to the top of the charts!  Play Star Shuffle:  the word scramble 
challenge with star power.

[[alternative HTML version deleted]]

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


[R] How to reconstitute a Product-Outcome table?

2007-11-05 Thread francogrex

Hi, my question is technical but maybe a little complicated to express it
well. I have written this small code to calculate a relative risk (RR) of a
Product-Outcome pairs that I am given:
example dataset called test.txt in tab-delimited format:
-
Product Outcome Count
P.A O.A 1
P.A O.D 16
P.B O.A 7
P.B O.C 23
P.C O.B 6
P.C O.B 25
P.D O.A 3
P.D O.O 1
P.E O.O 31
P.F O.D 2
P.G O.C 1
P.G O.D 1

## The code:
x=read.table(file="test.txt",header=TRUE)
yy=reshape(x,direction="wide",idvar="Product",timevar="Outcome")
dat <- sapply(yy, function(x) {x[is.na(x)] <- 0; x}) 
dat=subset(dat,select=-Product)
ni=apply(dat,1,sum)
nj=as.vector(apply(dat,2,sum))
nij=as.vector(x$Count)
ntot=sum(nij)
pi=ni/ntot
pj=nj/ntot
pij=nij/ntot
mat=cbind(Product=as.vector(x$Product),Outcome=as.vector(x$Outcome))
mat=as.data.frame(mat);mat$pij=pij
zaz=reshape(mat,direction="wide",idvar="Outcome",timevar="Product")
smat<- as.data.frame(sapply(zaz, function(x)
{x[is.na(x)] <- 0; x}) ); 
smat=subset(smat,select=-Outcome)
smat$pj=pj; smat[length(nj)+1,1:length(ni)]=pi; 
result <- matrix(NA,nrow=length(nj),ncol=length(ni))
for(i in 1:length(ni)){
for(j in 1:length(nj)){
result[j,i]=smat[j,i]/(smat[length(nj)+1,i]*smat[j,length(ni)+1])}
}
colnames(result)<-as.vector(unique(x$Product))
rownames(result)<-as.vector(unique(x$Outcome))
result1=ftable(result)
result1=as.data.frame(result1);result1=subset(result1,Freq>0)
names(result1)=c("Outcome","Product", "RR")
result1

##OUTPUT:
   Outcome Product RR
1  O.A P.A  0.6256684
2  O.D P.A  5.7956656
6  O.A P.B  2.4818182
8  O.C P.B  3.7375000
14 O.B P.C 19.500
16 O.A P.D  7.9772727
20 O.O P.D  0.9140625
25 O.O P.E  3.6562500
27 O.D P.F  6.1578947
32 O.D P.G  3.0789474
33 O.C P.G  2.4375000
---

My question now is: Suppose I have only some values of Count and RR:
[example like 2 vectors generated randomly:Count=c(1, 16, 7, 23, 6, 25, 3,
1, 31, 2, 1, 1) and RR=c(0.625668449197861, 5.79566563467492,
2.48181818181818, 3.7375, 19.5, 7.97727272727273, 0.9140625, 3.65625,
6.1578947368421, 3.07894736842105, 2.4375)]
Is there a way to reconstitute the count table as the one called test.txt in
the beginning. I mean to reconstitute Product-Outcome-Count table from just
the two vectors of Count and RR?
Thanks.
-- 
View this message in context: 
http://www.nabble.com/How-to-reconstitute-a-Product-Outcome-table--tf4750151.html#a13582738
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] R2HTML package and Open Office: text only pasted

2007-11-05 Thread Graham Smith
I am trying to use R2HTML (just downloaded from CRAN) to paste R (2.6.0)
results output via the clipboard to OpenOffice Writer and Calc
(version 2.3on WinXPPro)

Pasting into Excel gives a formatted table of results (as expected), but
pasting into Calc simply pastes  the HTML code. Trying paste special  only
gives an option to paste unformatted text.

Equally, with Writer, in the past when I tried this, the results were pasted
as a table, but now they are pasted as HTML code. Again trying to use paste
special, there is only an unformatted text option.

I am using the simplest R2HTML code option, which as a I said, works with
Excel

HTML2clip(x)

I suspect this is more an OOo issue, but hopefully someone has experience of
using this combination and can help.

Thanks,

Graham

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