Kátia Emidio | 22 May 2013 15:53
Picon

basic question

does anyone could help me with do a sample from dataframe, using
replacement equal True? I am a very beginner at R.

 without replacement, my script works...

h<-dados[sample(1:357,20),]# this is ok. from 357 rows, I take 20 ones,
with all columms... How puts the replace=T ?
thanks
katia

--

-- 
Kátia Emídio da Silva DSc
Eng. Florestal
Manaus/AM

Forestry Engineer
Manaus/AM-Brazil

	[[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo <at> r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Eddie Smith | 22 May 2013 11:37
Picon

Space-time interpolation

Hi r-sig-geo list,

I'm trying to do space-time interpolation of temperature from satellite
datasets. To start with, I am planning to start the ST interpolation using
a daily one-week  data. Right now, I already converted the data set into
ASCII and read it using rgdal to create SpatialGridDataFrame object. I know
that I need to 'convert' it into STFDF for variogram analysis, etc.

I just wondering whether I am on a right track. Would that be an option to
stack my satellite images and then convert it into STFDF?

Which step is better?

	[[alternative HTML version deleted]]
sebastian botero cañola | 21 May 2013 23:56
Picon
Favicon

How to create a STFDF object from various rasters

Hi,
I want to create spatio-temporal variograms of NDVI data that comes in raster format, with a raster for each
date of interest. For doing this in Gstat package, I need first to organize all the data into  an object of
class STFDF. I would like to know if anybody knows a way of creating a STFDF object from a stack of rasters
from different times.
Thanks
Sebastian Botero. 		 	   		  
	[[alternative HTML version deleted]]
Mathieu Rajerison | 21 May 2013 11:22
Picon

SpatialLines to Graph object - computing the longest path - misconstruction

Hello,

I have a lines shapefile that I converted to a graph object, following the
method in http://www.mail-archive.com/r-sig-geo <at> r-project.org/msg05836.html

I have determined the farthest nodes of the graph.

Then, I tried to determine the diameter's path  but the result is odd as
the attached file shows.

The problem may come from the SpatialLines to graph conversion..But I can't
see where the problem is...

Any help would be greatly appreciated...

I've put the example data I used if you want to give it a try

Here is the code:

# READ
l <- readOGR("IN/testline.shp", "testline")
l.break <- gIntersection(l, l)
l.split <- SpatialLines(lapply(1:length(l.break <at> lines[[1]] <at> Lines),
function(x) Lines(list(l.break <at> lines[[1]] <at> Lines[[x]]), ID=as.character(x))))

#GRAPH
edges =
do.call(rbind,lapply(1:length(l.split),function(x){as.vector(t(l.split <at> lines
[[x]] <at> Lines[[1]] <at> coords))}))
lengths = sqrt((edges[,1]-edges[,3])^2+(edges[,2]-edges[,4])^2)
(Continue reading)

Dong Liang | 21 May 2013 04:19
Picon
Favicon

spatiotemporal simulation

Hi R-Sig-Geo group,

I need to do large spatiotemporal simulation with non-seperable and
nonstationary covariance function.  Are there existing packages for such
task?

If this is not the appropriate group, please advise a correct discussion
group for my question.

Regards
Dong

	[[alternative HTML version deleted]]
Kalomenopoulos, Manos | 20 May 2013 20:25
Picon

Problem with extract {raster} function

Hi everybody,
I am experiencing a problem with the extract{raster} function, specifically the 'weights' argument.

I have a raster and a polygon shapefile with 5 polygons (land cover classes).
I am using extract to obtain cellnumbers and the weights (percentage of cover of each class per raster
cell). 
The sum of the five weights per cell should sum to 100% (except for those cells not completely inside my AOI). 
However, there is an considerable amount of cells were that is not the case.
I have been trying to track down the error, but can't understand it so far.

I localized the erroneous cells in one example site (10x10km) and clipped the original shapefile to a
smaller area containing these cells.
The script below does the extraction once for the 10x10km sample and once for a smaller testsite containing
10 erroneous cells.
Surprisingly, doing the extraction with the smaller testsite ALL weights sum up to 100%, even though the
polygon data is exactly the same.... 
Any ideas why and/or suggestions how to make it work properly for the bigger extent?

Here my script:

library(raster)
library(reshape)

# raster of AOI
 r <- raster('1site.tif')
# polygon shapefile of AOI with 5 different classes
  s1pol <- shapefile('1site.shp')

# polygon shapefile of test area with observed errors (clipped from s1pol)
  s2pol <- shapefile('test.shp')
(Continue reading)

ToNoY | 20 May 2013 19:30
Picon
Gravatar

Cross-validaton with "geoR" for ordinary least squares fit

I've fitted a model using "geoR" package of 'R' as follows:

#ordinary least squares fit
ini.vals <- expand.grid(seq(20000,50000,l=5), seq(0.01,0.1,l=5))
ols = variofit(vario.mydata, ini=ini.vals, fix.nug=F, wei="equal")
summary(ols)
vario.mydata=variog(mydata, max.dist=0.123)
plot(vario.mydata,main="OLS")
lines(ols,lty=2,col=3, lw=2)

The summary/plot of the model is fine. But when I want to cross-validate my
model, 'R' throws me the following error which I know not beans about.

Error in if (length(data) != n) stop(paste("incompatible sizes: coords (", 
:    argument is of length zero

Any suggestions/idea why?

--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Cross-validaton-with-geoR-for-ordinary-least-squares-fit-tp7583611.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
Chuck Bulmer | 20 May 2013 18:46

saga grid format TOPTOBOTTOM

Hi all.

I am using package raster to crop some saga grids with a shapefile.

The original inut sgrd file looks like this:

NAME	= ELEV_1HA
DESCRIPTION	= 
UNIT	= 
DATAFILE_OFFSET	= 0
DATAFORMAT	= FLOAT
BYTEORDER_BIG	= FALSE
POSITION_XMIN	= 321888.3470000000
POSITION_YMIN	= 376291.6470000000
CELLCOUNT_X	= 15358
CELLCOUNT_Y	= 13473
CELLSIZE	= 100.0000000000
Z_FACTOR	= 1.000000
NODATA_VALUE	= -9999.000000
TOPTOBOTTOM	= FALSE

After using the (below) code, the output sgrd file looks like this:

NAME	= ELEV_1HA 
DESCRIPTION	= 
UNIT	= 
DATAFORMAT	= FLOAT 
DATAFILE_OFFSET	= 0
BYTEORDER_BIG	= FALSE 
POSITION_XMIN	=  1427688.347 
(Continue reading)

Paulo van Breugel | 20 May 2013 17:34
Picon
Gravatar

spgrass6: execGRASS: make the output of the command an R object.

Hi

In older version of the execGRASS function of spgrass6, setting the option
intern=TRUE would make the output of the grass command a R object.

Now, when I run execGRASS with the intern=TRUE, like the statement below,
the output is not written to the R object.

a <- execGRASS("r.univar", flags="g", map=distmod, separator=";",
intern=TRUE)

The object 'a' is created, but it is empty (character(0)). However, when I
set legacyExec=TRUE (like below), the object 'a' is created with the grass
r.univar output.

a <- execGRASS("r.univar", flags="g", map=distmod, separator=";",
legacyExec=TRUE, intern=TRUE)

Is this the intended behaviour (i.e., did I miss something in the help
file)?

I am running R version 3.0.1 (2013-05-16), on Ubuntu 13.04 64-bit

Paulo

	[[alternative HTML version deleted]]
Frederico Mestre | 20 May 2013 11:37
Picon

Re: random points with specified mean distance and std. dev.

Hello,

I think you're right, this would be very computationally intensive.

Something else I thought about was using the raster package like this:

1.       Generate first random point.

2.       Make a distance raster to this first point.

3.       Select raster cells that have a distance value that lies within the
desired values.

4.       Amongst these, randomly select one point.

5.       Repeat the process from point 2 on.

However I 'm not sure if I like this approach because it makes use of the
raster package (which I like very much), not really using it (in the
output). I don't know if my objection is clear.

This might be possible without using raster, if a "distance surface" could
be generated using coordinates. I don't know.

Thanks anyway,

Frederico 

De: Seth Myers [mailto:sjmyers3142 <at> gmail.com] 
Enviada: segunda-feira, 20 de Maio de 2013 10:15
(Continue reading)

Barry Rowlingson | 19 May 2013 09:27
Picon

Re: Random points defining mean distance

On Sun, May 19, 2013 at 2:13 AM, Frederico Mestre <
mestre.frederico <at> gmail.com> wrote:

> Hello list,
>
>
>
> Any ideas on how to generate a (almost) random pattern of points defining
> previously the mean distance, the standard deviation and the number of
> points (which will, of course, depend on the distance allowing a given
> number of points)?
>
>
>
Mean distance of what? Distance between all pairs of points in your
pattern, or nearest neighbour distances, or something else?

Barry

	[[alternative HTML version deleted]]

Gmane