Re: [R] Question about Density Plot

2010-10-19 Thread Jim Lemon

On 10/18/2010 11:34 PM, Ignacio Ibarra Del Río wrote:

Hi

I've attached an example about something I want to do in R. This example
was done in a Fortran application called ASGL. Here's an example in
matplotlib

http://matplotlib.sourceforge.net/examples/pylab_examples/hexbin_demo.html

Basically, it's like a scatter plot, but have several additional things.
One thing are the grids inside the graph, and the other is a density bar
used as a reference to evaluate the frequency of the points.

The command that I've always used in R for scatter plots is.

  plot(l1, l2)

I need to know if there is something similar in a library of R, or if I
could implement it on my own.


Hi Ignacio,
Have a look at the color2D.matplot in the plotrix package with do.hex=TRUE.

Jim

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


[R] For-loop dummy variables?

2010-10-19 Thread gravityflyer

Hi everyone, 

I've got a dataset with 12,000 observations. One of the variables
(cleary$D1) is for an individual's country, coded 1 - 15. I'd like to create
a dummy variable for the Baltic states which are coded 4,6, and 7. In other
words, as a dummy variable Baltic states would be coded 1, else 0.  I've
attempted the following for loop:

dummy - matrix(NA, nrow=nrow(cleary), ncol=1)
for (i in 1:length(cleary$D1)){
if (cleary$D1 == 4){dummy[i] = 1}
else {dummy[i] = 0}
}

Unfortunately it generates the following error:

1: In if (cleary$D1 == 4) { ... :
  the condition has length  1 and only the first element will be used


Another options I've tried is the following:

binary - vector(length=length(cleary$D1))
for (i in 1:length(cleary$D1)) {
if (cleary$D1 == 4 | cleary$D1 == 6 | cleary$D1 == 7 ) {binary[i] = 1}
else {binary[i] = 0}
}

Unfortunately it simply responds with syntax error.

Any thoughts would be greatly appreciated!


-- 
View this message in context: 
http://r.789695.n4.nabble.com/For-loop-dummy-variables-tp3001396p3001396.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Incorrect positioning of raster images on Windows

2010-10-19 Thread Paul Murrell

Hi

This is a rounding (truncation) problem.
Working on a fix.

Paul

Sharpie wrote:


Michael Sumner-2 wrote:

I think there's something about the discrete cell versus centre value
interpretation here, and you are pushing the pixels through R's graphics
engine as well as whatever the png device has to do.

I can't enlighten you about the details of that, but by creating an image
file more directly with pixels as data you can get the result exactly:

test - matrix(c(0, 255), 3, 5)
library(rgdal)
## transpose to get orientation right
x - image2Grid(list(x = 1:ncol(test), y = 1:nrow(test), z = t(test)))
writeGDAL(x, raster.png, driver = PNG, type = Byte)



On Mon, Oct 18, 2010 at 3:17 PM, Sharpie ch...@sharpsteen.net wrote:


I am working on dumping raster data from R into PNG files using
rasterImage().  I am working with a test matrix from the rasterImage()
example and using it to produce a PNG image with the following code:


# From the example for rasterImage(). A 3 pixel by 5 pixel b/w
checkerboard.
testImage - as.raster(0:1, nrow=3, ncol=5)

testImage
[,1]  [,2]  [,3]  [,4]  [,5]
[1,] #00 #FF #00 #FF #00
[2,] #FF #00 #FF #00 #FF
[3,] #00 #FF #00 #FF #00

png('test.png', width=5, height=3, units='px')

# Just want the image, no margins, boarders or other fancy stuff.
par(mar = c(0,0,0,0) )
plot.new()
plotArea = par('fig')

rasterImage(testImage, plotArea[1], plotArea[3],
 plotArea[2], plotArea[4], interpolate = FALSE )

dev.off()


However, using R 2.12.0, 64 bit on Windows 7 I have a strange issue where
the image is shifted up by one row and to the left by one row.  In other
words, the bottom row of pixels is missing along with the right column.
 The
code works as I expect it to on OS X and Debian.


Am I misusing the plotting commands in some way or should I submit an
off-by-one bugreport to Bugzilla?

Any suggestions or comments are most welcome.

-Charlie

-
Charlie Sharpsteen
Undergraduate-- Environmental Resources Engineering
Humboldt State University
--
View this message in context:
http://r.789695.n4.nabble.com/Incorrect-positioning-of-raster-images-on-Windows-tp2999649p2999649.html
Sent from the R help mailing list archive at Nabble.com.

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




--
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsum...@gmail.com





Hi Micheal,

I appreciate the suggestion.  However, rgdal is very heavyweight and
installing the GDAL library is not a trivial operation automagically handled
`install.packages()` on every platform R supports.  As I am not doing
spatial analysis, I am very reluctant to add rgdal to the dependency list of
my package.

I would very much prefer to find the root cause of the difference in `png()`
behavior on Windows when compared to OS X and Linux.  If anyone on this list
has some insight to share, I would be very grateful to hear it.

I waffled a bit on whether to send this to R-help or R-devel, in the light
of day (as opposed to the foggy darkness that surrounds 2am) think it may be
more of an R-devel question.  Forwarding it there now.

-Charlie

-
Charlie Sharpsteen
Undergraduate-- Environmental Resources Engineering
Humboldt State University


--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
p...@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

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

2010-10-19 Thread gravityflyer

I should have noted that the first attempt list above obviously was practice
when cleary$D1== 4. To reiterate, this still didn't work.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/For-loop-dummy-variables-tp3001396p3001398.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] For-loop dummy variables?

2010-10-19 Thread Bill.Venables
you might try

dummy - with(cleary, 
cbind(B4 = as.numeric(D1 == 4),
 B6 = as.numeric(D1 == 6),
 B7 = as.numeric(D1 == 7)))

and do it all in one go.

___

to fix up your apporach you need to use

if(cleary$D1[i] == 4) dummy[i] - 1 else dummy[i] - 0

but this is a very clumsy and slow way of going about it.

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of gravityflyer
Sent: Tuesday, 19 October 2010 1:24 PM
To: r-help@r-project.org
Subject: [R] For-loop dummy variables?


Hi everyone, 

I've got a dataset with 12,000 observations. One of the variables
(cleary$D1) is for an individual's country, coded 1 - 15. I'd like to create
a dummy variable for the Baltic states which are coded 4,6, and 7. In other
words, as a dummy variable Baltic states would be coded 1, else 0.  I've
attempted the following for loop:

dummy - matrix(NA, nrow=nrow(cleary), ncol=1)
for (i in 1:length(cleary$D1)){
if (cleary$D1 == 4){dummy[i] = 1}
else {dummy[i] = 0}
}

Unfortunately it generates the following error:

1: In if (cleary$D1 == 4) { ... :
  the condition has length  1 and only the first element will be used


Another options I've tried is the following:

binary - vector(length=length(cleary$D1))
for (i in 1:length(cleary$D1)) {
if (cleary$D1 == 4 | cleary$D1 == 6 | cleary$D1 == 7 ) {binary[i] = 1}
else {binary[i] = 0}
}

Unfortunately it simply responds with syntax error.

Any thoughts would be greatly appreciated!


-- 
View this message in context: 
http://r.789695.n4.nabble.com/For-loop-dummy-variables-tp3001396p3001396.html
Sent from the R help mailing list archive at Nabble.com.

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

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


[R] Doubt on using lattice

2010-10-19 Thread Cristina Ramalho
Hi all,

I suppose this is a very simple question, but as I've lost already a bit of
time with it, without being able to get what I wanted, I'm addressing the
question to the group in the hope someone can help me.

I pretend to plot the richness of herbaceous species (RichHN) as a function
of time since remnant isolation (Isol) conditioned to the area of the
remnant (fArea - this is a factor with 3 classes). I also want to
differentiate the sites plotted using a grouping binary variable (Urb).

So far, I've written this:

extinction-xyplot(RichHN~Isol|fArea, data = Data, type = p, groups=Urb,
  aspect=xy, layout=c(3,1), between=list(x=0.5, y=0.5),
  cex=1, pch = c(21, 1),
  auto.key=list(space=bottom),
  main=Influence of time since remnant isolation and remnant area
on species diversity,
  xlab=Time since remnant isolation (rank),
  ylab=Richness of native herbaceous)
print(extinction)

What do I need to add, in order I can have:
- the graph dots labeled with the variable SiteName
- an overall trend line for each panel
- the dots with Urb=1 filled in black; and the dots with Urb=0 filled in
white

I've been back and forwards, trying to use panel function, but I didn't
manage to do it right...

Thank you for your help in advance. Regards,

C.


Cristina Estima Ramalho
PhD Candidate
MSc in GIS

Ecosystem Restoration Lab
School of Plant Biology (M090)
The University of Western Australia
35 Stirling Highway, Crawley WA 6009 Perth, Australia
Phone: +61 (08) 6488 4655; Fax: +61 (08) 6488 7461
www.plants.uwa.edu.au/research/ecosystem_restoration
-

[[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] [SOLVED] Re: Strange glm(, quasipoisson) error

2010-10-19 Thread Wil M Contreras Arbaje

Hi everyone,

Please ignore my previous message: it turns out Excel, when saving  
as .csv, was somehow storing numerical values as text, and that was  
causing the error. I opened the .csv, changed all observations to --  
Number type, and it worked w/o a hitch afterwards.


Thanks,


Wil


On Oct 19, 2010, at 00:55 , Wil M Contreras Arbaje wrote:


Dear list,

I have recently encountered an odd error when running glm(dep~indep,  
quasipoisson): while, with a subset of my data, I could get a  
perfectly reasonable model, once I include all of my data (17K+  
observations, 29 variables), I get the following error:


Error in if (any(y  0)) stop(negative values not allowed for the  
quasiPoisson family) :

 missing value where TRUE/FALSE needed
In addition: Warning message:
In Ops.factor(y, 0) :  not meaningful for factors

I say this is odd because I triple checked my response variable, and  
not a single observation is negative. Is R encountering an error due  
to the size of the data, and somehow returning a 'random' error?  
(would be stranger still!)


Thanks a million, hope this makes sense.

Cheers,


Wil


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

2010-10-19 Thread Jumlong Vongprasert
Dear All
I want to calculate power of test. I want to test H0: Rho = 0 VS H1: Rho
!= 0.
Assume, I have r=0.2 and sample size = 100.
How I can do this.
Many Thanks
Jumlong

-- 
Jumlong Vongprasert Assist, Prof.
Institute of Research and Development
Ubon Ratchathani Rajabhat University
Ubon Ratchathani
THAILAND
34000

[[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] Doubt on using lattice

2010-10-19 Thread Dennis Murphy
Hi:

On Mon, Oct 18, 2010 at 11:32 PM, Cristina Ramalho 
cristina.rama...@grs.uwa.edu.au wrote:

 Hi all,

 I suppose this is a very simple question, but as I've lost already a bit of
 time with it, without being able to get what I wanted, I'm addressing the
 question to the group in the hope someone can help me.

 I pretend to plot the richness of herbaceous species (RichHN) as a function
 of time since remnant isolation (Isol) conditioned to the area of the
 remnant (fArea - this is a factor with 3 classes). I also want to
 differentiate the sites plotted using a grouping binary variable (Urb).

 So far, I've written this:

 extinction-xyplot(RichHN~Isol|fArea, data = Data, type = p, groups=Urb,
  aspect=xy, layout=c(3,1), between=list(x=0.5, y=0.5),
  cex=1, pch = c(21, 1),
  auto.key=list(space=bottom),
  main=Influence of time since remnant isolation and remnant area
 on species diversity,
  xlab=Time since remnant isolation (rank),
  ylab=Richness of native herbaceous)
 print(extinction)

 What do I need to add, in order I can have:
 - the graph dots labeled with the variable SiteName


This isn't a simple fix - I believe you need to create a panel function and
use panel.text() in conjunction with panel.xyplot(). The trick is figuring
out the coordinates to place the labels relative to the points.

- an overall trend line for each panel


Use type = c('p', 'r') - the 'r' stands for least squares fitted line
between the x and y variables. With groups defined, there is a separate
fitted line per group.


 - the dots with Urb=1 filled in black; and the dots with Urb=0 filled in
 white

 One choice is pch = c(1, 16), col = 1.

I've been back and forwards, trying to use panel function, but I didn't
 manage to do it right...


Here's a toy example - hopefully it will help. Only one panel, though.

df - data.frame(g = rep(c(0, 1), each = 10),
 x = rep(1:10, 2),
 y = 2 + 0.8 * rep(1:10, 2) + rnorm(20),
 lab = letters[1:20])

# The labels are distinct, which makes things easier - i.e., no groupwise
# dependence. If you have multiple panels, you will probably need to
# define subscripts in the panel function.

xyplot(y ~ x, data = df, groups = g, type = c('p', 'r'), pch = c(1, 16), col
= 1,
   col.line = c('red', 'black'), cex = 1.2, lwd = 1.6,
   panel = function(x, y, ..., groups) {
  panel.xyplot(x, y, ..., groups)
  panel.text(x = df$x + 0.2, y = df$y - 0.2, lab = df$lab)
 } )

Dennis

Thank you for your help in advance. Regards,

 C.

 
 Cristina Estima Ramalho
 PhD Candidate
 MSc in GIS

 Ecosystem Restoration Lab
 School of Plant Biology (M090)
 The University of Western Australia
 35 Stirling Highway, Crawley WA 6009 Perth, Australia
 Phone: +61 (08) 6488 4655; Fax: +61 (08) 6488 7461
 www.plants.uwa.edu.au/research/ecosystem_restoration

 -

[[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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


Re: [R] For-loop dummy variables?

2010-10-19 Thread Phil Spector

I always find R useful to solve problems like this:

  dummy = as.numeric(cleary$D1 %in% c(4,6,7))

If, for some reason you want to use a loop, try

dummy - matrix(NA, nrow=nrow(cleary), ncol=1)
for (i in 1:length(cleary$D1)){
  if (cleary$D1[i] %in% c(4,6,7)){dummy[i] = 1}
  else {dummy[i] = 0}
  }

When you write a loop, you need to use the loop index
to select the individual value you're working with.


- Phil Spector
 Statistical Computing Facility
 Department of Statistics
 UC Berkeley
 spec...@stat.berkeley.edu


On Mon, 18 Oct 2010, gravityflyer wrote:



Hi everyone,

I've got a dataset with 12,000 observations. One of the variables
(cleary$D1) is for an individual's country, coded 1 - 15. I'd like to create
a dummy variable for the Baltic states which are coded 4,6, and 7. In other
words, as a dummy variable Baltic states would be coded 1, else 0.  I've
attempted the following for loop:

dummy - matrix(NA, nrow=nrow(cleary), ncol=1)
for (i in 1:length(cleary$D1)){
if (cleary$D1 == 4){dummy[i] = 1}
else {dummy[i] = 0}
}

Unfortunately it generates the following error:

1: In if (cleary$D1 == 4) { ... :
 the condition has length  1 and only the first element will be used


Another options I've tried is the following:

binary - vector(length=length(cleary$D1))
for (i in 1:length(cleary$D1)) {
if (cleary$D1 == 4 | cleary$D1 == 6 | cleary$D1 == 7 ) {binary[i] = 1}
else {binary[i] = 0}
}

Unfortunately it simply responds with syntax error.

Any thoughts would be greatly appreciated!


--
View this message in context: 
http://r.789695.n4.nabble.com/For-loop-dummy-variables-tp3001396p3001396.html
Sent from the R help mailing list archive at Nabble.com.

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



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


Re: [R] Extracting elements from a nested list

2010-10-19 Thread Erich Neuwirth
mapply(function(x1,x2)x1[[x2]],all.predicted.values,max.growth,SIMPLIFY=FALSE)

gives a list of factors.


On 10/18/2010 8:40 PM, Gregory Ryslik wrote:
 Hi Everyone,
 
 This is closer to what I need but this returns me a matrix where each
 element is a factor. Instead I would want a list of lists. The first
 entry of the list should equal the first column of the matrix that
 mapply makes, the second entry to the second column etc...
 
 I've attached the two files that have all.predicted.values and
 max.growth from dput to make for easy testing. Thanks again!
 
 
 
 
 Kind regards,
 Greg
 
 On Oct 18, 2010, at 1:33 PM, Erich Neuwirth wrote:
 
 You probably need mapply since you have 2 list of arguments which you
 want to use in sync

 mapply(function(x1,x2)x1[[x2]],all.predicted.values,max.growth)

 might be what you want.



 On Oct 18, 2010, at 5:17 PM, Gregory Ryslik wrote:

 Unfortunately, that gives me null everywhere. Here's the data I have
 for all.predicted.values and max.growth. Perhaps this will help. Thus
 I want all.predicted.values[[1]][[4]] then
 all.predicted.values[[2]][3]] and then all.predicted.values[[3]][[4]].

 I've attached what your statement outputs at the end.

 Thanks again!

 Browse[2] max.growth
 [[1]]
 [1] 4

 [[2]]
 [1] 3

 [[3]]
 [1] 4

 Browse[2] all.predicted.values
 [[1]]
 [[1]][[1]]
  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 [55] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 Levels: 0 1 2

 [[1]][[2]]
  [1] 2 2 2 0 2 0 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 0 0 2 2 2 2 0
 0 0 2 2 0 0 2 2 0 2 2 2 2 2 0 2 2 2 0 2 2 0
 [55] 0 0 2 0 2 0 0 0 0 2 2 2 2 0 2 2 2 0 2 2 0 0 2 2 2 2 2 2 2 0 0 0
 2 0 2 2 2 2 0 2 2 2 0 2 0 0
 Levels: 0 1 2

 [[1]][[3]]
  [1] 0 0 0 0 2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 2 0 2 2 2 0 0 0 2 0 0 2 0
 0 0 0 0 0 0 2 0 0 0 0 0 2 2 0 0 0 2 0 0 0 0
 [55] 0 0 2 0 2 0 0 0 0 2 2 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 2 2 0 0 0 0 0 0 2 0 0
 Levels: 0 1 2

 [[1]][[4]]
  [1] 0 0 0 0 2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 2 0 2 2 2 0 0 0 2 0 0 2 0
 0 0 0 0 0 0 2 0 0 0 0 0 2 2 0 0 0 2 0 0 0 0
 [55] 0 0 2 0 2 0 0 0 0 2 2 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 2 2 0 0 0 0 0 0 2 0 0
 Levels: 0 1 2


 [[2]]
 [[2]][[1]]
  [1] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
 [55] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
 2 2 2 2 2 2 2 2 2 2 2 2 2 2
 Levels: 0 1 2

 [[2]][[2]]
  [1] 2 2 2 2 1 2 2 2 2 2 1 2 2 2 2 1 2 1 2 2 2 2 2 2 2 2 2 2 1 2 2 2
 2 2 1 2 2 2 1 2 2 1 1 2 2 2 2 2 2 2 2 1 2 2
 [55] 2 2 2 2 1 2 2 2 2 1 2 2 1 1 1 2 2 2 1 2 1 2 1 2 1 2 2 2 1 1 2 2
 1 2 2 1 1 2 1 1 1 2 2 1 2 2
 Levels: 0 1 2

 [[2]][[3]]
  [1] 2 2 2 0 1 2 2 2 2 2 1 2 2 2 0 1 2 1 2 2 2 2 2 2 2 0 0 2 1 2 2 2
 0 0 1 2 0 0 1 2 0 1 1 2 2 2 0 2 2 2 0 1 2 2
 [55] 0 2 2 2 1 0 0 0 0 1 2 2 1 1 1 2 2 0 1 2 1 0 1 2 1 2 2 2 1 1 2 2
 1 2 2 1 1 2 1 1 1 2 2 1 0 2
 Levels: 0 1 2


 [[3]]
 [[3]][[1]]
  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 [55] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 Levels: 0 1 2

 [[3]][[2]]
  [1] 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 0 2 2 2 2 2
 0 0 2 2 2 0 2 2 0 2 2 2 2 2 0 2 2 2 0 2 2 2
 [55] 0 2 2 2 2 2 0 0 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2
 2 2 2 2 2 2 2 2 2 2 2 2 2 2
 Levels: 0 1 2

 [[3]][[3]]
  [1] 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0
 0 0 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0
 [55] 0 0 0 0 1 0 0 0 0 1 0 0 1 1 1 0 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 0
 1 0 0 1 1 0 1 1 1 0 0 1 1 0
 Levels: 0 1 2

 [[3]][[4]]
  [1] 2 2 2 0 1 0 2 2 0 2 1 2 2 0 0 1 1 1 1 0 2 0 0 0 2 0 0 0 1 2 0 0
 0 0 1 2 0 0 1 2 0 1 1 2 0 0 0 2 2 0 0 1 2 0
 [55] 0 0 0 0 1 0 0 0 0 1 0 2 1 1 1 2 0 0 1 2 1 1 1 2 1 2 2 2 1 1 0 0
 1 0 2 1 1 2 1 1 1 2 0 1 1 0
 Levels: 0 1 2


 Browse[2]
 predicted.values.for.max.growth-diag(sapply(all.predicted.values,'[[','max.growth'))
 Browse[2] predicted.values.for.max.growth
 [[1]]
 NULL

 [[2]]
 [1] 0

 [[3]]
 [1] 0

 [[4]]
 [1] 0

 [[5]]
 NULL

 [[6]]
 [1] 0

 [[7]]
 [1] 0

 [[8]]
 [1] 0

 [[9]]
 NULL



 On Oct 18, 2010, at 11:08 AM, Henrique Dallazuanna wrote:

 Try this:

 diag(sapply(all.predicted.values, '[[', 'max.growth'))


 On Mon, Oct 18, 2010 at 12:59 PM, Gregory Ryslik rsa...@comcast.net
 mailto:rsa...@comcast.net wrote:
 Hi,

 I have a list of n items and the ith element has m_i elements within it.

 I want to do something like:

 predicted.values- lapply(all.predicted.values,'[[',max.growth[[i]])

 Where max.growth[[i]] is the element I want to extract from each of
 the ith predicted elements. Thus, for example, I want to extract the
 max.growth[[1]] element from  all.predicted.values[[1]] (which is
 itself a list). Then I want to extract max.growth[[2]] element from
 all.predicted.values[[2]].

 

Re: [R] For-loop dummy variables?

2010-10-19 Thread Adrian Dusa
gravityflyer gravityflyer at yahoo.com writes:
 
 Hi everyone, 
 
 I've got a dataset with 12,000 observations. One of the variables
 (cleary$D1) is for an individual's country, coded 1 - 15. I'd like to create
 a dummy variable for the Baltic states which are coded 4,6, and 7. In other
 words, as a dummy variable Baltic states would be coded 1, else 0.  I've
 attempted the following for loop:
 
 dummy - matrix(NA, nrow=nrow(cleary), ncol=1)
 for (i in 1:length(cleary$D1)){
   if (cleary$D1 == 4){dummy[i] = 1}
   else {dummy[i] = 0}
   }
 
 Unfortunately it generates the following error:
 
 1: In if (cleary$D1 == 4) { ... :
   the condition has length  1 and only the first element will be used
 
 Another options I've tried is the following:
 
 binary - vector(length=length(cleary$D1))
 for (i in 1:length(cleary$D1)) {
   if (cleary$D1 == 4 | cleary$D1 == 6 | cleary$D1 == 7 ) {binary[i] = 1}
   else {binary[i] = 0}
 }
 
 Unfortunately it simply responds with syntax error.
 
 Any thoughts would be greatly appreciated!
 

Be aware that R is a vectorised programming language, therefore your for loop 
in 
completely unnecessary.

This is what I'd do:

dummy - rep(0, nrow(cleary))
dummy[cleary$D1 %in% c(4,6,7)] - 1

This is your dummy variable.
Below is your working (though VERY inefficient) version of the for loop:

binary - vector(length=length(cleary$D1))
for (i in 1:length(cleary$D1)) {
if (cleary$D1[i] == 4 | cleary$D1[i] == 6 | cleary$D1[i] == 7 ) {
binary[i] = 1
} else {
binary[i] = 0
}
}

Now try to figure out:
- what is the difference between your for() loop and mine?
- which code is more simple (and better), the vectorised or the for() loop?

I hope it helps,
Adrian

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


[R] Milliseconds and Time object

2010-10-19 Thread statquant2

Hello all,
my question for today is the following :

I have 
1. a date (in a string but straightforward to convert to any format)
2. the time as the number of milliseconds elapsed since hour 00:00:00.000 of
this date.

My question is :
1. Is there a in built function that can give me the date+time (as POSIX
object for instance) from what I have ?
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Milliseconds-and-Time-object-tp3001570p3001570.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] package vars doesn´t working

2010-10-19 Thread 敷田治誠 クラウジオ
Hello,

I was using R (v.2.11.1, 32 bits) and I did the upgrade to R (v.2.12.0, 64
bits). I followed the instructions in R´s FAQ (What´s the best way to
upgrade, question 2.8) and updated my packages. However, now, I can´t use
the library vars. When I call it, there is an error message concerning the
package MASS which couldn´t be updated because it seems to be no more
available in R´s repositories.

Is this a problem with vars? Maybe it will have to be updated soon with no
more need to ask for MASS? Is there another way to invoke vars?

Thanks for your time and attention

-- 
http://shikida.net  and http://works.bepress.com/claudio_shikida/

Esta mensagem pode conter informação confidencial e/ou privilegiada. Se você
não for o destinatário ou a pessoa autorizada a receber esta mensagem, não
poderá usar, copiar ou divulgar as informações nela contidas ou tomar
qualquer ação baseada nessas informações. Se você recebeu esta mensagem por
engano, por favor avise imediatamente o remetente, respondendo o presente
e-mail e apague-o em seguida.
This message may contain confidential and/or privileged ...{{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] package vars doesn´t working

2010-10-19 Thread Pfaff, Bernhard Dr.
Dear Claudio,

hard to tell without further information, but I reckon that you:

1) have a secondary library in use
2) have installed the packages 'vars' **and** 'MASS' installed into this 
secondary library

If so, remove the package 'MASS' from this secondary library (it's shipped in 
the standard library in your R installation already). Hint: check whether you 
have installed other recommended packages into your secondary library and if 
so, remove these, too. Otherwise you migt encounter the same problem with 
packages that do depend on the ones that are already shipped in the primary 
library of your R installation.

This all is just a guess, because you have not provided enough information to 
diagnose further.

Best,
Bernhard 

-Ursprüngliche Nachricht-
Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im 
Auftrag von Claudio Shikida ( ?)
Gesendet: Dienstag, 19. Oktober 2010 10:19
An: r-help@r-project.org
Betreff: [R] package vars doesn´t working

Hello,

I was using R (v.2.11.1, 32 bits) and I did the upgrade to R (v.2.12.0, 64 
bits). I followed the instructions in Rs FAQ (Whats the best way to upgrade, 
question 2.8) and updated my packages. However, now, I cant use the library 
vars. When I call it, there is an error message concerning the package MASS 
which couldnt be updated because it seems to be no more available in Rs 
repositories.

Is this a problem with vars? Maybe it will have to be updated soon with no 
more need to ask for MASS? Is there another way to invoke vars?

Thanks for your time and attention

--
http://shikida.net  and http://works.bepress.com/claudio_shikida/

Esta mensagem pode conter informao confidencial e/ou privilegiada. Se voc no 
for o destinatrio ou a pessoa autorizada a receber esta mensagem, no poder 
usar, copiar ou divulgar as informaes nela contidas ou tomar qualquer ao 
baseada nessas informaes. Se voc recebeu esta mensagem por engano, por favor 
avise imediatamente o remetente, respondendo o presente e-mail e apague-o em 
seguida.
This message may contain confidential and/or privileged ...{{dropped:9}}

*
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] calculate power of test

2010-10-19 Thread Dennis Murphy
Hi:

One answer comes from the pwr.r.test() function in package pwr (read its
code to see how it calculates power):

pwr.r.test(n = 100, r = 0.2, sig.level = 0.05, alternative = 'two.sided')
 approximate correlation power calculation (arctangh transformation)

  n = 100
  r = 0.2
  sig.level = 0.05
  power = 0.5142056
alternative = two.sided

If you're looking for the power function, that's another matter entirely :)

HTH,
Dennis


On Mon, Oct 18, 2010 at 11:48 PM, Jumlong Vongprasert 
jumlong.u...@gmail.com wrote:

 Dear All
I want to calculate power of test. I want to test H0: Rho = 0 VS H1: Rho
 != 0.
Assume, I have r=0.2 and sample size = 100.
How I can do this.
 Many Thanks
 Jumlong

 --
 Jumlong Vongprasert Assist, Prof.
 Institute of Research and Development
 Ubon Ratchathani Rajabhat University
 Ubon Ratchathani
 THAILAND
 34000

[[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] Implementing R's recycling rule

2010-10-19 Thread Rainer M Krug
Hi

I want to use R's recycling rule. At the moment I am using the following:


x - c(1, 2, 3)
n - 10
## so using the recycling rules, I would like to get from FUN(x, n)==1
## I am doing:
xRecycled - rep(x, length.out=n)[n]

This works, but it seems to me that I am missing something really basic here
- is there  more straightforward way of doing this?

Cheers,
Rainer

-- 
NEW GERMAN FAX NUMBER!!!

Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:   +27 - (0)83 9479 042
Fax:+27 - (0)86 516 2782
Fax:+49 - (0)321 2125 2244
email:  rai...@krugs.de

Skype:  RMkrug
Google: r.m.k...@gmail.com

[[alternative HTML version deleted]]

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


Re: [R] package vars doesn´t working

2010-10-19 Thread 敷田治誠 クラウジオ
Dear prof. Pfaff,

Your answer just solved my problem. I removed the MASS package and just
reinstalled urca package. Now everything is ok.

Thank you so much for your time and attention.

Claudio


On Tue, Oct 19, 2010 at 5:27 AM, Pfaff, Bernhard Dr. 
bernhard_pf...@fra.invesco.com wrote:

 Dear Claudio,

 hard to tell without further information, but I reckon that you:

 1) have a secondary library in use
 2) have installed the packages 'vars' **and** 'MASS' installed into this
 secondary library

 If so, remove the package 'MASS' from this secondary library (it's shipped
 in the standard library in your R installation already). Hint: check whether
 you have installed other recommended packages into your secondary library
 and if so, remove these, too. Otherwise you migt encounter the same problem
 with packages that do depend on the ones that are already shipped in the
 primary library of your R installation.

 This all is just a guess, because you have not provided enough information
 to diagnose further.

 Best,
 Bernhard

 -Ursprüngliche Nachricht-
 Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im
 Auftrag von Claudio Shikida ( ?)
 Gesendet: Dienstag, 19. Oktober 2010 10:19
 An: r-help@r-project.org
 Betreff: [R] package vars doesn´t working

 Hello,

 I was using R (v.2.11.1, 32 bits) and I did the upgrade to R (v.2.12.0, 64
 bits). I followed the instructions in Rs FAQ (Whats the best way to upgrade,
 question 2.8) and updated my packages. However, now, I cant use the library
 vars. When I call it, there is an error message concerning the package
 MASS which couldnt be updated because it seems to be no more available in
 Rs repositories.

 Is this a problem with vars? Maybe it will have to be updated soon with
 no more need to ask for MASS? Is there another way to invoke vars?

 Thanks for your time and attention

 --
 http://shikida.net  and http://works.bepress.com/claudio_shikida/

 Esta mensagem pode conter informao confidencial e/ou privilegiada. Se voc
 no for o destinatrio ou a pessoa autorizada a receber esta mensagem, no
 poder usar, copiar ou divulgar as informaes nela contidas ou tomar qualquer
 ao baseada nessas informaes. Se voc recebeu esta mensagem por engano, por
 favor avise imediatamente o remetente, respondendo o presente e-mail e
 apague-o em seguida.
 This message may contain confidential and/or privileged ...{{dropped:9}}

 *
 Confidentiality Note: The information contained in this message,
 and any attachments, may contain confidential and/or privileged
 material. It is intended solely for the person(s) or entity to
 which it is addressed. Any review, retransmission, dissemination,
 or taking of any action in reliance upon this information by
 persons or entities other than the intended recipient(s) is
 prohibited. If you received this in error, please contact the
 sender and delete the material from any computer.
 *




-- 
http://shikida.net  and http://works.bepress.com/claudio_shikida/

Esta mensagem pode conter informação confidencial e/ou privilegiada. Se você
não for o destinatário ou a pessoa autorizada a receber esta mensagem, não
poderá usar, copiar ou divulgar as informações nela contidas ou tomar
qualquer ação baseada nessas informações. Se você recebeu esta mensagem por
engano, por favor avise imediatamente o remetente, respondendo o presente
e-mail e apague-o em seguida.
This message may contain confidential and/or privileged ...{{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] Implementing R's recycling rule

2010-10-19 Thread Richard . Cotton
 x - c(1, 2, 3)
 n - 10
 ## so using the recycling rules, I would like to get from FUN(x, n)==1
 ## I am doing:
 xRecycled - rep(x, length.out=n)[n]
 
 This works, but it seems to me that I am missing something really basic 
here
 - is there  more straightforward way of doing this?

x[n %% length(x)] gives you the same answer as rep(x, length.out=n)[n], 
without having to create the longer vector.

Regards,
Richie.

Mathematical Sciences Unit
HSL
4D Pie Charts




ATTENTION:

This message contains privileged and confidential inform...{{dropped:22}}

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


[R] Ideas for World Statistics Day

2010-10-19 Thread Patrick Burns

World Statistics Day is October 20.
This seems like a good excuse to
advertise statistics (and a bit of R)
to a world that could surely use more
thoughtfulness.

Here is a blog post with some ideas:
http://www.portfolioprobe.com/2010/10/19/ideas-for-world-statistics-day/

Additional ideas are certainly welcome.

--
Patrick Burns
pbu...@pburns.seanet.com
http://www.portfolioprobe.com/blog
http://www.burns-stat.com
(home of 'Some hints for the R beginner'
and 'The R Inferno')

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

2010-10-19 Thread Muhammad Rahiz

Hi all,

I'm plotting to get the intersection value of three curves. Defining 
the x-axis as dsm, the following code works;


dsm = c(800,600,NA,525,NA,450,400,NA,NA,NA,0)
s3 = seq(0.05,1.05,0.1)

plot(dsm,s3,col=blue,las=1,ylab=fraction,xlab=distance (km))

fc - function(x,a,b){a*exp(-b*x)}
fm - nls(s3~fc(dsm,a,b),start=c(a=1,b=0))
co - coef(fm)
curve(fc(x,a=co[1],b=co[2]),add=TRUE,col=black,lwd=1)

r - range(dsm,na.rm=TRUE)
n - 1/2.71
val - optimize(f=function(x) abs(fc(x,a=co[1],b=co[2])-n),c(r[1],r[2]))

abline(v=val$minimum,lty=2,col=blue,lwd=1)
abline(h=n,lty=2,col=red,lwd=1)
text(100,0.1,paste(round(val$minimum,2),km,sep= ))

When I flip the axes, i.e. x-axis = s3, and change the nls start up value 
to a=800, the three curves does not intersect.


dsm = c(800,600,NA,525,NA,450,400,NA,NA,NA,0)
s3 = seq(0.05,1.05,0.1)

plot(s3,dsm,col=blue,las=1,xlab=fraction,ylab=distance (km))

fc - function(x,a,b){a*exp(-b*x)}
fm - nls(dsm~fc(s3,a,b),start=c(a=800,b=0))
co - coef(fm)
curve(fc(x,a=co[1],b=co[2]),add=TRUE,col=black,lwd=1)

r - range(dsm,na.rm=TRUE)
n - 1/2.71
val - optimize(f=function(x) abs(fc(x,a=co[1],b=co[2])-n),c(r[1],r[2]))

abline(h=val$minimum,lty=2,col=blue,lwd=1)
abline(v=n,lty=2,col=red,lwd=1)
text(100,0.1,paste(round(val$minimum,2),km,sep= ))

It's merely reversing the axes - the code should work, shouldn't it?
Any suggestions why this happens and how I can correct it?

Thanks.

Muhammad

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

2010-10-19 Thread Rainer M Krug
On Tue, Oct 19, 2010 at 11:30 AM, richard.cot...@hsl.gov.uk wrote:

  x - c(1, 2, 3)
  n - 10
  ## so using the recycling rules, I would like to get from FUN(x, n)==1
  ## I am doing:
  xRecycled - rep(x, length.out=n)[n]
 
  This works, but it seems to me that I am missing something really basic
 here
  - is there  more straightforward way of doing this?

 x[n %% length(x)] gives you the same answer as rep(x, length.out=n)[n],
 without having to create the longer vector.


Thanks a lot - works perfectly and looks much nicer,

Rainer



 Regards,
 Richie.

 Mathematical Sciences Unit
 HSL
 4D Pie Charts



 
 ATTENTION:

 This message contains privileged and confidential information intended
 for the addressee(s) only. If this message was sent to you in error,
 you must not disseminate, copy or take any action in reliance on it and
 we request that you notify the sender immediately by return email.

 Opinions expressed in this message and any attachments are not
 necessarily those held by the Health and Safety Laboratory or any person
 connected with the organisation, save those by whom the opinions were
 expressed.

 Please note that any messages sent or received by the Health and Safety
 Laboratory email system may be monitored and stored in an information
 retrieval system.
 
 Think before you print - do you really need to print this email?
 

 
 Scanned by MailMarshal - Marshal's comprehensive email content security
 solution. Download a free evaluation of MailMarshal at www.marshal.com
 




-- 
NEW GERMAN FAX NUMBER!!!

Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:   +27 - (0)83 9479 042
Fax:+27 - (0)86 516 2782
Fax:+49 - (0)321 2125 2244
email:  rai...@krugs.de

Skype:  RMkrug
Google: r.m.k...@gmail.com

[[alternative HTML version deleted]]

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


Re: [R] Implementing R's recycling rule

2010-10-19 Thread Erich Neuwirth


On 10/19/2010 11:47 AM, Rainer M Krug wrote:
 x[n %% length(x)] gives you the same answer as rep(x, length.out=n)[n],
 without having to create the longer vector.



n %% length(x) may return 0 and in that case,
x[n %% length(x)] will not give the result you expect.

x[((n - 1)  %% length(x)) + 1]
might be what you want.

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

2010-10-19 Thread jim holtman
Is this what you are after:

 date - '2010-10-19'
 as.POSIXct(date)
[1] 2010-10-19 EDT
 milli - 360  # one hour in milliseconds
 as.POSIXct(date) + milli / 1000
[1] 2010-10-19 01:00:00 EDT



On Tue, Oct 19, 2010 at 3:24 AM, statquant2 statqu...@gmail.com wrote:

 Hello all,
 my question for today is the following :

 I have
 1. a date (in a string but straightforward to convert to any format)
 2. the time as the number of milliseconds elapsed since hour 00:00:00.000 of
 this date.

 My question is :
 1. Is there a in built function that can give me the date+time (as POSIX
 object for instance) from what I have ?
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Milliseconds-and-Time-object-tp3001570p3001570.html
 Sent from the R help mailing list archive at Nabble.com.

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




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

What is the problem that you are trying to solve?

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

2010-10-19 Thread Jacob Kasper
I am trying to run an ancova and am having trouble setting it up properly.
I have nearly 10,000 measurements of fish length, girth and stage of sexual
development. I am suspicious that the stage of development is affecting the
length (as they get full of eggs they get more round and are more difficult
to measure and measure shorter).
My data looks somethign like this:

Length

girth

stage

40

50

2

42

48

3

37

40

5

38

38

6

34

44

2

36

45

3

36

39

4

39

42

4

39

39

6

but now I am not quite sure what to do next.

I have tried this: fit-lm(length ~ girth + stage)

summary(fit)

Residuals:
  Min1QMedian3Q   Max
-12.18198  -1.59198  -0.06057   1.50504  17.56265

Coefficients:
   Estimate Std. Error t value Pr(|t|)
(Intercept)24.974310.29956   83.37   2e-16 ***
data$girth  0.246160.00571   43.11   2e-16 ***
data$stage0.673710.02742   24.57   2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.388 on 9864 degrees of freedom
  (1101 observations deleted due to missingness)
Multiple R-squared: 0.1934,Adjusted R-squared: 0.1933
F-statistic:  1183 on 2 and 9864 DF,  p-value:  2.2e-16


but this has not told me anything about where the differences in length that
are attributable to sexual development lie. any suggestions?


Thank you
Jacob

[[alternative HTML version deleted]]

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


[R] Question on ar() in stats

2010-10-19 Thread K Wheel

Hi,
 
I have a question about the ar function in the stats package, it is a method to 
use autoregressive models for time series.
 
Now I have a time series, which I performed a spectral analysis on. This gives 
a spectrum with a quite impressive peak at a certain frequency. The AR1 
function I want to use to statistically test if this peak is significant or if 
it is produced by so called 'red noise'.
 
For me it is not very clear how the ar() function works, even with studying the 
chapter in the R documentation.
 
- Should I for example apply the function on the original series or on the 
spectral analysis data. If I do the last, then how does R know which 
frequencies belong to the spectral densities?
- How can I use the ar coefficient to plot the line of 95% interval?
 
Thank you for your help.  
[[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] points(x,y), mean and standard deviation

2010-10-19 Thread ashz

Hi,

I have a data set with 3 rows (X=date, Y1=arithmetic mean and Y2=standard
deviation). How can I create a graph(e.g., points) which will show the
+-stdev as well (similar to excel).

Thanks 

-- 
View this message in context: 
http://r.789695.n4.nabble.com/points-x-y-mean-and-standard-deviation-tp3001683p3001683.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] For-loop dummy variables?

2010-10-19 Thread Adrian Dusa
On Tuesday 19 October 2010, Phil Spector wrote:
 I always find R useful to solve problems like this:
 
dummy = as.numeric(cleary$D1 %in% c(4,6,7))

Indeed, and this works too:
dummy - 1*(cleary$D1 %in% c(4,6,7))

Adrian 

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

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

2010-10-19 Thread emj83

Hi,

Please can someone tell me if using sample() in R is actually a quick way of
doing the Inverse Transform Sampling Method? 

Many thanks Emma
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Sample-in-R-tp3001818p3001818.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] ANOVA stuffs_How to save each result from FOR command?

2010-10-19 Thread BumSeok Jeong
Dear R experts,

I'm new in R and a beginner in terms of statistics.
It should be simple question, but definitely difficult to solve it by
myself.

I'd like to see main effect of group(gender: sample size is
different(M:F=23:18) and one of condition(cond) and the interaction at each
subset from 90 datasets
So I perform anova 90 times using a command like below;

for(i in 1:90) {results_ezANOVA = ezANOVA(data=subset(ast.ast_coef,
ast.ast_coef$coef_thr==i), dv=.(ast.values), between=.(gender), wid=.(subj),
within=.(cond))}

But I got the last(90th) result, not all.
Here are my questions.

1) Is my command correct?
2) If correct, please let me know if I can get all 90 results.
3) What kind of postHoc would be appropriate?

Thank you,

Jeong

[[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] R 2.12.0 - malware detect by antivirus software

2010-10-19 Thread Paulo Barata


Dr. Murdoch and Dr. Ligges,

After my contacts with Avira, it seems that the issue caused by
their antivirus software (a false positive alarm) has been solved.
Now I have been able to install R 2.12.0 flawlessly.

Thank you.

Paulo Barata



On 17/10/2010 17:53, Duncan Murdoch wrote:

Paulo Barata wrote:

Dear Dr. Murdoch,

My thanks to you and to Dr. Ligges for your replies.

I will do my part and will inform Avira about what happened.
If possible, I will send then the R 2.12.0 installation
file for their examination. As Dr. Ligges said, it is quite
possible indeed that a false positive alarm has happened.

But please allow me to point out that Avira, as far as I know,
is considered to be one of the best pieces of antivirus software
in the market. See, for instance, the AV Comparatives web site at
www.av-comparatives.org. No antivirus software is 100% perfect,
that is, in the real world there is no software with a 0% false
positive rate. Or, looking from the other side, every antivirus
software is sloppy in some way. Considering that fact,
shouldn't the R core team have some definite policy with regard
to false positive alarms concerning the R installation file?
Is this the first time that this happened? Will this be the last
time?


This is by no means the first time, and I doubt it will be the last
time.
I think our policy is listed in the banner that prints when you
start R:

R is free software and comes with ABSOLUTELY NO WARRANTY.

If you want a stronger warranty, you could try looking at commercial
software (or commercial builds of R), but I doubt you'll get one
that's worth very much.

Duncan Murdoch


Best regards,

Paulo Barata



On 17/10/2010 17:10, Duncan Murdoch wrote:

Uwe Ligges wrote:

I checked with two online services which ran more than 40
different virus scanners on the file and only Avira gave a
warning. Hence I assume it is a false positive with Avira and you
can go on with the installation.

@ Duncan as the maintainer for the binary setup installer: It
might make sense to report the false positive to Avira in order to
protect ourselves from dozens of messages on this list tomorrow.
Additionally, you may want to add a note on the CRAN download page.


I don't think so. False positives from sloppy virus checkers are too
common. Paulo may want to help out Avira by pointing out their
error, but I won't.

Duncan Murdoch


Best wishes,
Uwe Ligges

On 17.10.2010 20:18, Paulo Barata wrote:

Dear R-list members,

I have just downloaded R 2.12.0 for Windows. When installing,
my antivirus software detected some malware during the
installation process.

I use Windows XP SP3. My antivirus software is Avira Premium
Security Suite, product version 10.0.0.542 (19/4/2010),
search engine 8.02.04.82 (14/10/2010), virus definition file
7.10.12.231 (17/10/2010). That software said: Malware found.
When I clicked in details, I found this information: object:
open.exe; Detection: TR/ATRAPS.Gen. Consulting the Avira web
site, this is indicated as a Trojan, dated 15 May 2008.

I have repeated the installation process twice, always with
the same malware detection. When installing, I used the English
language, I ticked the Technical Manuals, PDF help pages
and docs for Packages grid and Matrix, and I used the
default options.

Should I proceed with the installation of that version of R?

Thank you very much.

Paulo Barata

--
Paulo Barata
Fundacao Oswaldo Cruz - Oswaldo Cruz Foundation
Rua Leopoldo Bulhoes 1480 - 8A
21041-210 Rio de Janeiro - RJ
Brazil

E-mail: pbar...@infolink.com.br
Alternative e-mail: paulo.bar...@ensp.fiocruz.br

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] ANOVA stuffs_How to save each result from FOR command?

2010-10-19 Thread jim holtman
Here is how you can get the results back in a list that you can then analyze:

results_ezANOVA - list()
for(i in 1:90) {
results_ezANOVA[[i]] -  ezANOVA(data=subset(ast.ast_coef,
ast.ast_coef$coef_thr==i), dv=.(ast.values),
between=.(gender), wid=.(subj),
within=.(cond))
}

On Tue, Oct 19, 2010 at 6:16 AM, BumSeok Jeong bumseok.je...@gmail.com wrote:
 Dear R experts,

 I'm new in R and a beginner in terms of statistics.
 It should be simple question, but definitely difficult to solve it by
 myself.

 I'd like to see main effect of group(gender: sample size is
 different(M:F=23:18) and one of condition(cond) and the interaction at each
 subset from 90 datasets
 So I perform anova 90 times using a command like below;

 for(i in 1:90) {results_ezANOVA = ezANOVA(data=subset(ast.ast_coef,
 ast.ast_coef$coef_thr==i), dv=.(ast.values), between=.(gender), wid=.(subj),
 within=.(cond))}

 But I got the last(90th) result, not all.
 Here are my questions.

 1) Is my command correct?
 2) If correct, please let me know if I can get all 90 results.
 3) What kind of postHoc would be appropriate?

 Thank you,

 Jeong

        [[alternative HTML version deleted]]

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




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

What is the problem that you are trying to solve?

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

2010-10-19 Thread Jacob Kasper
I am trying to run an ancova and am having trouble setting it up properly.
I have nearly 10,000 measurements of fish length, girth and stage of sexual
development. I am suspicious that the stage of development is affecting the
length (as they get full of eggs they get more round and are more difficult
to measure and measure shorter).
My data looks somethign like this:

Length

girth

stage

40

50

2

42

48

3

37

40

5

38

38

6

34

44

2

36

45

3

36

39

4

39

42

4

39

39

6

but now I am not quite sure what to do next.

I have tried this: fit-lm(length ~ girth + stage)

summary(fit)

Residuals:
  Min1QMedian3Q   Max
-12.18198  -1.59198  -0.06057   1.50504  17.56265

Coefficients:
   Estimate Std. Error t value Pr(|t|)
(Intercept)24.974310.29956   83.37   2e-16 ***
data$girth  0.246160.00571   43.11   2e-16 ***
data$stage0.673710.02742   24.57   2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.388 on 9864 degrees of freedom
  (1101 observations deleted due to missingness)
Multiple R-squared: 0.1934,Adjusted R-squared: 0.1933
F-statistic:  1183 on 2 and 9864 DF,  p-value:  2.2e-16


but this has not told me anything about where the differences in length that
are attributable to sexual development lie. any suggestions?


Thank you
Jacob

[[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 read only ten rows from a SAS dataset (read.ssd)?

2010-10-19 Thread johannes rara
I'm trying to read SAS datasets on Windows:

sashome - C:/Program Files/SAS/SAS 9.1
fold - C:/temp
g - read.ssd(fold, sasfile, sascmd = file.path(sashome, sas.exe))

How to get only e.g first ten rows into R?

-J

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


Re: [R] R 2.12.0 - malware detect by antivirus software

2010-10-19 Thread Duncan Murdoch

Paulo Barata wrote:

Dr. Murdoch and Dr. Ligges,

After my contacts with Avira, it seems that the issue caused by
their antivirus software (a false positive alarm) has been solved.
Now I have been able to install R 2.12.0 flawlessly.
  


Thanks for following up on this.

Duncan Murdoch

Thank you.

Paulo Barata



On 17/10/2010 17:53, Duncan Murdoch wrote:
  

Paulo Barata wrote:


Dear Dr. Murdoch,

My thanks to you and to Dr. Ligges for your replies.

I will do my part and will inform Avira about what happened.
If possible, I will send then the R 2.12.0 installation
file for their examination. As Dr. Ligges said, it is quite
possible indeed that a false positive alarm has happened.

But please allow me to point out that Avira, as far as I know,
is considered to be one of the best pieces of antivirus software
in the market. See, for instance, the AV Comparatives web site at
www.av-comparatives.org. No antivirus software is 100% perfect,
that is, in the real world there is no software with a 0% false
positive rate. Or, looking from the other side, every antivirus
software is sloppy in some way. Considering that fact,
shouldn't the R core team have some definite policy with regard
to false positive alarms concerning the R installation file?
Is this the first time that this happened? Will this be the last
time?
  

This is by no means the first time, and I doubt it will be the last
time.
I think our policy is listed in the banner that prints when you
start R:

R is free software and comes with ABSOLUTELY NO WARRANTY.

If you want a stronger warranty, you could try looking at commercial
software (or commercial builds of R), but I doubt you'll get one
that's worth very much.

Duncan Murdoch



Best regards,

Paulo Barata



On 17/10/2010 17:10, Duncan Murdoch wrote:
  

Uwe Ligges wrote:


I checked with two online services which ran more than 40
different virus scanners on the file and only Avira gave a
warning. Hence I assume it is a false positive with Avira and you
can go on with the installation.

@ Duncan as the maintainer for the binary setup installer: It
might make sense to report the false positive to Avira in order to
protect ourselves from dozens of messages on this list tomorrow.
Additionally, you may want to add a note on the CRAN download page.

  

I don't think so. False positives from sloppy virus checkers are too
common. Paulo may want to help out Avira by pointing out their
error, but I won't.

Duncan Murdoch



Best wishes,
Uwe Ligges

On 17.10.2010 20:18, Paulo Barata wrote:
  

Dear R-list members,

I have just downloaded R 2.12.0 for Windows. When installing,
my antivirus software detected some malware during the
installation process.

I use Windows XP SP3. My antivirus software is Avira Premium
Security Suite, product version 10.0.0.542 (19/4/2010),
search engine 8.02.04.82 (14/10/2010), virus definition file
7.10.12.231 (17/10/2010). That software said: Malware found.
When I clicked in details, I found this information: object:
open.exe; Detection: TR/ATRAPS.Gen. Consulting the Avira web
site, this is indicated as a Trojan, dated 15 May 2008.

I have repeated the installation process twice, always with
the same malware detection. When installing, I used the English
language, I ticked the Technical Manuals, PDF help pages
and docs for Packages grid and Matrix, and I used the
default options.

Should I proceed with the installation of that version of R?

Thank you very much.

Paulo Barata

--
Paulo Barata
Fundacao Oswaldo Cruz - Oswaldo Cruz Foundation
Rua Leopoldo Bulhoes 1480 - 8A
21041-210 Rio de Janeiro - RJ
Brazil

E-mail: pbar...@infolink.com.br
Alternative e-mail: paulo.bar...@ensp.fiocruz.br

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 2.12] install.packages() with no lib argument does not work

2010-10-19 Thread vincent chouraki
Dear R users,

I have just upgraded R from 2.11 to 2.12 on Ubuntu 9.04 (see more informations 
at the end) from the cran apt-get repository. One of the new things concerning 
the install.packages() function is stated here :


install.packages() and remove.packages() with lib unspecified and   
multiple 
libraries in .libPaths() inform the user of the library   location used 
with 
a message rather than a warning.

I am in this case where .libPaths() has multiple libraries:

 .libPaths()
[1] /home/username/R/x86_64-pc-linux-gnu-library/2.12
[2] /usr/local/lib/R/site-library
[3] /usr/lib/R/site-library  
[4] /usr/lib/R/library   
[5] /usr/lib64/R/library  
and install.packages() gives me an error when lib is not given:

 install.packages(lattice)
Erreur dans sprintf(gettext(fmt, domain = domain), ...) : 
  format incorrect '%
(ca' ; utilisez le format %s pour les objets caractères

 install.packages(toto)
Erreur dans sprintf(gettext(fmt, domain = domain), ...) : 
  format incorrect '%
(ca' ; utilisez le format %s pour les objets caractères


 whatever package name is given.

For the time being, I am using :

 install.packages(lattice, )

and it works fine.

Is this the new way of using the install.packages() function or an error?

Best regards,

 sessionInfo()
R version 2.12.0 (2010-10-15)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=fr_FR.UTF-8   LC_NUMERIC=C  
 [3] LC_TIME=fr_FR.UTF-8LC_COLLATE=fr_FR.UTF-8
 [5] LC_MONETARY=C  LC_MESSAGES=fr_FR.UTF-8   
 [7] LC_PAPER=fr_FR.UTF-8   LC_NAME=C 
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C   

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

other attached packages:
[1] fortunes_1.4-0

usern...@computer:~$ uname -a
Linux computer 2.6.28-19-generic #65-Ubuntu SMP Thu Sep 16 14:24:42 UTC 2010 
x86_64 GNU/Linux
usern...@computer:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.04
DISTRIB_CODENAME=jaunty
DISTRIB_DESCRIPTION=Ubuntu 9.04



Dr Vincent Chouraki
Assistant hospitalier universitaire
Service d'épidémiologie régional
CHRU de Lille, France


  
[[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] readLines: how to make a data.frame?

2010-10-19 Thread johannes rara
I have a text file containing data:

Som text
::
asdf
@  1  ds  $  5. /*Edmp  */
@  8  asu  $  3. /*daf*/
@  8  asdala  $  2. /*asdfa*/
@  13  astun  $  11. /*daf */
@  26  dft  $  3. /*asdf */
@  31  dsfp  $  2. /*asdf  */
asjk
asdfö

My intention is to create a dataframe from this data (only rows
starting @ and not containng string asdf). I tried to read this data
using this code:

g - readLines(temp.txt)
g - grep(^@, g, value=T)
g - gsub([@|$|\\.|/*], , g)

How to put this data into a data.frame?

-J

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


Re: [R] Milliseconds and Time object

2010-10-19 Thread peter dalgaard

On Oct 19, 2010, at 12:12 , jim holtman wrote:

 Is this what you are after:
 
 date - '2010-10-19'
 as.POSIXct(date)
 [1] 2010-10-19 EDT
 milli - 360  # one hour in milliseconds
 as.POSIXct(date) + milli / 1000
 [1] 2010-10-19 01:00:00 EDT
 
 

Beware timezone and DST issues though. It might be safer to standardize on GMT 
(just add tz=GMT to the as.POSIXct() call.)


-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.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 2.12] install.packages() with no lib argument does not work

2010-10-19 Thread Prof Brian Ripley
Looks like this may be a problem in the French translations.  Please 
try with LANGUAGE=en.


On Tue, 19 Oct 2010, vincent chouraki wrote:


Dear R users,

I have just upgraded R from 2.11 to 2.12 on Ubuntu 9.04 (see more informations
at the end) from the cran apt-get repository. One of the new things concerning
the install.packages() function is stated here :


install.packages() and remove.packages() with lib unspecified and   multiple
libraries in .libPaths() inform the user of the library   location used with
a message rather than a warning.

I am in this case where .libPaths() has multiple libraries:


.libPaths()

[1] /home/username/R/x86_64-pc-linux-gnu-library/2.12
[2] /usr/local/lib/R/site-library
[3] /usr/lib/R/site-library
[4] /usr/lib/R/library
[5] /usr/lib64/R/library
and install.packages() gives me an error when lib is not given:


install.packages(lattice)

Erreur dans sprintf(gettext(fmt, domain = domain), ...) :
 format incorrect '%
(ca' ; utilisez le format %s pour les objets caract?res


install.packages(toto)

Erreur dans sprintf(gettext(fmt, domain = domain), ...) :
 format incorrect '%
(ca' ; utilisez le format %s pour les objets caract?res


whatever package name is given.

For the time being, I am using :


install.packages(lattice, )


and it works fine.

Is this the new way of using the install.packages() function or an error?

Best regards,


sessionInfo()

R version 2.12.0 (2010-10-15)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
[1] LC_CTYPE=fr_FR.UTF-8   LC_NUMERIC=C
[3] LC_TIME=fr_FR.UTF-8LC_COLLATE=fr_FR.UTF-8
[5] LC_MONETARY=C  LC_MESSAGES=fr_FR.UTF-8
[7] LC_PAPER=fr_FR.UTF-8   LC_NAME=C
[9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] fortunes_1.4-0

usern...@computer:~$ uname -a
Linux computer 2.6.28-19-generic #65-Ubuntu SMP Thu Sep 16 14:24:42 UTC 2010
x86_64 GNU/Linux
usern...@computer:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.04
DISTRIB_CODENAME=jaunty
DISTRIB_DESCRIPTION=Ubuntu 9.04



Dr Vincent Chouraki
Assistant hospitalier universitaire
Service d'?pid?miologie r?gional
CHRU de Lille, France



[[alternative HTML version deleted]]




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, 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] points(x,y), mean and standard deviation

2010-10-19 Thread Jim Lemon

On 10/19/2010 07:41 PM, ashz wrote:


Hi,

I have a data set with 3 rows (X=date, Y1=arithmetic mean and Y2=standard
deviation). How can I create a graph(e.g., points) which will show the
+-stdev as well (similar to excel).


Hi ashz,
See FAQ 7.38.

Jim

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


Re: [R] Lattice: type=p stopped working in panel.average

2010-10-19 Thread Deepayan Sarkar
On Tue, Oct 19, 2010 at 4:18 PM, Alexandr Malusek
alexandr.malu...@gmail.com wrote:
 Hi,

 The behavior of panel.average has changed.  In March 2010, I plotted
 the attached r_plotViolinOfAnnualE_old.eps. (I don't know the version
 of R). Today, I plotted the attached r_plotViolinOfAnnualE_new.eps
 using R version 2.12.0 (2010-10-15). Both figures were produced via
 the same script:

 ...
 plot - bwplot(year ~ Eann, data=df, horizontal = T,
  xlab = E / mSv,
  ylab = year,
  box.ratio = 1.5,
  panel=function(...) {
    panel.grid(h=0, v=-1)
    panel.average(fun=max, type=p, pch=3, col=black, ...)
    panel.violin(adjust=0.3, kernel=gaussian, ...)
    panel.average(fun=min, type=p, pch=3, col=black, ...)
    panel.average(fun=mean, type=p, pch=20, col=black, ...)
    panel.average(fun=median, type=p, pch=0, col=black, ...)
  }
 )
 ...

 The old version of R plotted points as defined by type=p, the new
 version plotted lines. I don't know whether it is a bug or a new
 feature. Anyway, is there an easy way of getting the old result with
 the new version of R?

The change happened in Dec 2009, probably to prevent unintended
capturing of 'type' (panel.average is an alias for panel.linejoin,
which indicates that the original intention was to draw lines).

In hindsight, this was probably not the best choice. However, you can
get the same effect fairly easily with

mypanel.average - function(x, y, FUN = mean, ...)
{
   panel.points(aggregate(as.numeric(y) ~ x, data = environment(), FUN
= FUN), ...)
}

-Deepayan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] ANOVA stuffs_How to save each result from FOR command?

2010-10-19 Thread Liviu Andronic
Hello

On Tue, Oct 19, 2010 at 12:16 PM, BumSeok Jeong bumseok.je...@gmail.com wrote:
 Dear R experts,

 I'm new in R and a beginner in terms of statistics.
 It should be simple question, but definitely difficult to solve it by
 myself.

 I'd like to see main effect of group(gender: sample size is
 different(M:F=23:18) and one of condition(cond) and the interaction at each
 subset from 90 datasets
 So I perform anova 90 times using a command like below;

 for(i in 1:90) {results_ezANOVA = ezANOVA(data=subset(ast.ast_coef,
 ast.ast_coef$coef_thr==i), dv=.(ast.values), between=.(gender), wid=.(subj),
 within=.(cond))}

 But I got the last(90th) result, not all.
 Here are my questions.

 1) Is my command correct?
 2) If correct, please let me know if I can get all 90 results.

You may want to investigate the apply family of functions [1]. These
can do what loops do, but they can automatically store the results in
a list for you. Regards
Liviu

[1] http://cran.r-project.org/doc/Rnews/Rnews_2008-1.pdf


 3) What kind of postHoc would be appropriate?

 Thank you,

 Jeong

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




-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Tif image to 8bit colour matrix.

2010-10-19 Thread Roger Gill
Dear listers,

I have a collection of tif images that I would like to convert, in R, to a 
matrix containing the values of the 8bit colour. Ideally, I would like a matrix 
for each of the colour channels (red, blue and green). I have 'googled' and 
searched the help list but have yet to find a solution and hope that someone 
can 
point me in the right direction.

I currently use subscription software (Igor) for the conversion and would 
prefer 
to use R.

Best wishes,

Roger





__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Part time equity tick data high frequency trading research

2010-10-19 Thread aquatrade

Hi,

There seems to be no subsection for work related postings, so please excuse
me if this is in the wrong place.

I am looking for an English speaking person with very strong R  Language,
statistics and some financial math knowledge to do statistical research into
USA stock tick data.

You are probably have a hard sciences background requiring heavy statistical
and maths knowledge and have an interest in stock markets (e.g. you know
what a bid and ask is for a stock quote).  Probably have a  Masters or Phd
degree.

I am an experienced trader, who is researching some high frequency strategy
ideas and need someone who can work part-time for 4 months to help with the
research.  While I have the tick data and understanding of what to do, it
takes me too long as I am a developer by trade as opposed to a maths/stats
expert.

You should have an interest in stocks, so that you have a basic
understanding of market structure and quotes.   Must speak very good English
and have access to a reliable internet connection and Skype.  I do not care
which country you are located in.

You will be dealing with tick data sets with rows in the millions.

Skill Set:
  R Language (strong)
  Statistics
  Mathematics
  Financial Maths (time series analysis, co-variance, GARCH, etc)
  Java (basic level)

Please include a resume and summary of why you would enjoy doing this.

Please indicate your monthly rate for 80+ hours per month for 4 months.  I
am paying for this out of my own pocket, so am very price sensitive…which is
why I am going offshore.   There is the potential for extending this longer
term.

This is a great opportunity for someone to learn about high frequency tick
data research and make a little money as well.

Please contact me directly at aquatrade...@gmail.com.

Thank you for reading and apologies if posted in the wrong area.

Thanks,
Chris



-- 
View this message in context: 
http://r.789695.n4.nabble.com/Part-time-equity-tick-data-high-frequency-trading-research-tp3001428p3001428.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Question of Quantile Regression for Longitudinal Data

2010-10-19 Thread ywh123

Thanks for your help 
RKoenker

I want to deal with the problem through  bootstrap.so I can get p-value and
T-statistics.
Do you think so?
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Question-of-Quantile-Regression-for-Longitudinal-Data-tp883458p3001875.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Problems with a specific calculate.

2010-10-19 Thread Toni López Mayol
Hello friends of R, 

My name is Toni, i'm 25 and I'm working on the Meteorological Investigation 
team from Balearic Islands.

I had contact to you because I have a problem:

I done a file for every day since 1912 about precipitation. That file has the 
following structure:

 str(Ast)
Loading required package: sp
Formal class 'SpatialPixelsDataFrame' [package sp] with 7 slots
  ..@ data   :'data.frame': 499105 obs. of  2 variables:
  .. ..$ PRECIP.pred: num [1:499105] 0.000536 0.000536 0.000536 0.000536 
0.000536 ...
  .. ..$ PRECIP.var : num [1:499105] 1.90e-05 1.90e-05 1.90e-05 1.90e-05 
1.90e-05 ...
  ..@ coords.nrs : num(0) 
  ..@ grid   :Formal class 'GridTopology' [package sp] with 3 slots
  .. .. ..@ cellcentre.offset: Named num [1:2] 345 4278
  .. .. .. ..- attr(*, names)= chr [1:2] x y
  .. .. ..@ cellsize : Named num [1:2] 0.1 0.1
  .. .. .. ..- attr(*, names)= chr [1:2] x y
  .. .. ..@ cells.dim: Named int [1:2] 2684 1600
  .. .. .. ..- attr(*, names)= chr [1:2] x y
  ..@ grid.index : int [1:499105] 2468192 2468193 2468194 2468195 2465507 
2465508 2465509 2465510 2465511 2465512 ...
  ..@ coords : num [1:499105, 1:2] 505 505 505 505 505 ...
  .. ..- attr(*, dimnames)=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:2] x y
  ..@ bbox   : num [1:2, 1:2] 345 4278 614 4438
  .. ..- attr(*, dimnames)=List of 2
  .. .. ..$ : chr [1:2] x y
  .. .. ..$ : chr [1:2] min max
  ..@ proj4string:Formal class 'CRS' [package sp] with 1 slots
  .. .. ..@ projargs: chr +proj=utm +zone=31 +units=km

This is a single file for one specific day. 

Now, I must to sum the precipitation of every day from every file like this.

I must to do the annual precipitation for every year.

How can I take the precipitation ( PRECIP.pred) of every day and sum it with 
all at same time? maybe a loop?

Thanks so much for your time.

Toni
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] points( .... pch=2) substitue pch with image

2010-10-19 Thread Knut Krueger

 Hi to all,
is there any function where I can substitute the characters with an 
(jpg) image ?


Kind regards
Knut

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 : [R 2.12] install.packages() with no lib argument does not work

2010-10-19 Thread vincent chouraki
It seems indeed that it is a locale issue :

 Sys.getlocale()
[1] 
LC_CTYPE=fr_FR.UTF-8;LC_NUMERIC=C;LC_TIME=fr_FR.UTF-8;LC_COLLATE=fr_FR.UTF-8;LC_MONETARY=C;LC_MESSAGES=fr_FR.UTF-8;LC_PAPER=fr_FR.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=fr_FR.UTF-8;LC_IDENTIFICATION=C


 install.packages(toto)
Erreur dans sprintf(gettext(fmt, domain = domain), ...) : 
  format incorrect '%
(ca' ; utilisez le format %s pour les objets caractères

 Sys.setlocale(LC_MESSAGES,C)
[1] C

 install.packages(toto)
Installing package(s) into 
‘/home/username/R/x86_64-pc-linux-gnu-library/2.12’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
  package ‘toto’ is not available

Many thanks for the hint!


 

Dr Vincent Chouraki
Assistant hospitalier universitaire
Service d'épidémiologie régional
CHRU de Lille, France






De : Prof Brian Ripley rip...@stats.ox.ac.uk

Cc : R-help r-help@r-project.org
Envoyé le : Mar 19 octobre 2010, 13h 47min 58s
Objet : Re: [R] [R 2.12] install.packages() with no lib argument does not work

Looks like this may be a problem in the French translations.  Please 
try with LANGUAGE=en.

On Tue, 19 Oct 2010, vincent chouraki wrote:

 Dear R users,

 I have just upgraded R from 2.11 to 2.12 on Ubuntu 9.04 (see more informations
 at the end) from the cran apt-get repository. One of the new things concerning
 the install.packages() function is stated here :


 install.packages() and remove.packages() with lib unspecified and   
multiple
 libraries in .libPaths() inform the user of the library   location used 
with
 a message rather than a warning.

 I am in this case where .libPaths() has multiple libraries:

 .libPaths()
 [1] /home/username/R/x86_64-pc-linux-gnu-library/2.12
 [2] /usr/local/lib/R/site-library
 [3] /usr/lib/R/site-library
 [4] /usr/lib/R/library
 [5] /usr/lib64/R/library
 and install.packages() gives me an error when lib is not given:

 install.packages(lattice)
 Erreur dans sprintf(gettext(fmt, domain = domain), ...) :
  format incorrect '%
 (ca' ; utilisez le format %s pour les objets caract?res

 install.packages(toto)
 Erreur dans sprintf(gettext(fmt, domain = domain), ...) :
  format incorrect '%
 (ca' ; utilisez le format %s pour les objets caract?res


 whatever package name is given.

 For the time being, I am using :

 install.packages(lattice, )

 and it works fine.

 Is this the new way of using the install.packages() function or an error?

 Best regards,

 sessionInfo()
 R version 2.12.0 (2010-10-15)
 Platform: x86_64-pc-linux-gnu (64-bit)

 locale:
 [1] LC_CTYPE=fr_FR.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=fr_FR.UTF-8LC_COLLATE=fr_FR.UTF-8
 [5] LC_MONETARY=C  LC_MESSAGES=fr_FR.UTF-8
 [7] LC_PAPER=fr_FR.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
 [11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C

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

 other attached packages:
 [1] fortunes_1.4-0

 usern...@computer:~$ uname -a
 Linux computer 2.6.28-19-generic #65-Ubuntu SMP Thu Sep 16 14:24:42 UTC 2010
 x86_64 GNU/Linux
 usern...@computer:~$ cat /etc/lsb-release
 DISTRIB_ID=Ubuntu
 DISTRIB_RELEASE=9.04
 DISTRIB_CODENAME=jaunty
 DISTRIB_DESCRIPTION=Ubuntu 9.04


 
 Dr Vincent Chouraki
 Assistant hospitalier universitaire
 Service d'?pid?miologie r?gional
 CHRU de Lille, France



 [[alternative HTML version deleted]]



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



  
[[alternative HTML version deleted]]

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


Re: [R] Tif image to 8bit colour matrix.

2010-10-19 Thread Michael Sumner
This requires the rgdal and sp packages to be installed, and assumes a
3-bandfile called image.tif

## (untested)
library(rgdal)
x - readGDAL(image.tif)

## first band
red - as.image.SpatialGridDataFrame(x[1])$z
## second
green - as.image.SpatialGridDataFrame(x[2])$z
## third
 blue - as.image.SpatialGridDataFrame(x[3])$z

The 1,2,3 indexing is syntax for this SpatialGridDataFrame with just these
bands, so that sp:::image.SpatialGridDataFrame can convert simply to the
list x/y/z format for image().

HTH



On Tue, Oct 19, 2010 at 10:59 PM, Roger Gill roger.gill1...@yahoo.co.ukwrote:

 Dear listers,

 I have a collection of tif images that I would like to convert, in R, to a
 matrix containing the values of the 8bit colour. Ideally, I would like a
 matrix
 for each of the colour channels (red, blue and green). I have 'googled' and
 searched the help list but have yet to find a solution and hope that
 someone can
 point me in the right direction.

 I currently use subscription software (Igor) for the conversion and would
 prefer
 to use R.

 Best wishes,

 Roger





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




-- 
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsum...@gmail.com

[[alternative HTML version deleted]]

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


Re: [R] nls optimize

2010-10-19 Thread Ravi Varadhan
You can do this.  

dsm = c(800,600,NA,525,NA,450,400,NA,NA,NA,0)
s3 = seq(0.05,1.05,0.1)

plot(s3,dsm,col=blue,las=1,xlab=fraction,ylab=distance (km))

fc - function(x,a,b){a*exp(-b*x)}
fm - nls(dsm~fc(s3,a,b),start=c(a=800,b=0))
co - coef(fm)
curve(fc(x,a=co[1],b=co[2]),add=TRUE,col=black,lwd=1)

r - range(s3,na.rm=TRUE)  # range should be changed
n.dsm - fc(1/2.71, co[1], co[2])  # calculate a different intersection
val - optimize(f=function(x) abs(fc(x,a=co[1],b=co[2])-n.dsm),c(r[1],r[2]))

abline(h=n.dsm,lty=2,col=blue,lwd=1)
abline(v=n,lty=2,col=red,lwd=1)
text(0.1, 500, paste(round(n.dsm,2),km,sep= )) # text should be placed
at different location

However, note that you do not need `optimize'.  The answer that you are
seeking is `n.dsm', which is obtained directly from the nls fit.

Ravi.

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Muhammad Rahiz
Sent: Tuesday, October 19, 2010 5:45 AM
To: x.r-help
Subject: [R] nls  optimize

Hi all,

I'm plotting to get the intersection value of three curves. Defining 
the x-axis as dsm, the following code works;

dsm = c(800,600,NA,525,NA,450,400,NA,NA,NA,0)
s3 = seq(0.05,1.05,0.1)

plot(dsm,s3,col=blue,las=1,ylab=fraction,xlab=distance (km))

fc - function(x,a,b){a*exp(-b*x)}
fm - nls(s3~fc(dsm,a,b),start=c(a=1,b=0))
co - coef(fm)
curve(fc(x,a=co[1],b=co[2]),add=TRUE,col=black,lwd=1)

r - range(dsm,na.rm=TRUE)
n - 1/2.71
val - optimize(f=function(x) abs(fc(x,a=co[1],b=co[2])-n),c(r[1],r[2]))

abline(v=val$minimum,lty=2,col=blue,lwd=1)
abline(h=n,lty=2,col=red,lwd=1)
text(100,0.1,paste(round(val$minimum,2),km,sep= ))

When I flip the axes, i.e. x-axis = s3, and change the nls start up value 
to a=800, the three curves does not intersect.

dsm = c(800,600,NA,525,NA,450,400,NA,NA,NA,0)
s3 = seq(0.05,1.05,0.1)

plot(s3,dsm,col=blue,las=1,xlab=fraction,ylab=distance (km))

fc - function(x,a,b){a*exp(-b*x)}
fm - nls(dsm~fc(s3,a,b),start=c(a=800,b=0))
co - coef(fm)
curve(fc(x,a=co[1],b=co[2]),add=TRUE,col=black,lwd=1)

r - range(dsm,na.rm=TRUE)
n - 1/2.71
val - optimize(f=function(x) abs(fc(x,a=co[1],b=co[2])-n),c(r[1],r[2]))

abline(h=val$minimum,lty=2,col=blue,lwd=1)
abline(v=n,lty=2,col=red,lwd=1)
text(100,0.1,paste(round(val$minimum,2),km,sep= ))

It's merely reversing the axes - the code should work, shouldn't it?
Any suggestions why this happens and how I can correct it?

Thanks.

Muhammad

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 read only ten rows from a SAS dataset (read.ssd)?

2010-10-19 Thread David Winsemius


On Oct 19, 2010, at 6:47 AM, johannes rara wrote:


I'm trying to read SAS datasets on Windows:

sashome - C:/Program Files/SAS/SAS 9.1
fold - C:/temp
g - read.ssd(fold, sasfile, sascmd = file.path(sashome, sas.exe))


And this was successful?



How to get only e.g first ten rows into R?


Presumably you also entered require(foreign) if you had success.  
Looking at the help page, we see no parameter that would effect such a  
result. So just type:


read.ssd

You see that this function's code is available and if you know SAS,  
you should be able to insert the needed line that would limit the  
dataset length to only ten lines. I'm not being coy. I would probably  
had further suggestions 20 years ago when I was using SAS.


There is a function sas.get in package Hmisc that offers more  
extensive control, but it is not clear to me on looking at the  
parameters whether your particular request would be easily  
accommodated. The ifs= parameter would appear to be the most promising  
candidate to me. It appears that these file formats are accepted:

sasds.suffix - c(sd2, sd7, ssd01, ssd02, ssd03,
ssd04, sas7bdat)


Also, since the use of read.ssd implies that you have a working copy  
of SAS, then another option is simply exporting a file in the format  
of your choice? The SAS XPT format seems to be well handled by  
external programs.



--
David.


-J

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


David Winsemius, MD
West Hartford, CT

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


Re: [R] readLines: how to make a data.frame?

2010-10-19 Thread David Winsemius


On Oct 19, 2010, at 7:27 AM, johannes rara wrote:


I have a text file containing data:

Som text
::
asdf
@  1  ds  $  5. /*Edmp  */
@  8  asu  $  3. /*daf*/
@  8  asdala  $  2. /*asdfa*/
@  13  astun  $  11. /*daf */
@  26  dft  $  3. /*asdf */
@  31  dsfp  $  2. /*asdf  */
asjk
asdfö

My intention is to create a dataframe from this data (only rows
starting @ and not containng string asdf). I tried to read this data
using this code:

g - readLines(temp.txt)
g - grep(^@, g, value=T)
g - gsub([@|$|\\.|/*], , g)

How to put this data into a data.frame?


 read.table(textConnection(g))
  V1 V2 V3V4
1  1 ds  5  Edmp
2  8asu  3   daf
3  8 asdala  2 asdfa
4 13  astun 11   daf
5 26dft  3  asdf
6 31   dsfp  2  asdf

So it looks like you needed to work on your regex pattern selection  
strategy, but at least the conversion to data.frame is now clear.


Perhaps:
 read.table(textConnection(g[-grep(asdf,g)]))
  V1V2 V3   V4
1  1ds  5 Edmp
2  8   asu  3  daf
3 13 astun 11  daf




-J

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


David Winsemius, MD
West Hartford, CT

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


[R] Error: object 'short' not found

2010-10-19 Thread Viki S

Hi guys,
Can anyone tell me what is the meaning of following command ?

paste(execDir,paste(short,myfile,sep=_),sep=\)

R gives me an error : 

Error: object 'short' not found

I tried to find help about 'short' in R, but could not find any such function/ 
object. 

Viki
  
[[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] Part time equity tick data high frequency trading research

2010-10-19 Thread aquatrade

Hi,

There seems to be no subsection for work related postings, so please excuse
me if this is in the wrong place.

I am looking for an English speaking person with very strong R  Language,
statistics and some financial math knowledge to do statistical research into
USA stock tick data.

You probably have a hard sciences background requiring heavy statistical and
maths knowledge and have an interest in stock markets (e.g. you know what a
bid and ask is for a stock quote).  Probably have a  Masters or Phd degree.

I am an experienced trader, who is researching some high frequency strategy
ideas and need someone who can work part-time for 4 months to help with the
research.  While I have the tick data and understanding of what to do, it
takes me far too long as I am not a maths/stats expert.

You should have an interest in stocks, so that you have a basic
understanding of market structure and quotes.   Must speak very good English
and have access to a reliable internet connection and Skype.  I do not care
which country you are located in.

You will be dealing with tick data sets with rows in the millions.

Skill Set:
  R Language (strong)
  Statistics
  Mathematics
  Financial Maths (time series analysis, co-variance, GARCH, etc)
  Java (basic level)

Please include a resume and summary of why you would enjoy doing this.

Please indicate your monthly rate for 80+ hours per month for 4 months.  I
am paying for this out of my own pocket, so am very price sensitive…which is
why I am going offshore.   There is the potential for extending this longer
term.

This is a great opportunity for someone to learn about high frequency tick
data research and make a little money as well.

Please contact me directly at aquatrade...@gmail.com.

Thank you for reading and apologies if posted in the wrong area.

Thanks,
Chris





-- 
View this message in context: 
http://r.789695.n4.nabble.com/Part-time-equity-tick-data-high-frequency-trading-research-tp3002167p3002167.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Error: object 'short' not found

2010-10-19 Thread David Winsemius


On Oct 19, 2010, at 10:03 AM, Viki S wrote:



Hi guys,
Can anyone tell me what is the meaning of following command ?

paste(execDir,paste(short,myfile,sep=_),sep=\)

R gives me an error :

Error: object 'short' not found

I tried to find help about 'short' in R, but could not find any such  
function/ object.


You are the one who is asking R to find a value for an object named  
short.


paste(execDir,paste(short,myfile,sep=_),sep=\)
^

Since you are posting in HTML, it is also possible that your mail  
client is going to display this in a proportional font and the the  
^^^ will not be aligned with the word short. You should fix the  
settings of you mail client in both these areas.




Viki

[[alternative HTML version deleted]]



David Winsemius, MD
West Hartford, CT

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


Re: [R] Error: object 'short' not found

2010-10-19 Thread Ista Zahn
Hi Viki,

On Tue, Oct 19, 2010 at 10:03 AM, Viki S is...@live.com wrote:

 Hi guys,
 Can anyone tell me what is the meaning of following command ?

 paste(execDir,paste(short,myfile,sep=_),sep=\)

The command means paste together the values in the variable execDir
with the pasted-together values in short and myfile


 R gives me an error :

 Error: object 'short' not found

 I tried to find help about 'short' in R, but could not find any such 
 function/ object.

because it does not exist, as the error message informed you. You need
to create it, or, if you want the literal string short, then you
need to put it in quotes.

-Ista


 Viki

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




-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org

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


Re: [R] Error: object 'short' not found

2010-10-19 Thread Ivan Calandra

 Hi,

R tells you that you don't have any object called short in your 
workspace.

From your question, I would guess that you don't plan to have it.

What do you want the output of paste(...) to look like? Which parts are 
supposed to be called through objects (that contain characters), which 
ones directly as strings?


Ivan

Le 10/19/2010 16:03, Viki S a écrit :

Hi guys,
Can anyone tell me what is the meaning of following command ?

paste(execDir,paste(short,myfile,sep=_),sep=\)

R gives me an error :

Error: object 'short' not found

I tried to find help about 'short' in R, but could not find any such function/ 
object.

Viki

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



--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Part time equity tick data high frequency trading research

2010-10-19 Thread Ista Zahn
Hi Chris,
There is a jobs mailing list: https://stat.ethz.ch/mailman/listinfo/r-sig-jobs

-Ista

On Tue, Oct 19, 2010 at 10:10 AM, aquatrade aquatrade...@gmail.com wrote:

 Hi,

 There seems to be no subsection for work related postings, so please excuse
 me if this is in the wrong place.

 I am looking for an English speaking person with very strong R  Language,
 statistics and some financial math knowledge to do statistical research into
 USA stock tick data.

 You probably have a hard sciences background requiring heavy statistical and
 maths knowledge and have an interest in stock markets (e.g. you know what a
 bid and ask is for a stock quote).  Probably have a  Masters or Phd degree.

 I am an experienced trader, who is researching some high frequency strategy
 ideas and need someone who can work part-time for 4 months to help with the
 research.  While I have the tick data and understanding of what to do, it
 takes me far too long as I am not a maths/stats expert.

 You should have an interest in stocks, so that you have a basic
 understanding of market structure and quotes.   Must speak very good English
 and have access to a reliable internet connection and Skype.  I do not care
 which country you are located in.

 You will be dealing with tick data sets with rows in the millions.

 Skill Set:
  R Language (strong)
  Statistics
  Mathematics
  Financial Maths (time series analysis, co-variance, GARCH, etc)
  Java (basic level)

 Please include a resume and summary of why you would enjoy doing this.

 Please indicate your monthly rate for 80+ hours per month for 4 months.  I
 am paying for this out of my own pocket, so am very price sensitive…which is
 why I am going offshore.   There is the potential for extending this longer
 term.

 This is a great opportunity for someone to learn about high frequency tick
 data research and make a little money as well.

 Please contact me directly at aquatrade...@gmail.com.

 Thank you for reading and apologies if posted in the wrong area.

 Thanks,
 Chris





 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Part-time-equity-tick-data-high-frequency-trading-research-tp3002167p3002167.html
 Sent from the R help mailing list archive at Nabble.com.

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




-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org

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


Re: [R] Lattice: type=p stopped working in panel.average

2010-10-19 Thread Alexandr Malusek
Dear Deepayan,

I had to swap x and y (see below), but otherwise it worked
perfectly. Thank you for your help.

mypanel.average - function(x, y, FUN = mean, ...)
{
  aa - aggregate(x ~ as.numeric(y), data = environment(), FUN = FUN)
  panel.points(aa[[2]], aa[[1]], ...)
}

plot - bwplot(year ~ Eann, data=df, horizontal = T,
  xlab = E / mSv,
  ylab = year,
  box.ratio = 1.5,
  panel=function(...) {
panel.grid(h=0, v=-1)
mypanel.average(FUN=max, pch=3, col=black, ...)
panel.violin(adjust=0.3, kernel=gaussian, ...)
mypanel.average(FUN=min, pch=3, col=black, ...)
mypanel.average(FUN=mean, pch=20, col=black, ...)
mypanel.average(FUN=median, pch=0, col=black, ...)
  }
)

Regards,
Alexandr


On Tue, Oct 19, 2010 at 1:52 PM, Deepayan Sarkar
deepayan.sar...@gmail.com wrote:
 On Tue, Oct 19, 2010 at 4:18 PM, Alexandr Malusek
 alexandr.malu...@gmail.com wrote:
 Hi,

 The behavior of panel.average has changed.  In March 2010, I plotted
 the attached r_plotViolinOfAnnualE_old.eps. (I don't know the version
 of R). Today, I plotted the attached r_plotViolinOfAnnualE_new.eps
 using R version 2.12.0 (2010-10-15). Both figures were produced via
 the same script:

 ...
 plot - bwplot(year ~ Eann, data=df, horizontal = T,
  xlab = E / mSv,
  ylab = year,
  box.ratio = 1.5,
  panel=function(...) {
    panel.grid(h=0, v=-1)
    panel.average(fun=max, type=p, pch=3, col=black, ...)
    panel.violin(adjust=0.3, kernel=gaussian, ...)
    panel.average(fun=min, type=p, pch=3, col=black, ...)
    panel.average(fun=mean, type=p, pch=20, col=black, ...)
    panel.average(fun=median, type=p, pch=0, col=black, ...)
  }
 )
 ...

 The old version of R plotted points as defined by type=p, the new
 version plotted lines. I don't know whether it is a bug or a new
 feature. Anyway, is there an easy way of getting the old result with
 the new version of R?

 The change happened in Dec 2009, probably to prevent unintended
 capturing of 'type' (panel.average is an alias for panel.linejoin,
 which indicates that the original intention was to draw lines).

 In hindsight, this was probably not the best choice. However, you can
 get the same effect fairly easily with

 mypanel.average - function(x, y, FUN = mean, ...)
 {
   panel.points(aggregate(as.numeric(y) ~ x, data = environment(), FUN
 = FUN), ...)
 }

 -Deepayan


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] points(x,y), mean and standard deviation

2010-10-19 Thread ashz

Hi,

Thanks for the tip.

I run this script:
means.cl - c(82, 79, 110, 136,103)
stderr.cl - c(8.1,9.2,7.4,1.6,7.6)
plotCI(x = means.cl , uiw =  stderr.cl, pch=24)

But how can I connect the mean triangles with a line?

Thanks

-- 
View this message in context: 
http://r.789695.n4.nabble.com/points-x-y-mean-and-standard-deviation-tp3001683p3002173.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] points(x,y), mean and standard deviation

2010-10-19 Thread Joshua Wiley
Hi,

Here is an example using ggplot2.  For future reference, it would be
convenient if you provided sample data.  This is actually pretty easy
to do:  dput(yourdata) or if your data is very large:
dput(head(yourdata)).  At any rate, here is an example with the means
plotted as points and connected with a line and error bars around
them.  The line is controlled by geom_line() so you can easily add or
remove it.


# Load ggplot2
library(ggplot2)

# Create some sample data
dat - data.frame(X = as.Date(Sys.time()) - 0:10,
  Y1 = sample(20:30, 11, replace = TRUE),
  Y2 = sample(2:6, 11, replace = TRUE))

# Actual plot
ggplot(data = dat, aes(x = X, y = Y1, ymin = Y1 - Y2, ymax = Y1 + Y2)) +
  geom_point() + # points at the means
  geom_line() + # if you want lines between pints
  geom_errorbar() # error bars, Y1 - Y2 and Y1 + Y2

HTH,

Josh

On Tue, Oct 19, 2010 at 1:41 AM, ashz a...@walla.co.il wrote:

 Hi,

 I have a data set with 3 rows (X=date, Y1=arithmetic mean and Y2=standard
 deviation). How can I create a graph(e.g., points) which will show the
 +-stdev as well (similar to excel).

 Thanks

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/points-x-y-mean-and-standard-deviation-tp3001683p3001683.html
 Sent from the R help mailing list archive at Nabble.com.

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




-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.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] points(x,y), mean and standard deviation

2010-10-19 Thread Dennis Murphy
lines(1:5, means.cl)

HTH,
Dennis

On Tue, Oct 19, 2010 at 7:13 AM, ashz a...@walla.co.il wrote:


 Hi,

 Thanks for the tip.

 I run this script:
 means.cl - c(82, 79, 110, 136,103)
 stderr.cl - c(8.1,9.2,7.4,1.6,7.6)
 plotCI(x = means.cl , uiw =  stderr.cl, pch=24)

 But how can I connect the mean triangles with a line?

 Thanks

 --
 View this message in context:
 http://r.789695.n4.nabble.com/points-x-y-mean-and-standard-deviation-tp3001683p3002173.html
 Sent from the R help mailing list archive at Nabble.com.

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


[[alternative HTML version deleted]]

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


Re: [R] using optimize with two unknowns, e.g. to parameterize a distribution with given confidence interval

2010-10-19 Thread Ravi Varadhan
You cannot use `optimize' when there are two or more parameters to be
optimized.  I don’t know if other have suggested any solution to this, but
here are 2 approaches:

# Estimating LCL and UCL separately using `optimize'.

prior.lcl - function(x, alpha, mean, var) {
  a - abs(plnorm(x, mean, var) - (alpha/2))
  return(a)
  }

prior.ucl - function(x, alpha, mean, var) {
  b - abs(plnorm(x, mean, var) - (1-alpha/2))
  return(b)
  }


optimize(f=prior.lcl, mean=0, var=1, alpha=0.05, interval=c(0,20))

optimize(f=prior.ucl, mean=0, var=1, alpha=0.05, interval=c(0,20))


# Combining LCL and UCL estimation
# Using `optimx' package to illustrate how to solve this using different
optimizers
# This also shows that this problem is not so easy to solve
#
prior - function(x, alpha, mean, var) {
  a - abs(plnorm(x[1], mean, var) - (alpha/2))
  b - abs(plnorm(x[2], mean, var) - (1-alpha/2))
  return(a+b)
  }


require(optimx)

optimx(par=c(0,10), fn=prior, mean=0, var=1, alpha=0.05, method=c(Nelder,
BFGS, CG, spg, bobyqa, Rvmmin, nlminb, Rcgmin, ucminf))

optimx(par=c(1,10), fn=prior, mean=0, var=1, alpha=0.05, method=c(Nelder,
BFGS, CG, spg, bobyqa, Rvmmin, nlminb, Rcgmin, ucminf))


Hope this helps,
Ravi.


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of David LeBauer
Sent: Friday, October 15, 2010 5:31 PM
To: r-help
Subject: [R] using optimize with two unknowns, e.g. to parameterize a
distribution with given confidence interval

Hi,

I would like to write a function that finds parameters of a log-normal
distribution with a 1-alpha CI of (x_lcl, x_ucl):

However, I don't know how to optimize for the two unknown parameters.

Here is my unsuccessful attempt to find a lognormal distribution with
a 90%CI of 1,20:

prior - function(x_lcl, x_ucl, alpha, mean, var) {
  a - (plnorm(x_lcl, mean, var) - (alpha/2))^2
  b - (plnorm(x_ucl, mean, var) - (1-alpha/2))^2
  return(a+b)
  }

optimize(fn=prior, interval = c(-5, 100), 1, 20)

I understand that this problem has a closed form solution, but I would
like to make this a general function.

Thanks,

David

-- 
David LeBauer, PhD
Energy Biosciences Institute
University of Illinois Urbana-Champaign
1206 W. Gregory Drive
Urbana, IL  61801, U.S.A.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Chron object in time series plot

2010-10-19 Thread Manta

Dear R users, I have the following script to create bins of specified time
intervals


bin_end=60/bin_size
bin_size=bin_size*100
h=seq(07,18,by=1)
breaks=c()
for (i in h)
{
for (j in 0:(bin_end-1))
{
value=i+(bin_size)*j
breaks=append(breaks,value)
}
}


I would like to plot then using the time as x-axis. I tried the following

prova=zoo(myseries,times(breaks))

but of course I got the plot with the time as 8, 9, 10 and so
on. I would like only 08:00, 09:00 and so on (maybe also the half hours).
How to do it?

Thanks for your help,
Marco

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Chron-object-in-time-series-plot-tp3002285p3002285.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Incorrect positioning of raster images on Windows

2010-10-19 Thread Sharpie


Paul Murrell-2 wrote:
 
 Hi
 
 This is a rounding (truncation) problem.
 Working on a fix.
 
 Paul
 
 Sharpie wrote:
 
 Michael Sumner-2 wrote:
 I think there's something about the discrete cell versus centre
 value
 interpretation here, and you are pushing the pixels through R's
 graphics
 engine as well as whatever the png device has to do.

 I can't enlighten you about the details of that, but by creating an
 image
 file more directly with pixels as data you can get the result exactly:

 test - matrix(c(0, 255), 3, 5)
 library(rgdal)
 ## transpose to get orientation right
 x - image2Grid(list(x = 1:ncol(test), y = 1:nrow(test), z = t(test)))
 writeGDAL(x, raster.png, driver = PNG, type = Byte)



 On Mon, Oct 18, 2010 at 3:17 PM, Sharpie ch...@sharpsteen.net wrote:

 I am working on dumping raster data from R into PNG files using
 rasterImage().  I am working with a test matrix from the rasterImage()
 example and using it to produce a PNG image with the following code:


 # From the example for rasterImage(). A 3 pixel by 5 pixel b/w
 checkerboard.
 testImage - as.raster(0:1, nrow=3, ncol=5)

 testImage
 [,1]  [,2]  [,3]  [,4]  [,5]
 [1,] #00 #FF #00 #FF #00
 [2,] #FF #00 #FF #00 #FF
 [3,] #00 #FF #00 #FF #00

 png('test.png', width=5, height=3, units='px')

 # Just want the image, no margins, boarders or other fancy stuff.
 par(mar = c(0,0,0,0) )
 plot.new()
 plotArea = par('fig')

 rasterImage(testImage, plotArea[1], plotArea[3],
  plotArea[2], plotArea[4], interpolate = FALSE )

 dev.off()


 However, using R 2.12.0, 64 bit on Windows 7 I have a strange issue
 where
 the image is shifted up by one row and to the left by one row.  In
 other
 words, the bottom row of pixels is missing along with the right column.
  The
 code works as I expect it to on OS X and Debian.


 Am I misusing the plotting commands in some way or should I submit an
 off-by-one bugreport to Bugzilla?

 Any suggestions or comments are most welcome.

 -Charlie

 -
 Charlie Sharpsteen
 Undergraduate-- Environmental Resources Engineering
 Humboldt State University
 --
 View this message in context:
 http://r.789695.n4.nabble.com/Incorrect-positioning-of-raster-images-on-Windows-tp2999649p2999649.html
 Sent from the R help mailing list archive at Nabble.com.

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



 -- 
 Michael Sumner
 Institute for Marine and Antarctic Studies, University of Tasmania
 Hobart, Australia
 e-mail: mdsum...@gmail.com

 
 
 
 Hi Micheal,
 
 I appreciate the suggestion.  However, rgdal is very heavyweight and
 installing the GDAL library is not a trivial operation automagically
 handled
 `install.packages()` on every platform R supports.  As I am not doing
 spatial analysis, I am very reluctant to add rgdal to the dependency list
 of
 my package.
 
 I would very much prefer to find the root cause of the difference in
 `png()`
 behavior on Windows when compared to OS X and Linux.  If anyone on this
 list
 has some insight to share, I would be very grateful to hear it.
 
 I waffled a bit on whether to send this to R-help or R-devel, in the
 light
 of day (as opposed to the foggy darkness that surrounds 2am) think it may
 be
 more of an R-devel question.  Forwarding it there now.
 
 -Charlie
 
 -
 Charlie Sharpsteen
 Undergraduate-- Environmental Resources Engineering
 Humboldt State University
 
 -- 
 Dr Paul Murrell
 Department of Statistics
 The University of Auckland
 Private Bag 92019
 Auckland
 New Zealand
 64 9 3737599 x85392
 p...@stat.auckland.ac.nz
 http://www.stat.auckland.ac.nz/~paul/le code.
 
 

Thank you so much Paul!

I poked around a bit in the Windows C code, but I know nothing about how
devga works, so it wasn't a very fruitful investigation.  Now that I know
what is happening I can put an appropriate warning message in my package.

Thanks again for all the excellent work you have put into the R graphics
system!

-Charlie


-
Charlie Sharpsteen
Undergraduate-- Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Incorrect-positioning-of-raster-images-on-Windows-tp2999649p3002321.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Chron object in time series plot

2010-10-19 Thread David Winsemius


On Oct 19, 2010, at 11:25 AM, Manta wrote:



Dear R users, I have the following script to create bins of  
specified time

intervals


bin_end=60/bin_size
bin_size=bin_size*100
h=seq(07,18,by=1)
breaks=c()
for (i in h)
{
for (j in 0:(bin_end-1))
{
value=i+(bin_size)*j
breaks=append(breaks,value)
}
}


I would like to plot then using the time as x-axis. I tried the  
following


prova=zoo(myseries,times(breaks))

but of course I got the plot with the time as 8, 9, 10  
and so
on. I would like only 08:00, 09:00 and so on (maybe also the half  
hours).

How to do it?


You seen to be under the mistaken impression that the internal  
representation of DateTime classes of 08:00 would be 8. Since the  
internal representation of time is in seconds, the even number hours  
would be at integer multiples of 60*60. In addition the conversion of  
numeric to string in this situation may present some need to check for  
missing leading 0's. You ether need to describe the data situation  
more completely or adjust your expectations (or both).


?as.POSIXct
?strptime

--
David.


Thanks for your help,
Marco

--
View this message in context: 
http://r.789695.n4.nabble.com/Chron-object-in-time-series-plot-tp3002285p3002285.html
Sent from the R help mailing list archive at Nabble.com.

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


David Winsemius, MD
West Hartford, CT

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


Re: [R] Chron object in time series plot

2010-10-19 Thread Manta


David Winsemius wrote:
 
 
 You seen to be under the mistaken impression that the internal  
 representation of DateTime classes of 08:00 would be 8. Since the  
 internal representation of time is in seconds, the even number hours  
 would be at integer multiples of 60*60. In addition the conversion of  
 numeric to string in this situation may present some need to check for  
 missing leading 0's. You ether need to describe the data situation  
 more completely or adjust your expectations (or both).
 
 ?as.POSIXct
 ?strptime
 
 -- 
 David.
 
 

Thanks for the quick reply David.

What I need is a simple conversion that can say 8=08:00, 94500=09:45 and
10=10:00 and so on.
I agree with you that the extra leading 0s would need an extra check.

The data situation is the following: I have several thousands of
observations  each day and I want to average them out throughout bins of a
specified size (either 15 or 5 minutes). An example of the data follows,
where the first column is the time and the second represents seconds between
different events.

example.txt

070002,1
070002,0
070002,0
070003,1
070003,0
070003,0
070003,0
070003,0
...
100210,0
100210,0
100210,0
100210,0
100210,0
100210,0
100210,0
...
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Chron-object-in-time-series-plot-tp3002285p3002358.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] superpose.polygon, panel.polygon and their colors

2010-10-19 Thread ottorino
Dear R-helpers,
the problem I'm facing today is to convince lattice to paint some areas
in gray.
The areas I would like to have in gray, are confidence bands

I've googled around in the mailing list archives and eventually find
some clues.

This link is my starting point
http://tolstoy.newcastle.edu.au/R/e2/help/07/04/15595.html

I'm reproducing here the code for your convenience

est - c(1:4, 3:6, 7, 9, 11, 13, 12, 15, 18, 21)
cond - rep(c('a','b'), each = 8)
grp - rep(c('I', 'II'), each = 4, 2)
x - rep(c(.5, .7, .9, 1.1), 4)
upper - est + 1
lower - est - 1
data - data.frame(est = est, x = x, cond = cond, grp = grp, upper =
upper, lower = lower)
rm(est, cond, grp, x, upper,lower)

panel.bands -

function(x, y, upper, lower,

 subscripts, col, ..., font, fontface) {

upper - upper[subscripts]
lower - lower[subscripts]
panel.polygon(c(x, rev(x)), c(upper, rev(lower)),...) }


xyplot(est ~ x | cond, group = grp, data = data, type = 'b',
   upper = data$upper,
   lower = data$lower,
   panel = function(x, y, ...){
   panel.superpose(x, y, panel.groups = 'panel.bands',...)
   panel.xyplot(x, y, ...)
   })

The result is a lattice object with the confidence bands painted in cyan
and pink. These are the areas I would like to have in gray.

I think that the cyan and pink colors come from

trellis.par.get(superpose.polygon)[[2]][1:2]

To change the colors I tried, unsuccessfully, the following 4 ways:

1)
trellis.par.set(superpose.polygon, list(col=gray))
xyplot(est ~ x | cond, group = grp, data = data, type = 'b',
   upper = data$upper,
   lower = data$lower,
   panel = function(x, y, ...){
   panel.superpose(x, y, panel.groups = 'panel.bands',...)
   panel.xyplot(x, y, ...)
   })

2)
xyplot(est ~ x | cond, group = grp, data = data, type = 'b',
   upper = data$upper,
   lower = data$lower,
   panel = function(x, y, ...){
   panel.superpose(x, y, panel.groups = 'panel.bands',
col=gray, ...)
   panel.xyplot(x, y, ...)
   })

3)
ltheme - canonical.theme(color = FALSE)
ltheme$superpose.polygon$col=gray
xyplot(est ~ x | cond, group = grp, data = data, type = 'b',
   upper = data$upper,
   lower = data$lower,
   theme=ltheme,
   panel = function(x, y, ...){
   panel.superpose(x, y, panel.groups = 'panel.bands',...)
   panel.xyplot(x, y, ...)
   })

4)
panel.bands.1 -

function(x, y, upper, lower,

 subscripts, col, ..., font, fontface) {

upper - upper[subscripts]
lower - lower[subscripts]
panel.polygon(c(x, rev(x)), c(upper, rev(lower)),
col=gray, ...) }

xyplot(est ~ x | cond, group = grp, data = data, type = 'b',
   upper = data$upper,
   lower = data$lower,
   panel = function(x, y, ...){
   panel.superpose(x, y, 
   panel.groups = 'panel.bands.1',...)
   panel.xyplot(x, y, ...)
   })

I suspect that superpose polygon is not involved at all in the process,
and in

test.gray - 
xyplot(est ~ x | cond, group = grp, data = data, type = 'b',
   upper = data$upper,
   lower = data$lower,
   panel = function(x, y, ...){
   panel.superpose(x, y, panel.groups = 'panel.bands',...)
   panel.xyplot(x, y, ...)
   })
str(test.gray)

I cannot find any indication on the colors.

Strangely enough, the following code seems to modify something, 
the border of the colored areas.

panel.bands.2 -

function(x, y, upper, lower,

 subscripts, col, ..., font, fontface) {

upper - upper[subscripts]
lower - lower[subscripts]
panel.polygon(c(x, rev(x)), c(upper, rev(lower)),
border= 2, ...) }

xyplot(est ~ x | cond, group = grp, data = data, type = 'b',
   upper = data$upper,
   lower = data$lower,
   panel = function(x, y, ...){
   panel.superpose(x, y, 
   panel.groups = 'panel.bands.2',...)
   panel.xyplot(x, y, ...)
   })

In other words I can modify the borders, but not the shaded areas.
This sounds strange to me.
Where am I wrong ?

Thanks in advance for your time.


-- 
Ottorino-Luca Pantani, Università di Firenze
Dip.to di Scienze delle Produzioni Vegetali,
del Suolo e dell'Ambiente Forestale (DiPSA)
P.zle Cascine 28 50144 Firenze Italia
Ubuntu 10.04 -- GNU Emacs 23.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version
2.18.0)
ESS version 5.8 -- R 2.10.1

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


[R] head.matrix() unintelligent

2010-10-19 Thread brbell01

Hi Just a simple question really. I´ve got these large 2d matrices that I´d
like to inspect, but not from start to finish.  The head() command is
convenient when columns are few. For large nxn matrices, however, head() and
head.matrix() are still cumbersome.  Is there a simple way of viewing both
the columnwise and rowwise heads of a matrix?

cheers, 
Bruce
-- 
View this message in context: 
http://r.789695.n4.nabble.com/head-matrix-unintelligent-tp3002346p3002346.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] De: information

2010-10-19 Thread saidi helmi
Dear all,

My name is Saidi Helmi and I'm a PhD student at Sassari University (Italy).
I want to ask if there is any package for the estimation of the parameters
of Two Component Extreme Value(TCEV) distribution.

Thank you,

best regards,

Saidi Helmi

[[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] head.matrix() unintelligent

2010-10-19 Thread Duncan Murdoch

 On 19/10/2010 12:10 PM, brbell01 wrote:

Hi Just a simple question really. I´ve got these large 2d matrices that I´d
like to inspect, but not from start to finish.  The head() command is
convenient when columns are few. For large nxn matrices, however, head() and
head.matrix() are still cumbersome.  Is there a simple way of viewing both
the columnwise and rowwise heads of a matrix?


i - 1:5
M[i,i]

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] Chron object in time series plot

2010-10-19 Thread David Winsemius


On Oct 19, 2010, at 12:19 PM, Manta wrote:




David Winsemius wrote:



You seen to be under the mistaken impression that the internal
representation of DateTime classes of 08:00 would be 8. Since the
internal representation of time is in seconds, the even number hours
would be at integer multiples of 60*60. In addition the conversion of
numeric to string in this situation may present some need to check  
for

missing leading 0's. You ether need to describe the data situation
more completely or adjust your expectations (or both).

?as.POSIXct
?strptime

--
David.




Thanks for the quick reply David.

What I need is a simple conversion that can say 8=08:00,  
94500=09:45 and

10=10:00 and so on.
I agree with you that the extra leading 0s would need an extra  
check.


I'm having some difficulty understanding what you want but see if this  
gets you further:


 example -070002,1
+ 070002,0
+ 070002,0
+ 070003,1
+ 070003,0
+ 070003,0
+ 070003,0
+ 070003,0
+ 100210,0
+ 100210,0
+ 100210,0
+ 100210,0
+ 100210,0
+ 100210,0
+ 100210,0
 timedf - read.table(textConnection(example),  
colClasses=c(character, numeric), sep=,, header=FALSE)

 str(timedf)
'data.frame':   15 obs. of  2 variables:
 $ V1: chr  070002 070002 070002 070003 ...
 $ V2: num  1 0 0 1 0 0 0 0 0 0 ...
 as.POSIXct(timedf$V1, format=%H%M%S, origin=1970-01-01)
 [1] 2010-10-19 07:00:02 EDT 2010-10-19 07:00:02 EDT
 [3] 2010-10-19 07:00:02 EDT 2010-10-19 07:00:03 EDT
 [5] 2010-10-19 07:00:03 EDT 2010-10-19 07:00:03 EDT
 [7] 2010-10-19 07:00:03 EDT 2010-10-19 07:00:03 EDT
 [9] 2010-10-19 10:02:10 EDT 2010-10-19 10:02:10 EDT
[11] 2010-10-19 10:02:10 EDT 2010-10-19 10:02:10 EDT
[13] 2010-10-19 10:02:10 EDT 2010-10-19 10:02:10 EDT
[15] 2010-10-19 10:02:10 EDT



The data situation is the following: I have several thousands of
observations  each day and I want to average them out throughout  
bins of a

specified size (either 15 or 5 minutes).


That was not clear to me. The phrase average them out throughout  
bins of a specified size... is not an unambiguous operation. This  
needs a good example that provides sample input and also expected  
output.



An example of the data follows,
where the first column is the time and the second represents seconds  
between

different events.


Notice that I read them in as character variables which preserved the  
leading zeroes.




example.txt

070002,1
070002,0
070002,0
070003,1
070003,0
070003,0
070003,0
070003,0
...
100210,0
100210,0
100210,0
100210,0
100210,0
100210,0
100210,0
...
--
View this message in context: 
http://r.789695.n4.nabble.com/Chron-object-in-time-series-plot-tp3002285p3002358.html
Sent from the R help mailing list archive at Nabble.com.

--

David Winsemius, MD
West Hartford, CT

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


[R] separate elements of a character vector

2010-10-19 Thread Simon Kiss
Dear colleagues, this seems like an easy problem, and I found some suggestions 
which I've incorporated in the help list, but I can't quite get it right.  
I want to add a series of years to a second x-axis category label. I generate 
them with test and test_2 below, format them with some spacing (which is the 
suggestion I took from the R-list) and concatenate them and then write them 
with mtext.  At the end, the labels in test are bunched up together in the 
center of the plot window.  Can anyone suggest a way to space out the elements 
of test to look like evenly-spaced x-labels?
Yours, 
Simon Kiss

x1-rnorm(500)
plot(x1)

test-seq(1987, 2002, by=1)

test_2-seq(2003, 2006, by=1)

test-format(c(test, test_2), width=5)

mtext(test, side=1, line=2)
*
Simon J. Kiss, PhD
Assistant Professor, Wilfrid Laurier University
73 George Street
Brantford, Ontario, Canada
N3T 2C9
Cell: +1 519 761 7606

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

2010-10-19 Thread Thomas Stewart
Let f be your estimated function.  Suppose we have a root function, say
root().  You are looking for

b = root(f-a)

where a is some constant.

Now suppose we consider the inverse of f, call it f.inv.  Then the following
holds:

a = root(f.inv-b).

In your code, you find

b = root(f-a)

and

c = root(f.inv-a).

Then you ask, why is b not equal to c?  Answer: Why should they?

-tgs


On Tue, Oct 19, 2010 at 5:44 AM, Muhammad Rahiz 
muhammad.ra...@ouce.ox.ac.uk wrote:

 Hi all,

 I'm plotting to get the intersection value of three curves. Defining the
 x-axis as dsm, the following code works;

 dsm = c(800,600,NA,525,NA,450,400,NA,NA,NA,0)
 s3 = seq(0.05,1.05,0.1)

 plot(dsm,s3,col=blue,las=1,ylab=fraction,xlab=distance (km))

 fc - function(x,a,b){a*exp(-b*x)}
 fm - nls(s3~fc(dsm,a,b),start=c(a=1,b=0))
 co - coef(fm)
 curve(fc(x,a=co[1],b=co[2]),add=TRUE,col=black,lwd=1)

 r - range(dsm,na.rm=TRUE)
 n - 1/2.71
 val - optimize(f=function(x) abs(fc(x,a=co[1],b=co[2])-n),c(r[1],r[2]))

 abline(v=val$minimum,lty=2,col=blue,lwd=1)
 abline(h=n,lty=2,col=red,lwd=1)
 text(100,0.1,paste(round(val$minimum,2),km,sep= ))

 When I flip the axes, i.e. x-axis = s3, and change the nls start up value
 to a=800, the three curves does not intersect.

 dsm = c(800,600,NA,525,NA,450,400,NA,NA,NA,0)
 s3 = seq(0.05,1.05,0.1)

 plot(s3,dsm,col=blue,las=1,xlab=fraction,ylab=distance (km))

 fc - function(x,a,b){a*exp(-b*x)}
 fm - nls(dsm~fc(s3,a,b),start=c(a=800,b=0))
 co - coef(fm)
 curve(fc(x,a=co[1],b=co[2]),add=TRUE,col=black,lwd=1)

 r - range(dsm,na.rm=TRUE)
 n - 1/2.71
 val - optimize(f=function(x) abs(fc(x,a=co[1],b=co[2])-n),c(r[1],r[2]))

 abline(h=val$minimum,lty=2,col=blue,lwd=1)
 abline(v=n,lty=2,col=red,lwd=1)
 text(100,0.1,paste(round(val$minimum,2),km,sep= ))

 It's merely reversing the axes - the code should work, shouldn't it?
 Any suggestions why this happens and how I can correct it?

 Thanks.

 Muhammad

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


[[alternative HTML version deleted]]

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


Re: [R] separate elements of a character vector

2010-10-19 Thread Joshua Wiley
Dear Simon,

I think the main issue is that mtext() is designed to work with a
single character string, not a character vector.  Here is one approach
collapsing using paste with some space:

x1-rnorm(500)
plot(x1)
test-seq(1987, 2002, by=1)
test_2-seq(2003, 2006, by=1)
mtext(paste(c(test, test_2), collapse =   ), side=1, line=2)

That said, if you want to add years as an alternate axis, mtext() is
not the route to go.  If you really want years as an axis, they should
be aligned with x values, not guessed spacing.  I can provide examples
if that is in fact what you are after.

Cheers,

Josh


On Tue, Oct 19, 2010 at 9:55 AM, Simon Kiss sjk...@gmail.com wrote:
 Dear colleagues, this seems like an easy problem, and I found some 
 suggestions which I've incorporated in the help list, but I can't quite get 
 it right.
 I want to add a series of years to a second x-axis category label. I generate 
 them with test and test_2 below, format them with some spacing (which is the 
 suggestion I took from the R-list) and concatenate them and then write them 
 with mtext.  At the end, the labels in test are bunched up together in the 
 center of the plot window.  Can anyone suggest a way to space out the 
 elements of test to look like evenly-spaced x-labels?
 Yours,
 Simon Kiss

 x1-rnorm(500)
 plot(x1)

 test-seq(1987, 2002, by=1)

 test_2-seq(2003, 2006, by=1)

 test-format(c(test, test_2), width=5)

 mtext(test, side=1, line=2)
 *
 Simon J. Kiss, PhD
 Assistant Professor, Wilfrid Laurier University
 73 George Street
 Brantford, Ontario, Canada
 N3T 2C9
 Cell: +1 519 761 7606

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




-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.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] separate elements of a character vector

2010-10-19 Thread Thomas Stewart
You may want to try something like this:

x1-rnorm(500)
plot(x1)
test-seq(1987, 2002, by=1)
test_2-seq(2003, 2006, by=1)
test-format(c(test, test_2), width=5)
xxx-seq(1,500,length=length(test))
axis(1,at=xxx,labels=test,line=1,col=0)

You'll need to specify where you want the labels (in this code I do that
with xxx).

-tgs

On Tue, Oct 19, 2010 at 12:55 PM, Simon Kiss sjk...@gmail.com wrote:

 Dear colleagues, this seems like an easy problem, and I found some
 suggestions which I've incorporated in the help list, but I can't quite get
 it right.
 I want to add a series of years to a second x-axis category label. I
 generate them with test and test_2 below, format them with some spacing
 (which is the suggestion I took from the R-list) and concatenate them and
 then write them with mtext.  At the end, the labels in test are bunched up
 together in the center of the plot window.  Can anyone suggest a way to
 space out the elements of test to look like evenly-spaced x-labels?
 Yours,
 Simon Kiss

 x1-rnorm(500)
 plot(x1)

 test-seq(1987, 2002, by=1)

 test_2-seq(2003, 2006, by=1)

 test-format(c(test, test_2), width=5)

 mtext(test, side=1, line=2)
 *
 Simon J. Kiss, PhD
 Assistant Professor, Wilfrid Laurier University
 73 George Street
 Brantford, Ontario, Canada
 N3T 2C9
 Cell: +1 519 761 7606

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


[[alternative HTML version deleted]]

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


Re: [R] head.matrix() unintelligent

2010-10-19 Thread Patrick Burns

You want the 'corner' function.

It isn't (yet) in an R package but you
can find it to 'source' it in near the
bottom of the 'Public Domain Code' page
of www.burns-stat.com

Your case is precisely the reason that
'corner' came into being.

On 19/10/2010 17:10, brbell01 wrote:


Hi Just a simple question really. I´ve got these large 2d matrices that I´d
like to inspect, but not from start to finish.  The head() command is
convenient when columns are few. For large nxn matrices, however, head() and
head.matrix() are still cumbersome.  Is there a simple way of viewing both
the columnwise and rowwise heads of a matrix?

cheers,
Bruce


--
Patrick Burns
pbu...@pburns.seanet.com
http://www.portfolioprobe.com/blog
http://www.burns-stat.com
(home of 'Some hints for the R beginner'
and 'The R Inferno')

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Chron object in time series plot

2010-10-19 Thread Manta

I do not think that importing the time as character will help me, as I need
to perform several operation with them. Again, maybe I am not able to
express clearly enough. Let's just focus on this series:

 breaks
 [1]  7  71500  73000  74500  8  81500  83000  84500  9  91500 
93000  94500 10 101500 103000 104500
[17] 11 111500 113000 114500 12 121500 123000 124500 13 131500
133000 134500 14 141500 143000 144500
[33] 15 151500 153000 154500 16 161500 163000 164500 17 171500
173000 174500 18 181500 183000 184500

I want a simple function that can convert breaks into a treatable object by
'zoo' as follows:

[1] 07:00 07:15 07:30  
..
[33]...
18:00 18:15 18:30 18:45

Is this possible?
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Chron-object-in-time-series-plot-tp3002285p3002458.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Chron object in time series plot

2010-10-19 Thread Phil Spector

The following will create a POSIXlt object using the current date:


strptime(sprintf('%06d',breaks),'%H%M%S')

 [1] 2010-10-19 07:00:00 2010-10-19 07:15:00 2010-10-19 07:30:00
 [4] 2010-10-19 07:45:00 2010-10-19 08:00:00 2010-10-19 08:15:00
 [7] 2010-10-19 08:30:00 2010-10-19 08:45:00 2010-10-19 09:00:00
  . . .

To get just the hours and minutes, you could use


format(strptime(sprintf('%06d',breaks),'%H%M%S'),'%H:%M')

 [1] 07:00 07:15 07:30 07:45 08:00 08:15 08:30 08:45 09:00
[10] 09:15 09:30 09:45 10:00 10:15 10:30 10:45 11:00 11:15
 . . .

And I'm still not sure I've answered your question.

- Phil Spector
 Statistical Computing Facility
 Department of Statistics
 UC Berkeley
 spec...@stat.berkeley.edu



On Tue, 19 Oct 2010, Manta wrote:



I do not think that importing the time as character will help me, as I need
to perform several operation with them. Again, maybe I am not able to
express clearly enough. Let's just focus on this series:


breaks

[1]  7  71500  73000  74500  8  81500  83000  84500  9  91500
93000  94500 10 101500 103000 104500
[17] 11 111500 113000 114500 12 121500 123000 124500 13 131500
133000 134500 14 141500 143000 144500
[33] 15 151500 153000 154500 16 161500 163000 164500 17 171500
173000 174500 18 181500 183000 184500

I want a simple function that can convert breaks into a treatable object by
'zoo' as follows:

[1] 07:00 07:15 07:30 
..
[33]...
18:00 18:15 18:30 18:45

Is this possible?
--
View this message in context: 
http://r.789695.n4.nabble.com/Chron-object-in-time-series-plot-tp3002285p3002458.html
Sent from the R help mailing list archive at Nabble.com.

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



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


Re: [R] How to read only ten rows from a SAS dataset (read.ssd)?

2010-10-19 Thread johannes rara
Thanks David,

Yes, my code really works (using the foreign package), but when
handling a SAS file which contains  500 000 rows and  100 cols it is
not really fun anymore. My intention was do some preliminary research
from the data and the whole dataset was not needed.

After all, I could not find a possibility to get limited amount of
rows from a dataset when importing data to R.

-J

2010/10/19 David Winsemius dwinsem...@comcast.net:

 On Oct 19, 2010, at 6:47 AM, johannes rara wrote:

 I'm trying to read SAS datasets on Windows:

 sashome - C:/Program Files/SAS/SAS 9.1
 fold - C:/temp
 g - read.ssd(fold, sasfile, sascmd = file.path(sashome, sas.exe))

 And this was successful?


 How to get only e.g first ten rows into R?

 Presumably you also entered require(foreign) if you had success. Looking at
 the help page, we see no parameter that would effect such a result. So just
 type:

 read.ssd

 You see that this function's code is available and if you know SAS, you
 should be able to insert the needed line that would limit the dataset length
 to only ten lines. I'm not being coy. I would probably had further
 suggestions 20 years ago when I was using SAS.

 There is a function sas.get in package Hmisc that offers more extensive
 control, but it is not clear to me on looking at the parameters whether your
 particular request would be easily accommodated. The ifs= parameter would
 appear to be the most promising candidate to me. It appears that these file
 formats are accepted:
 sasds.suffix - c(sd2, sd7, ssd01, ssd02, ssd03,
        ssd04, sas7bdat)


 Also, since the use of read.ssd implies that you have a working copy of SAS,
 then another option is simply exporting a file in the format of your choice?
 The SAS XPT format seems to be well handled by external programs.


 --
 David.

 -J

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

 David Winsemius, MD
 West Hartford, CT



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


Re: [R] Sample in R

2010-10-19 Thread Darin A. England
No. 

 ?sample

to see what sample() does.



On Tue, Oct 19, 2010 at 02:59:05AM -0700, emj83 wrote:
 
 Hi,
 
 Please can someone tell me if using sample() in R is actually a quick way of
 doing the Inverse Transform Sampling Method? 
 
 Many thanks Emma
 -- 
 View this message in context: 
 http://r.789695.n4.nabble.com/Sample-in-R-tp3001818p3001818.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] How to read only ten rows from a SAS dataset (read.ssd)?

2010-10-19 Thread David Winsemius


On Oct 19, 2010, at 1:31 PM, johannes rara wrote:


Thanks David,

Yes, my code really works (using the foreign package), but when
handling a SAS file which contains  500 000 rows and  100 cols it is
not really fun anymore. My intention was do some preliminary research
from the data and the whole dataset was not needed.

After all, I could not find a possibility to get limited amount of
rows from a dataset when importing data to R.


Which was why I suggested that you explore the possibilities offered by:

-- Hmisc::sas.get with a suitable if= statement

I seem to remember there is a SAS internal variable named something  
like _N_ that is a line number. Perhaps


... ,  if=_N_ = 10,

OR:
-- using SAS to output a smaller file.

OR:

--- adding a SAS line to the output returned within the read.ssd  
function.


--
David.



-J

2010/10/19 David Winsemius dwinsem...@comcast.net:


On Oct 19, 2010, at 6:47 AM, johannes rara wrote:


I'm trying to read SAS datasets on Windows:

sashome - C:/Program Files/SAS/SAS 9.1
fold - C:/temp
g - read.ssd(fold, sasfile, sascmd = file.path(sashome,  
sas.exe))


And this was successful?



How to get only e.g first ten rows into R?


Presumably you also entered require(foreign) if you had success.  
Looking at
the help page, we see no parameter that would effect such a result.  
So just

type:

read.ssd

You see that this function's code is available and if you know SAS,  
you
should be able to insert the needed line that would limit the  
dataset length

to only ten lines. I'm not being coy. I would probably had further
suggestions 20 years ago when I was using SAS.

There is a function sas.get in package Hmisc that offers more  
extensive
control, but it is not clear to me on looking at the parameters  
whether your
particular request would be easily accommodated. The ifs= parameter  
would
appear to be the most promising candidate to me. It appears that  
these file

formats are accepted:
sasds.suffix - c(sd2, sd7, ssd01, ssd02, ssd03,
   ssd04, sas7bdat)


Also, since the use of read.ssd implies that you have a working  
copy of SAS,
then another option is simply exporting a file in the format of  
your choice?

The SAS XPT format seems to be well handled by external programs.


--
David.


-J

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


David Winsemius, MD
West Hartford, CT




David Winsemius, MD
West Hartford, CT

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


Re: [R] could not find function hmatplot

2010-10-19 Thread Dieter Menne


Grzesiek wrote:
 
 I need a picture like this:
  http://rwiki.sciviews.org/doku.php?id=graph_gallery:graph38
 http://rwiki.sciviews.org/doku.php?id=graph_gallery:graph38 
 
 .. follows code from the web site
 
 I get an error:
 Error: could not find function hmatplot 
 
 What is wrong? Mayby you know any similar manual like this picture?
 

That's reproducible. Looks like hmatplot disappeared, probably because the
package is now lattice based.

Try the last  hexplom examples  in the new package docs.

Dieter
















-- 
View this message in context: 
http://r.789695.n4.nabble.com/could-not-find-function-hmatplot-tp3002423p3002475.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] How to read only ten rows from a SAS dataset (read.ssd)?

2010-10-19 Thread johannes rara
I have previously tried to use Hmisc's sas.get function, but I have
had problems with it. I think I go with your last suggestion.

-J

2010/10/19 David Winsemius dwinsem...@comcast.net:

 On Oct 19, 2010, at 1:31 PM, johannes rara wrote:

 Thanks David,

 Yes, my code really works (using the foreign package), but when
 handling a SAS file which contains  500 000 rows and  100 cols it is
 not really fun anymore. My intention was do some preliminary research
 from the data and the whole dataset was not needed.

 After all, I could not find a possibility to get limited amount of
 rows from a dataset when importing data to R.

 Which was why I suggested that you explore the possibilities offered by:

 -- Hmisc::sas.get with a suitable if= statement

 I seem to remember there is a SAS internal variable named something like _N_
 that is a line number. Perhaps

 ... ,  if=_N_ = 10,

 OR:
 -- using SAS to output a smaller file.

 OR:

 --- adding a SAS line to the output returned within the read.ssd function.

 --
 David.


 -J

 2010/10/19 David Winsemius dwinsem...@comcast.net:

 On Oct 19, 2010, at 6:47 AM, johannes rara wrote:

 I'm trying to read SAS datasets on Windows:

 sashome - C:/Program Files/SAS/SAS 9.1
 fold - C:/temp
 g - read.ssd(fold, sasfile, sascmd = file.path(sashome, sas.exe))

 And this was successful?


 How to get only e.g first ten rows into R?

 Presumably you also entered require(foreign) if you had success. Looking
 at
 the help page, we see no parameter that would effect such a result. So
 just
 type:

 read.ssd

 You see that this function's code is available and if you know SAS, you
 should be able to insert the needed line that would limit the dataset
 length
 to only ten lines. I'm not being coy. I would probably had further
 suggestions 20 years ago when I was using SAS.

 There is a function sas.get in package Hmisc that offers more extensive
 control, but it is not clear to me on looking at the parameters whether
 your
 particular request would be easily accommodated. The ifs= parameter would
 appear to be the most promising candidate to me. It appears that these
 file
 formats are accepted:
 sasds.suffix - c(sd2, sd7, ssd01, ssd02, ssd03,
       ssd04, sas7bdat)


 Also, since the use of read.ssd implies that you have a working copy of
 SAS,
 then another option is simply exporting a file in the format of your
 choice?
 The SAS XPT format seems to be well handled by external programs.


 --
 David.

 -J

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

 David Winsemius, MD
 West Hartford, CT



 David Winsemius, MD
 West Hartford, CT



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


Re: [R] How to read only ten rows from a SAS dataset (read.ssd)?

2010-10-19 Thread Phil Spector

I've verified that David's solution will work, but
  a) since if is a reserved word, you must use the full name
 of the argument, namely ifs
  b) the argument passed through ifs= should be a full
 subsetting if statement.

So adding

 ifs='if _n_ = 10'

to your sas.get call will return only the first 10 observations.

- Phil Spector
 Statistical Computing Facility
 Department of Statistics
 UC Berkeley
 spec...@stat.berkeley.edu


On Tue, 19 Oct 2010, David Winsemius wrote:



On Oct 19, 2010, at 1:31 PM, johannes rara wrote:


Thanks David,

Yes, my code really works (using the foreign package), but when
handling a SAS file which contains  500 000 rows and  100 cols it is
not really fun anymore. My intention was do some preliminary research
from the data and the whole dataset was not needed.

After all, I could not find a possibility to get limited amount of
rows from a dataset when importing data to R.


Which was why I suggested that you explore the possibilities offered by:

-- Hmisc::sas.get with a suitable if= statement

I seem to remember there is a SAS internal variable named something like _N_ 
that is a line number. Perhaps


... ,  if=_N_ = 10,

OR:
-- using SAS to output a smaller file.

OR:

--- adding a SAS line to the output returned within the read.ssd function.

--
David.



-J

2010/10/19 David Winsemius dwinsem...@comcast.net:


On Oct 19, 2010, at 6:47 AM, johannes rara wrote:


I'm trying to read SAS datasets on Windows:

sashome - C:/Program Files/SAS/SAS 9.1
fold - C:/temp
g - read.ssd(fold, sasfile, sascmd = file.path(sashome, sas.exe))


And this was successful?



How to get only e.g first ten rows into R?


Presumably you also entered require(foreign) if you had success. Looking 
at
the help page, we see no parameter that would effect such a result. So 
just

type:

read.ssd

You see that this function's code is available and if you know SAS, you
should be able to insert the needed line that would limit the dataset 
length

to only ten lines. I'm not being coy. I would probably had further
suggestions 20 years ago when I was using SAS.

There is a function sas.get in package Hmisc that offers more extensive
control, but it is not clear to me on looking at the parameters whether 
your

particular request would be easily accommodated. The ifs= parameter would
appear to be the most promising candidate to me. It appears that these 
file

formats are accepted:
sasds.suffix - c(sd2, sd7, ssd01, ssd02, ssd03,
  ssd04, sas7bdat)


Also, since the use of read.ssd implies that you have a working copy of 
SAS,
then another option is simply exporting a file in the format of your 
choice?

The SAS XPT format seems to be well handled by external programs.


--
David.


-J

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


David Winsemius, MD
West Hartford, CT




David Winsemius, MD
West Hartford, CT

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


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Chron object in time series plot

2010-10-19 Thread David Winsemius


On Oct 19, 2010, at 1:30 PM, Phil Spector wrote:


The following will create a POSIXlt object using the current date:


strptime(sprintf('%06d',breaks),'%H%M%S')

[1] 2010-10-19 07:00:00 2010-10-19 07:15:00 2010-10-19 07:30:00
[4] 2010-10-19 07:45:00 2010-10-19 08:00:00 2010-10-19 08:15:00
[7] 2010-10-19 08:30:00 2010-10-19 08:45:00 2010-10-19 09:00:00
 . . .

To get just the hours and minutes, you could use


format(strptime(sprintf('%06d',breaks),'%H%M%S'),'%H:%M')
[1] 07:00 07:15 07:30 07:45 08:00 08:15 08:30 08:45  
09:00
[10] 09:15 09:30 09:45 10:00 10:15 10:30 10:45 11:00  
11:15

. . .

And I'm still not sure I've answered your question.

- Phil Spector



On Tue, 19 Oct 2010, Manta wrote:



I do not think that importing the time as character will help me,  
as I need

to perform several operation with them.


Notice that Phil needed to recast these as a character vector with  
sprintf()  before passing the result to strptime. You cannot do any  
(valid) mathematical operations on them such as substraction or  
addition, since they should have no numerical values between 60*60 and  
2*60*60. Furthermore, any plotting of the numerical values will  
create illusory gaps. Any operation you do on them needs to first pass  
through a stage that recognizes that they do not possess the necessary  
attributes to be numbers. I think your resistance to making them  
character values in the first place is entirely misguided.


--
David.


Again, maybe I am not able to
express clearly enough. Let's just focus on this series:


breaks
[1]  7  71500  73000  74500  8  81500  83000  84500  9   
91500

93000  94500 10 101500 103000 104500
[17] 11 111500 113000 114500 12 121500 123000 124500 13  
131500

133000 134500 14 141500 143000 144500
[33] 15 151500 153000 154500 16 161500 163000 164500 17  
171500

173000 174500 18 181500 183000 184500

I want a simple function that can convert breaks into a treatable  
object by

'zoo' as follows:

[1] 07:00 07:15 07:30 
..
[33]...
18:00 18:15 18:30 18:45

Is this possible?
--
View this message in context: 
http://r.789695.n4.nabble.com/Chron-object-in-time-series-plot-tp3002285p3002458.html
Sent from the R help mailing list archive at Nabble.com.

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



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


David Winsemius, MD
West Hartford, CT

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


[R] R script help needed for RFC 2104 HMAC algorithm

2010-10-19 Thread Larry D'Agostino
I'm trying to create an R script that will execute the HMAC algorithm for
key-hashing messages.  My hope is to use this script for some web
authentication via R.

The algorithm is found at http://www.ietf.org/rfc/rfc2104.txt

Here is some example code that I have done that does not work for HMAC-MD5.
I'm a big confused by the algorithm since I don't have a very good working
knowledge of digests or hex strings.   I would really appreciate some
assistance if anyone can take a look at this code and offer advice.

The RFC website does offer C code to execute the HMAC algorithm but I am not
a C expert.


 HMAC Code #

library(digest)

## hex to binary

hexdat - replicate(10, paste(format.hexmode(sample(16,4)-1),collapse=''))
bin - apply(outer(0:15,3:0,function(x,y) x%/%(2^y)%%2),1,paste,collapse=)
names(bin) - format.hexmode( 0:15 )

## test
## cbind( hexdat, sapply( strsplit(hexdat,'') , function(x) paste( bin[x],
collapse='' ) ) )


## binary to hex

hex - names(bin)
names(hex) - bin



 Test HMAC_MD5 

### B=64
### L=16

#key - 0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
##key_len = 16 bytes
data - Hi There
##data_len = 8 bytes

## digest =  0x9294727a3638bb1c13f48ef8158bfc9d

ipad - rep(36,64)
opad - rep(5c,64)


k - rep(0b, 16)
zeros - rep(00,48)
K - c(k, zeros)

K_bin - cbind(K, sapply( strsplit(K,'') , function(x) paste( bin[x],
collapse='' ) ) )
ipad_bin - cbind(ipad, sapply( strsplit(ipad,'') , function(x) paste(
bin[x], collapse='' ) ) )

#cbind(K_bin, sapply( strsplit(K_bin[,2],'') , as.numeric) )

K_binnum - sapply( strsplit(K_bin[,2],'') , as.numeric)
ipad_binnum - sapply( strsplit(ipad_bin[,2],'') , as.numeric)


InnerXOR - as.numeric(xor(K_binnum, ipad_binnum))
InnerXOR - matrix(InnerXOR, 4, 128)
InnerXOR - t(InnerXOR)
InnerXORbin - apply(InnerXOR, 1, paste, collapse='')

InnerXORhex - cbind(InnerXORbin, sapply(InnerXORbin, function(x)
paste(hex[x], collapse='') ))
InnerXORhex - t(matrix(InnerXORhex[,2],2,64))
InnerXORhex - apply(InnerXORhex, 1, paste, collapse='')

dataHex - charToRaw(data)

cmb - c(InnerXORhex, dataHex)
cmb - paste(cmb, collapse='')

InnerHash - digest(cmb, algo=md5)

opad_bin - cbind(opad, sapply( strsplit(opad,'') , function(x) paste(
bin[x], collapse='' ) ) )

opad_binnum - sapply( strsplit(opad_bin[,2],'') , as.numeric)

OuterXOR - as.numeric(xor(K_binnum, opad_binnum))
OuterXOR - matrix(OuterXOR, 4, 128)
OuterXOR - t(OuterXOR)
OuterXORbin - apply(OuterXOR, 1, paste, collapse='')

OuterXORhex - cbind(OuterXORbin, sapply(OuterXORbin, function(x)
paste(hex[x], collapse='') ))
OuterXORhex - t(matrix(OuterXORhex[,2],2,64))
OuterXORhex - apply(OuterXORhex, 1, paste, collapse='')
OuterXORhex - paste(OuterXORhex, collapse='')

outercmb - paste(OuterXORhex, InnerHash, sep=)
HMAC_MD5 - digest(outercmb, algo=md5) should equal the digest
example above

[[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] superpose.polygon, panel.polygon and their colors

2010-10-19 Thread Dieter Menne


Ottorino-Luca Pantani wrote:
 
 The areas I would like to have in gray, are confidence bands
 
 This link is my starting point
 http://tolstoy.newcastle.edu.au/R/e2/help/07/04/15595.html
 
 

Thanks for the code example and for all the work you already put into it!

I think this is an oversight in Deepayan's example, some collision between
... and explicitly passing col. Just remove the col from the argument list
of panel.bands

panel.bands -  function(x, y, upper, lower,
   subscripts,  ..., font, fontface) { ### drop col
  upper - upper[subscripts]
  lower - lower[subscripts]
  panel.polygon(c(x, rev(x)), c(upper, rev(lower)),...) 
}

xyplot(est ~ x | cond, group = grp, data = data, type = 'b',
  col=gray, .## and add it here


Dieter



 

-- 
View this message in context: 
http://r.789695.n4.nabble.com/superpose-polygon-panel-polygon-and-their-colors-tp3002374p3002530.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Clustering with ordinal data

2010-10-19 Thread Steve_Friedman

Hello

I've been asked to help evaluate a vegetation data set, specifically to
examine it for community similarity. The initial problem I see is that the
data is ordinal.   At best this only captures a relative ranking of
abundance and ordinal ranks are assigned after data collection.I've
been trying to find a procedure in R that can handle ordinal based
classification and so far have not found one.

Does one exist ?  If there is one, which package supports this type of
analysis and  what is the function ?

Thanks in advance.
Steve




Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

steve_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147

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

2010-10-19 Thread Phil Spector

Steve -
   Take a look at daisy() in the cluster package.

- Phil Spector
 Statistical Computing Facility
 Department of Statistics
 UC Berkeley
 spec...@stat.berkeley.edu

On Tue, 19 Oct 2010, steve_fried...@nps.gov wrote:



Hello

I've been asked to help evaluate a vegetation data set, specifically to
examine it for community similarity. The initial problem I see is that the
data is ordinal.   At best this only captures a relative ranking of
abundance and ordinal ranks are assigned after data collection.I've
been trying to find a procedure in R that can handle ordinal based
classification and so far have not found one.

Does one exist ?  If there is one, which package supports this type of
analysis and  what is the function ?

Thanks in advance.
Steve




Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

steve_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147

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

2010-10-19 Thread David Winsemius


On Oct 19, 2010, at 6:38 AM, Toni López Mayol wrote:


Hello friends of R,

My name is Toni, i'm 25 and I'm working on the Meteorological  
Investigation team from Balearic Islands.


I had contact to you because I have a problem:

I done a file for every day since 1912 about precipitation. That  
file has the following structure:



str(Ast)

Loading required package: sp
Formal class 'SpatialPixelsDataFrame' [package sp] with 7 slots
 ..@ data   :'data.frame':  499105 obs. of  2 variables:
 .. ..$ PRECIP.pred: num [1:499105] 0.000536 0.000536 0.000536  
0.000536 0.000536 ...
 .. ..$ PRECIP.var : num [1:499105] 1.90e-05 1.90e-05 1.90e-05  
1.90e-05 1.90e-05 ...

 ..@ coords.nrs : num(0)
 ..@ grid   :Formal class 'GridTopology' [package sp] with 3  
slots

 .. .. ..@ cellcentre.offset: Named num [1:2] 345 4278
 .. .. .. ..- attr(*, names)= chr [1:2] x y
 .. .. ..@ cellsize : Named num [1:2] 0.1 0.1
 .. .. .. ..- attr(*, names)= chr [1:2] x y
 .. .. ..@ cells.dim: Named int [1:2] 2684 1600
 .. .. .. ..- attr(*, names)= chr [1:2] x y
 ..@ grid.index : int [1:499105] 2468192 2468193 2468194 2468195  
2465507 2465508 2465509 2465510 2465511 2465512 ...

 ..@ coords : num [1:499105, 1:2] 505 505 505 505 505 ...
 .. ..- attr(*, dimnames)=List of 2
 .. .. ..$ : NULL
 .. .. ..$ : chr [1:2] x y
 ..@ bbox   : num [1:2, 1:2] 345 4278 614 4438
 .. ..- attr(*, dimnames)=List of 2
 .. .. ..$ : chr [1:2] x y
 .. .. ..$ : chr [1:2] min max
 ..@ proj4string:Formal class 'CRS' [package sp] with 1 slots
 .. .. ..@ projargs: chr +proj=utm +zone=31 +units=km

This is a single file for one specific day.

Now, I must to sum the precipitation of every day from every file  
like this.


I must to do the annual precipitation for every year.


How you do that will depend on the data structure in which these Ast  
objects will be assembled. It sounds as though they might be in  
separate files roughly 100*365 in number and with different names that  
have their dates in some sort of meaningful format?





How can I take the precipitation ( ) of every day and sum it with  
all at same time? maybe a loop?


A single day total with your current object might be:

s.pred.precip - sum( a...@data$precip.pred )
s.pred.precip



Thanks so much for your time.

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


David Winsemius, MD
West Hartford, CT

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


Re: [R] Chron object in time series plot

2010-10-19 Thread Manta

Thanks Phil, it is exactly what I was looking for.

David, I took into account how to make valid math operations, so I
understand your concern about it.
I will definitely change all my scripts and functions to considered the time
as character, but as I need a clear output soon (deadline is close) I do not
have the time now to go through all of them. But thanks again for your
useful comment.

There is still a remaining issue. If I do the following:

test=zoo(myseries,format(strptime(sprintf('%06d',breaks),'%H%M%S'),'%H:%M'))
plot(test)


it does not work, as it says the following error (sorry for the Italian
words)

Errore in plot.window(...) : i valori 'xlim' devono essere finiti
Inoltre: Warning messages:
1: In xy.coords(x, y, xlabel, ylabel, log) :
  si è prodotto un NA per coercizione
2: In min(x) : no non-missing arguments to min; returning Inf
3: In max(x) : no non-missing arguments to max; returning -Inf

Thanks again for your help.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Chron-object-in-time-series-plot-tp3002285p3002553.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Clustering with ordinal data

2010-10-19 Thread Steve_Friedman
Thanks Phil,

I'll do so now.

Much appreciated.

Steve

Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

steve_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147


   
 Phil Spector  
 spec...@stat.ber 
 keley.edu To 
   steve_fried...@nps.gov  
 10/19/2010 02:23   cc 
 PMr-help@r-project.org
   Subject 
   Re: [R] Clustering with ordinal 
   data
   
   
   
   
   
   




Steve -
Take a look at daisy() in the cluster package.

 - Phil Spector
  Statistical
Computing Facility
  Department of
Statistics
  UC Berkeley

spec...@stat.berkeley.edu

On Tue, 19 Oct 2010, steve_fried...@nps.gov wrote:


 Hello

 I've been asked to help evaluate a vegetation data set, specifically to
 examine it for community similarity. The initial problem I see is that
the
 data is ordinal.   At best this only captures a relative ranking of
 abundance and ordinal ranks are assigned after data collection.I've
 been trying to find a procedure in R that can handle ordinal based
 classification and so far have not found one.

 Does one exist ?  If there is one, which package supports this type of
 analysis and  what is the function ?

 Thanks in advance.
 Steve




 Steve Friedman Ph. D.
 Spatial Statistical Analyst
 Everglades and Dry Tortugas National Park
 950 N Krome Ave (3rd Floor)
 Homestead, Florida 33034

 steve_fried...@nps.gov
 Office (305) 224 - 4282
 Fax (305) 224 - 4147

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

2010-10-19 Thread Grzesiek

I need a picture like this:
http://rwiki.sciviews.org/doku.php?id=graph_gallery:graph38
http://rwiki.sciviews.org/doku.php?id=graph_gallery:graph38 
but when I try compile it

require(hexbin)

data(NHANES)# pretty large data set!
good - !(is.na(NHANES$Albumin) | is.na(NHANES$Transferin))
NH.vars - NHANES[good, c(Age,Sex,Albumin,Transferin)]

# extract dependent variables and find  ranges for global binning
x - NH.vars[,Albumin]
rx - range(x)
y - NH.vars[,Transferin]
ry - range(y)

age - cut(NH.vars$Age,c(1,45,65,200))
sex - NH.vars$Sex
subs - tapply(age,list(age,sex))
#bivariate bins for each factor combination

for (i in 1:length(unique(subs))) {
   good - subs==i
   assign(paste(nam,i,sep=),
   erode.hexbin(hexbin(x[good],y[good],xbins=23,xbnds=rx,ybnds=ry)))
}

nam - matrix(paste(nam,1:6,sep=),ncol=3,byrow=TRUE)
rlabels -c(Females,Males)
clabels  - c(Age = 45,45  Age = 65,Age  65)
zoom - hmatplot(nam,rlabels,clabels,border=list(hbox=c(black,white),
 hdiff=rep(white,6)))

I get an error:
Error: could not find function hmatplot 

What is wrong? Mayby you know any similar manual like this picture?














-- 
View this message in context: 
http://r.789695.n4.nabble.com/could-not-find-function-hmatplot-tp3002423p3002423.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] How to write to sqlite files

2010-10-19 Thread lord12

In R, I know how to write ti csv files. However, how do I write to database
files? 
-- 
View this message in context: 
http://r.789695.n4.nabble.com/How-to-write-to-sqlite-files-tp3002586p3002586.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] How to read only ten rows from a SAS dataset (read.ssd)?

2010-10-19 Thread Daniel Nordlund
 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of Phil Spector
 Sent: Tuesday, October 19, 2010 10:49 AM
 To: David Winsemius
 Cc: r-help@r-project.org; johannes rara
 Subject: Re: [R] How to read only ten rows from a SAS dataset (read.ssd)?
 
 I've verified that David's solution will work, but
a) since if is a reserved word, you must use the full name
   of the argument, namely ifs
b) the argument passed through ifs= should be a full
   subsetting if statement.
 
 So adding
 
   ifs='if _n_ = 10'
 
 to your sas.get call will return only the first 10 observations.
 
   - Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
spec...@stat.berkeley.edu
 


 
I like the sas.get function from the Hmisc package.  But if for some reason the 
OP can't or doesn't want to use sas.get, it is fairly easy to add a parameter 
to the read.ssd function to limit the number of records read from the SAS 
dataset being exported.  If the OP or anyone else is interested, they can 
contact me off-list and I will provide an example (no need to clutter up the 
list).

Dan

Daniel Nordlund
Bothell, WA USA
 

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


[R] R 2.12.0 and JGR

2010-10-19 Thread Rob Baer
Since upgrading to 2.12.0, I'm having trouble getting the JGR to start under 
Windows 7, but I'm not quite sure what's happening.  

When I try to run the JGR.exe stub, the dialog says can't find Java R interface 
jri.dll.  As nearly as I can tell from a Google search this is to be a part of 
the rJava package which seems to load fine with the library(rJava) command from 
the Windows R GUI.  Indeed the required .dll is sitting in 
C:\R\R-2.12.0\library\rJava\jri as expected.  I must admit that my 
understanding of Java stubs is limited, and I don't know why this stopped 
working with the upgrade.

My ultimate goal of was to run the Deducer package which ironically runs fine 
from the Windows GUI despite recommending that I use JGR instead.  Any hints 
how I recover the use of JGR?

Thanks,

Rob  

 sessionInfo()
R version 2.12.0 (2010-10-15)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252  
 
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C 
 
[5] LC_TIME=English_United States.1252

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

other attached packages:
 [1] Deducer_0.4-1foreign_0.8-41   effects_2.0-10   colorspace_1.0-1 
lattice_0.19-13  multcomp_1.2-3  
 [7] mvtnorm_0.9-92   car_2.0-2survival_2.35-8  nnet_7.3-1   
MASS_7.3-8   JGR_1.7-3   
[13] iplots_1.1-3 JavaGD_0.5-3 ggplot2_0.8.8proto_0.3-8  
reshape_0.8.3plyr_1.2.1  
[19] rJava_0.8-7 

loaded via a namespace (and not attached):
[1] tools_2.12.0
 

--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501
660-626-232
FAX 660-626-2965

[[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] R 2.12.0 and JGR

2010-10-19 Thread Prof Brian Ripley
JRI/rJava/JGR have their own mailing lists, and it would be better to 
ask there.


But there was a rJava update this morning, and it is consequently 
little tested. (I know for example that 64-bit JRI will need furtehr 
work.)  It may be that other things also need an update (like the JGR 
stub).


So do ask those who know for sure -- they don't read this list.

On Tue, 19 Oct 2010, Rob Baer wrote:


Since upgrading to 2.12.0, I'm having trouble getting the JGR to start under 
Windows 7, but I'm not quite sure what's happening.

When I try to run the JGR.exe stub, the dialog says can't find Java R interface 
jri.dll.  As nearly as I can tell from a Google search this is to be a part of 
the rJava package which seems to load fine with the library(rJava) command from 
the Windows R GUI.  Indeed the required .dll is sitting in 
C:\R\R-2.12.0\library\rJava\jri as expected.  I must admit that my 
understanding of Java stubs is limited, and I don't know why this stopped 
working with the upgrade.

My ultimate goal of was to run the Deducer package which ironically runs fine 
from the Windows GUI despite recommending that I use JGR instead.  Any hints 
how I recover the use of JGR?

Thanks,

Rob


sessionInfo()

R version 2.12.0 (2010-10-15)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

other attached packages:
[1] Deducer_0.4-1foreign_0.8-41   effects_2.0-10   colorspace_1.0-1 
lattice_0.19-13  multcomp_1.2-3
[7] mvtnorm_0.9-92   car_2.0-2survival_2.35-8  nnet_7.3-1   
MASS_7.3-8   JGR_1.7-3
[13] iplots_1.1-3 JavaGD_0.5-3 ggplot2_0.8.8proto_0.3-8  
reshape_0.8.3plyr_1.2.1
[19] rJava_0.8-7

loaded via a namespace (and not attached):
[1] tools_2.12.0




--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501
660-626-232
FAX 660-626-2965

[[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,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [R] points( .... pch=2) substitue pch with image

2010-10-19 Thread Greg Snow
Look at my.symbols and ms.image in the TeachingDemos package.

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

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Knut Krueger
 Sent: Tuesday, October 19, 2010 4:50 AM
 To: 'R R-help'
 Subject: [R] points(  pch=2) substitue pch with image
 
   Hi to all,
 is there any function where I can substitute the characters with an
 (jpg) image ?
 
 Kind regards
 Knut
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Tif image to 8bit colour matrix.

2010-10-19 Thread Greg Snow
Look at the EBImage package from bioconductor.

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


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Roger Gill
 Sent: Tuesday, October 19, 2010 6:00 AM
 To: r-help@r-project.org
 Subject: [R] Tif image to 8bit colour matrix.
 
 Dear listers,
 
 I have a collection of tif images that I would like to convert, in R,
 to a
 matrix containing the values of the 8bit colour. Ideally, I would like
 a matrix
 for each of the colour channels (red, blue and green). I have 'googled'
 and
 searched the help list but have yet to find a solution and hope that
 someone can
 point me in the right direction.
 
 I currently use subscription software (Igor) for the conversion and
 would prefer
 to use R.
 
 Best wishes,
 
 Roger
 
 
 
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


  1   2   >