[R] Problem to load a shape file

2012-12-28 Thread dms
Dear all, I've been puzzled why I not able to load a shapefile from a connection. Does anyone here can give a reasonable answer? When I try the following script I got this error: Error in getinfo.shape(fn) : Error opening SHP file #Reproduction temp <- tempfile() download.file("http://metodologi

[R] biasing conditional sample

2012-11-11 Thread dms
Hi all, I'm looking for some help to bias the sample function. Basically, I'd like to generate a data frame where the first column is completely random, the second, however, is conditional do the first, the third is conditional to the first and the second and so on. By conditional I mean that I sh

Re: [R] biasing conditional sample

2012-11-11 Thread dms
Thanks for the solutions. Carlson's and Barradas's approaches give me what I need. Nonetheless, Carlson's proposal is slightly better for my purposes because it's shorter. Thanks Daniel > Can't you just use sample() on each row without replacement to guarantee > no > matches among the five (or m

[R] Winsorisation function

2012-11-14 Thread dms
Dear all, someone can find what I doing wrong with the following function. It is for winsorisation mean. At my eyes it is ok, but for reason I sometimes it is changing the results when I change the k value. wmean <- function (x, na.rm = FALSE, k = 1) { if (any(i.na <- is.na(x))) {

[R] dealing with Date vars

2012-11-17 Thread dms
Hi all, I'm writing a function that summarizes objects, however, when a Date variable is present in the objects it doesn't work. How can I handle with this problem? D __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEA

[R] expand time period

2012-11-19 Thread dms
I'd like to expand the following data to perform a daily time series. It should cover from '2012-07-01' to '2012-10-06' with the values I actually have being the mean from one point measurement to another. Does anyone has a clue to perform this task. structure(list(Date.beg = structure(c(15635, 1

[R] Rotated, Right-Justified Labels for Shortened Tick Marks

2011-01-12 Thread dms
Hello R-help, I'm trying to make a fairly simple plot axis that goes something like this: plot(-10:10,-10:10, yaxt='n') axis(side=2, las=1, hadj=1, tck=-.01, cex.axis=.6) ...but as you can see, the labels are not close enough to the y-axis (where I want them... to save space for publication).

[R] merge( , by='row.names') slowness

2011-03-02 Thread dms
I noticed that joining two data.frames in R using the "merge" function that using by='row.names' slows things down substantially when compared to just joining on a common index column. Using a dataframe size of ~10,000 rows: it's as slow as 10 minutes in the by='row.names' case versus merely 1 s