Displaying 20 results from an estimated 2000 matches similar to: "[R-sig-Geo] How to extract coordinates values from a shapefile?"
2010 Jul 19
2
replacing elements of distance matrix
Hi! I am trying to implement non-bipartite matching. I have around 500 sites
which can be clustered by 10 regions. I am able to calculate pairwise
Mahalanobis distances between sites (thanks to another post in the forum).
However, I want to constrain my match to sites within the same region. Thus
I want to replace elements of the distance matrix with a high value, say
999999, for sites not of the
2010 Aug 03
4
Need help on upper.tri()
HI, I am really messing up to make a symmetrical matrix using upper.tri() & lower.tri() function. Here is my code:
> set.seed(1)
> mat = matrix(rnorm(25), 5, 5)
> mat
[,1] [,2] [,3] [,4] [,5]
[1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 0.91897737
[2,] 0.1836433 0.4874291 0.3898432 -0.01619026 0.78213630
[3,] -0.8356286 0.7383247
2010 Jun 20
3
Spatial: number of independent components?
Hi all, I am sorry if this is a very basic quesion, but I have no experience
with analyzing spatial data and could not find the right function/package
quickly. Any hints would be much appreciated. I have a matrix of spatial
point patterns like the one below and want to find the number of independent
components (if that's the right term) in that matrix (or in that image).
x=matrix(c(0,1,0,0,0,
2011 May 23
4
Distance of time in days
In rails 3 there is distance_of_time_in_words which works fine, but I would like to tweak its output a bit.
The thing is that if the dates are exactly the same it will say "Less Than a Minute" I would like it to show "Today" instead.
Is that possible?
Tiago Veloso
ti.veloso-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
--
You received this message because you are subscribed to
2010 Jul 28
2
Beginner stucked with raster + geoR package.
Hello everyone.
I am trying to build up understanding in R by trying to develop just some simple
scenarios.
I would like to explain you what I am trying to do and what I did so far.
I would like to put inside a RasterLayer (raster package) a Gaussian field (for
given covariance) using grf function (geoR package)
1. First I created a Raster Layer object
r <- raster() # Default values are
2009 Nov 06
2
another question: how to delete one of columes in two ones with high correlation(0.95)
my programe is below:
a=c(1,2,1,1,1); b=c(1,2,3,4,1); c=c(3,4,3,3,3); d=c(1,2,3,5,1);
e=c(1,5,3,5,1)
data.f=data.frame(a,b,c,d,e)
origin.data<-data.f
cor.matrix<-cor(origin.data)
origin.cor<-cor.matrix
m<-0
for(i in 1:(cor.matrix[1]-1))
{
for(j in (i+1):(cor.matrix[2]))
{
if (cor.matrix[i,j]>=0.95)
{
data.f<-data.f[,-i];
i<-i+1
}
2014 Oct 08
2
Pregunta sobre manipulación de shapefile
Oscar, al final no he podido esperar hasta mañana
Con:
library(maptools)library(sp)
poligonos <- readShapeLines("C:\\...\\DATOS\\MUNICIPIO.shp")
sink("C:\\ ... \\DATOS\\MUNICIPIO.csv")
coordinates(poligonos)
Consigo un fichero con la suficiente estructura para tratarlo fácilmente y de una tacada montar la tabla .csv tal y como he indicado en un correo anterior
Necesito el
2010 May 17
4
Adding a row at top of dataframe
I have a large data frame 48:2185 with different numbers.
I would like to add only one row at the very top of my data frame with
0's or NA's.
I don't know which approach to use. Should i create 2 different data
frames and merge them? Ive also tried the rbind command with no luck.
I would appreciate some help to achieve what I'm trying to create.
Thanks!
2010 Jul 13
1
Batch file export
Dear all,
I have a code that generates data vectors within R. For example assume:
z <- rlnorm(1000, meanlog = 0, sdlog = 1)
Every time a vector has been generated I would like to export it into a csv
file. So my idea is something as follows:
for (i in 1:100) {
z <- rlnorm(1000, meanlog = 0, sdlog = 1)
write.csv(z, "c:/z_i.csv")
Where "z_i.csv" is a filename that is
2009 Oct 22
1
Recode issue
I am having trouble with the recode function that is provided in the
CAR package. I trying to create a new factors based on existing factors.
E.g.
>x <- as.factor(1:20)
>y <- recode(x, " 1:5='A'; 6:10='B'; 11:15='C'; 16:20='D' ")
>y
[1] A A A A A 6 7 8 9 A A A A A A A A A A A
Levels: 6 7 8 9 A
Could someone point to me, my error?
2010 Oct 20
1
help identifying clusters
Dear list:
I have a dataset of geographical data that looks like this example data:
dat<- data.frame( lon = c(rnorm(1000, mean=-10), rnorm(1000, mean=10),
rnorm(1000, mean=5)),
lat = c(rnorm(1000, mean=40), rnorm(1000, mean=30), rnorm(1000, mean=0)))
plot(dat$lon, dat$lat)
My positions are clearly clustered (in this example there are 3 clusters).
Is there any R algorithm that
allows me to
2014 Oct 24
1
rgdal: Convert ESRI ArcGis geo database (gdb directory) to geojson, or shapefile map
Hello,
I have an ESRI ArGis geo database directory which I would like to convert
to geojson or a shape file (or anything else that I can read into R).
Unfortunately that does not work out of the box with rgdal, because it does
not come with the fileGDB or openfileGDB driver.
I could successfully install gdal and the fileGDB driver/extension, but it
seems that i can use gdal only to convert the
2010 Jul 25
1
Left Outer Join 2 DF's on Multiple Conditions
Hi,
I am trying to execute the following SQL statement using two data frames:
tab1, tab2 : Two Tables
Select tab1.*, tab2.*, tab1.tobiiTime - tab2.ruiTime as timeDiff,
IFNULL(n-m, -9999999) as alwaysIncrement
FROM tab1
LEFT OUTER JOIN tab2 On tab1.data1 - tab2.mouseX = 0 And tab1.data2 -
tab2.mouseY = 0
I am trying to do the following in R:-
*#Getting error here:*
data
2014 Oct 08
4
Pregunta sobre manipulación de shapefile
Gracias Beatriz, efectivamente, lo que indicas en tu ejemplo es lo que obtengo al final de mi proceso.
En todo caso pruebo tu opción con mis datos, si es como imagino seguro que es más rápida de montar y más elegante que tratar el resultado de un sink() (recuerdo que en su momento lo intenté con fotify pero no supe bien como atacarlo, no conocía el enlace que me mandas, por tanto lo pruebo de
2010 Jul 22
1
Updating a Data Frame
Hi,
I have a global data-frame in my R script.
At some point in my script, I want to update certain columns of this
data-frame by calling in an update function.
The function looks like this:
# get events data. This populates a global event data frame in the R-script
events <- getEvents(con, eventsFilePath)
# events has columns eventid, timeStamp, isSynchronized, timeDiff; with
millions of
2010 Aug 09
2
efficient matrix element comparison
It is a simple problem in that I simply want to convert the For loop to a more efficient method. It simply loops through a large vector checking if the numeric element is not equal to the index of that element. The following example demonstrates a simplified example:
> rows <- 10
> collusionM <- Matrix(0,10,10,sparse=TRUE)
> matchM <- matrix(c(1,2,3,4,4,6,7,9,9,10))
>
>
2010 Jul 07
1
Batch files process and String parsing
Here are what i am going to accomplish:
I have 400 files named as xxx.txt. the content of the file looks like the
following:
name count
1. aaa 100
2. bbb 2000
3. ccc 300
4. ddd 3000
........
more that 1000 rows in each files.
these are the areas i need help:
1. how can i only read in the files with the string patterns ggg or fff as
part of the file names?
for instance, I
2010 Jun 05
1
Issues with unionSpatialPolygons on Ubuntu
Hi,
I've cross posted with r-sig-debian since they may be an issue for
linux (never had this problem on my windows machine...)
I recently made the switch to Ubuntu 10.04 (lucid), and found that
unionSpatialPolygons() gives me the following error when trying to
combine polygons within a shapefile:
# Read in shapefile and merge polygons
foo <- readShapePoly("foo.shp",
2010 Aug 01
3
Meaning of following function
Hi friends, I am aware of the function "-"() which acts as minus in ordinary computations. For example:
> "-"(3, 1)
[1] 2
However what is the meaning of
> "-"(3)
[1] -3
I was expecting R to generate some error as it does for "*"(3). What is the logic for that calculation?
Thanks,
[[alternative HTML version deleted]]
2010 Jun 18
2
Find the 50 highest values in a matrix
Hi,
I have a huge matrix (4000 * 2000 data points) and I would like to retrieve
the coordinates (column and row) for the top 50 (or x) values. Some
positions in the matrix have NA as a value. These should be discarded.
My current method is to replace all NAs by 0, then rank all the values and
then extract the positions with the 50 highest ranks. It is very
time-consuming!
Is there a simpler