Re: [R-sig-Geo] R packages for multivariate spatial models
Hi, That's a huge topic! You might start by going to rseek.org and searching for multivariate spatial models. There are many packages that perform that kind of analysis. Browsing the Spatial task view at https://cran.r-project.org/web/views/ and maybe also the Multivariate task view might give you a broader view of the multivariate and spatial capabilities of R packages. If you can't find what you are looking for, a more specific question might get you more specific answers. :) Sarah On Sun, Apr 7, 2024 at 5:14 PM Manuel Spínola wrote: > > Dear list members, > > I am looking for suggestions of R packages to fit multivariate spatial > models. > > > -- > *Manuel Spínola, Ph.D.* > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Sarah Goslee (she/her) http://www.numberwright.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] rast() in terra doesn't show cell values
Hi Noah, It appears to be the same problem as this: [reading rasters in r using terra package](https://gis.stackexchange.com/questions/398061/reading-rasters-in-r-using-terra-package). As in that question, adding 0 forces the conversion, but loses all the information about color table, etc. canopy <- rast('nlcd_2016_treecanopy_2019_08_31.img', lyrs=1) c2 <- canopy + 0 > c2 class : SpatRaster dimensions : 104424, 161190, 1 (nrow, ncol, nlyr) resolution : 30, 30 (x, y) extent : -2493045, 2342655, 177285, 3310005 (xmin, xmax, ymin, ymax) coord. ref. : Albers Conical Equal Area source : spat_t0Rj6gEgi2CzsAZ_16778.tif name: Histogram min value : 0 max value : 255 I didn't try the devel version of terra, though. Sarah On Wed, Mar 8, 2023 at 6:17 AM Noah Charney wrote: > > Hi, > Can someone tell me what I'm missing? I can't get the rast() function in > terra to return the actual cell values from an .img file, it just keeps > giving strange histogram values. The plot() looks ok, except the legend > has those same useless values. Similarly on the categorical NLCD Land > Cover layer it gives me data associated with each cell value (e.g. land > cover type), which is fine to work with, but still not the actual cell > values as I'd expect. The old raster() function in raster package works > fine (see below). Thanks for insights! -Noah > > > #Download Tree Canopy Layer from NLCD > > # https://www.mrlc.gov/data/nlcd-2016-usfs-tree-canopy-cover-conus > > > > #terra package gives me nonsensical histogram values > > library(terra) > > canopy <- rast('D:/GIS/Land > Cover/nlcd_2016_treecanopy_2019_08_31/nlcd_2016_treecanopy_2019_08_31.img') > > canopy > class : SpatRaster > dimensions : 104424, 161190, 1 (nrow, ncol, nlyr) > resolution : 30, 30 (x, y) > extent : -2493045, 2342655, 177285, 3310005 (xmin, xmax, ymin, ymax) > coord. ref. : Albers Conical Equal Area > source : nlcd_2016_treecanopy_2019_08_31.img > color table : 1 > categories : Histogram, Red, Green, Blue > name: Histogram > min value : 5737352684 > max value : 7854320129 > > plot(canopy) > > canopy[5,5] > Histogram > 1 24314964 > > extract(canopy,data.frame(x=100,y=100)) > ID Histogram > 1 1 44832754 > > > > #raster package works fine > > library(raster) > > canopy <- raster('D:/GIS/Land > Cover/nlcd_2016_treecanopy_2019_08_31/nlcd_2016_treecanopy_2019_08_31.img') > > canopy > class : RasterLayer > dimensions : 104424, 161190, 16832104560 (nrow, ncol, ncell) > resolution : 30, 30 (x, y) > extent : -2493045, 2342655, 177285, 3310005 (xmin, xmax, ymin, ymax) > crs: +proj=aea +lat_0=23 +lon_0=-96 +lat_1=29.5 +lat_2=45.5 +x_0=0 > +y_0=0 +datum=NAD83 +units=m +no_defs > source : nlcd_2016_treecanopy_2019_08_31.img > names : Histogram > values : 0, 255 (min, max) > attributes : > ID Histogram Red Green Blue > from: 0 5737352684 255 255 255 > to : 255 7854320129 255 255 255 > > canopy[5,5] > 24 > > extract(canopy,data.frame(x=100,y=100)) > 94 > > > > #Land Cover (categorical) layer gives associated categories (not > values) in terra > > # https://www.mrlc.gov/data/nlcd-2019-land-cover-conus > > > > nlcd <- rast('D:/GIS/Land > Cover/nlcd_2019_land_cover_l48_20210604/nlcd_2019_land_cover_l48_20210604.img') > > nlcd > class : SpatRaster > dimensions : 104424, 161190, 1 (nrow, ncol, nlyr) > resolution : 30, 30 (x, y) > extent : -2493045, 2342655, 177285, 3310005 (xmin, xmax, ymin, ymax) > coord. ref. : Albers Conical Equal Area > source : nlcd_2019_land_cover_l48_20210604.img > color table : 1 > categories : NLCD Land Cover Class, Histogram, Red, Green, Blue, Opacity > name:NLCD Land Cover Class > min value : Unclassified > max value : Emergent Herbaceous Wetlands > > nlcd[5,5] > NLCD Land Cover Class > 1 Evergreen Forest > > extract(nlcd,data.frame(x=100,y=100)) > ID NLCD Land Cover Class > 1 1 Evergreen Forest > > > > > ~~~ > Dr. Noah Charney (he/him) > Assistant Professor of Conservation Biology > Department of Wildlife, Fisheries, and Conservation Biology > University of Maine, Orono, ME > 230 Nutting Hall > (207) 581-1284 > > [[alternative HTML version deleted]] > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Sarah Goslee (she/her) http://www.numberwright.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] write to netcdf
Hi, Have you tried, for example, the methods in the RNetCDF package described here? https://boris.unibe.ch/47220/7/Michna_Woods.pdf You are likely to get more useful (and faster) responses if you tell us what you've tried, and what specifically didn't work. Sarah On Tue, Jan 14, 2020 at 9:23 AM Abdoulaye Sarr wrote: > > I have a datasets with below profile I want to write/export to netcdf : > > .@ dates : Date[1:2], format: "2019-03-15" "2019-07-30" > ..@ data :List of 2 > .. ..$ 2019-03-15:'data.frame': 47005 obs. of 11 variables: > .. .. ..$ MeanTemperature : num [1:47005] NA NA NA NA NA NA NA NA NA > NA ... > .. .. ..$ MinTemperature : num [1:47005] NA NA NA NA NA NA NA NA NA > NA ... > .. .. ..$ MaxTemperature : num [1:47005] NA NA NA NA NA NA NA NA NA > NA ... > .. .. ..$ Precipitation : num [1:47005] 0 0 0 0 0 0 0 0 0 0 ... > > .. ..$ 2019-07-30:'data.frame': 47005 obs. of 11 variables: > .. .. ..$ MeanTemperature : num [1:47005] NA NA NA NA NA NA NA NA NA > NA ... > .. .. ..$ MinTemperature : num [1:47005] NA NA NA NA NA NA NA NA NA > NA ... > .. .. ..$ MaxTemperature : num [1:47005] NA NA NA NA NA NA NA NA NA > NA ... > .. .. ..$ Precipitation : num [1:47005] NA NA NA NA NA NA NA NA NA > NA ... > > ..@ grid :Formal class 'GridTopology' [package "sp"] with 3 slots > .. .. ..@ cellcentre.offset: Named num [1:2] 289868 1432838 > .. .. .. ..- attr(*, "names")= chr [1:2] "s1" "s2" > .. .. ..@ cellsize : num [1:2] 902 922 > .. .. ..@ cells.dim: int [1:2] 395 119 > ..@ bbox : num [1:2, 1:2] 289417 1432377 645707 1542095 > .. ..- attr(*, "dimnames")=List of 2 > .. .. ..$ : chr [1:2] "s1" "s2" > .. .. ..$ : chr [1:2] "min" "max" > ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot > .. .. ..@ projargs: chr "+init=epsg:32628 +proj=utm +zone=28 +datum=WGS84 > +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0" > > Any hint on this much appreciated. > > AS -- Sarah Goslee (she/her) http://www.numberwright.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Kriging question, please
Hi Erin, I'm not sure what you mean by "irregular data." There's no requirement that points be on a grid, and that's the only thing I can think of, but I'm not sure how you'd get the idea that that was required given the existence of the basic tutorials using the meuse dataset. https://rpubs.com/nabilabd/118172 So, please expand on your question. Sarah On Thu, Dec 19, 2019 at 1:04 PM Erin Hodgess wrote: > > Hello! > > Is there a method for Kriging for irregular data, please? I’m about 99.9% > sure that there is not, but just thought I would double check. > > Thanks so much for your help! > > Happy Holidays! > > Sincerely, > Erin > > -- > Erin Hodgess, PhD > mailto: erinm.hodg...@gmail.com > > [[alternative HTML version deleted]] > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Sarah Goslee (she/her) http://www.numberwright.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Comparing distance among point pattern events
Hi, Great question, and clear example. The first problem: ACd<-pairdist(A) instead of ACd <- pairdist(AC) BUT pairdist() is the wrong function: that calculates the mean distance between ALL points, A to A and C to C as well as A to C. You need crossdist() instead. The most flexible approach is to roll your own permutation test. That will work even if B and C are different sizes, etc. If you specify the problem more exactly, there are probably parametric tests, but I like permutation tests. library(spatstat) set.seed(2019) A <- rpoispp(100) ## First event B <- rpoispp(50) ## Second event C <- rpoispp(50) ## Third event plot(A, pch=16) plot(B, col="red", add=T) plot(C, col="blue", add=T) ABd<-crossdist(A, B) ACd<-crossdist(A, C) mean(ABd) # 0.5168865 mean(ACd) # 0.5070118 # test the hypothesis that ABd is equal to ACd nperm <- 999 permout <- data.frame(ABd = rep(NA, nperm), ACd = rep(NA, nperm)) # create framework for a random assignment of B and C to the existing points BC <- superimpose(B, C) B.len <- npoints(B) C.len <- npoints(C) B.sampvect <- c(rep(TRUE, B.len), rep(FALSE, C.len)) set.seed(2019) for(i in seq_len(nperm)) { B.sampvect <- sample(B.sampvect) B.perm <- BC[B.sampvect] C.perm <- BC[!B.sampvect] permout[i, ] <- c(mean(crossdist(A, B.perm)), mean(crossdist(A, C.perm))) } boxplot(permout$ABd - permout$ACd) points(1, mean(ABd) - mean(ACd), col="red") table(abs(mean(ABd) - mean(ACd)) >= abs(permout$ABd - permout$ACd)) # FALSE TRUE # 573 426 sum(abs(mean(ABd) - mean(ACd)) >= abs(permout$ABd - permout$ACd)) / nperm # 0.4264264 The difference between ACd and ABd is indistinguishable from that obtained by a random resampling of B and C. Sarah On Fri, Nov 22, 2019 at 8:26 AM ASANTOS via R-sig-Geo wrote: > > Dear R-Sig-Geo Members, > > I have the hypothetical point process situation: > > library(spatstat) > set.seed(2019) > A <- rpoispp(100) ## First event > B <- rpoispp(50) ## Second event > C <- rpoispp(50) ## Third event > plot(A, pch=16) > plot(B, col="red", add=T) > plot(C, col="blue", add=T) > > I've like to know an adequate spatial approach for comparing if on > average the event B or C is more close to A. For this, I try to make: > > AB<-superimpose(A,B) > ABd<-pairdist(AB) > AC<-superimpose(A,C) > ACd<-pairdist(A) > mean(ABd) > #[1] 0.5112954 > mean(ACd) > #[1] 0.5035042 > > With this naive approach, I concluded that event C is more close of A > that B. This sounds enough for a final conclusion or more robust > analysis is possible? > > Thanks in advance, > > Alexandre > -- Sarah Goslee (she/her) http://www.numberwright.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Variable importance bar plot
It's not entirely clear to me how you expect the values to be calculated, but you might look at partial dependence plots, for example as implemented in the pdp package. Sarah On Sun, Oct 27, 2019 at 6:00 AM Enoch Gyamfi Ampadu wrote: > > Dear List, > > I hope this finds you well. Please I have done a Land cover classification > using randomForest. I used selected satellite image bands as input > variables. I have four thematic classes. I obtained the general variable > importance using *varImpPlot (my model) . *Now I want to have bar chart > plot showing each thematic class and the variable importance for each > class. That is, how each band is ranked in predicting a thematic class. I > tried using this function: > > *importance = varImp(my model, scale= TRUE)* > > *plot (importance. * > > However it did not work. I tried to put in *geom= "bar*". And I had error. > > Please I will be glad to get some assistance. > > Thank you. > > Best regards, > > Enoch > -- Sarah Goslee (she/her) http://www.numberwright.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Area calculation of forest cover classes.
Hi Enoch, It's inappropriate to email just me, rather than the whole list - I don't have the capacity to provide private tutorials. You could import your prediction maps into a GIS you're more familiar with. You could read a tutorial on the raster package, which provides tools to do what you want. If you're still struggling with basic R commands, you could read the Introduction to R that comes with it, or one of the many other tutorials that are available online and in your library. In general, this email list is excellent for "I tried this and couldn't get it to work. How do I fix my error?" and not great for "I don't know anything about R but I have this project please explain everything." So: You have a map. What format is your map? What have you tried? What didn't work? Where have you searched? What documentation have you read? Sarah On Thu, Sep 12, 2019 at 6:59 PM Enoch Gyamfi Ampadu wrote: > > Hi Sarah, > Thank you for the mail and information. Please I have done the predictions > already and have the output maps for both the RF and SVM. Find attached the > output map. There are 4 classes and I need to determine the area for each. As > I indicated I am now learning area and so not very familiar with a lot of > functions. I will be glad of you could provide me with some functions and > codes, then I will edit it to suite what I have. I realized you recommended > aggregate () and table(), but I don't know how to use them. I will be glad to > have some help from you. > > Thank you. > > Best regards, > > Enoch. > > On Thu, 12 Sep 2019 at 18:06, Sarah Goslee wrote: >> >> Hi, >> >> Without knowing any details of what you did, the general procedure is: >> >> Use your fitted Random Forest or SVM model to predict the class for >> each pixel in your region of interest - the predict() function. >> Use standard spatial data methods to aggregate the resulting spatial >> data, or even standard non-spatial methods, since you know the pixel >> size - perhaps aggregate() or even table(). >> >> Sarah >> >> On Thu, Sep 12, 2019 at 3:30 AM Enoch Gyamfi Ampadu >> wrote: >> > >> > Dear List, >> > >> > Please I have carried out an RF and SVM forest cover classification in R. I >> > want to determine the area in hectors for each of the forest cover classes. >> > I have not been able to find my way out on it. I wanted to ask if it is >> > possible to do this in R and will be glad to have assistance on how to >> > carry that out. And possibly some lead codes to use (I am still learning R >> > and and how to code.) >> > >> > Thank you. >> > >> > Best regards, >> > >> > Enoch >> > >> >> -- Sarah Goslee (she/her) http://www.numberwright.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Area calculation of forest cover classes.
Hi, Without knowing any details of what you did, the general procedure is: Use your fitted Random Forest or SVM model to predict the class for each pixel in your region of interest - the predict() function. Use standard spatial data methods to aggregate the resulting spatial data, or even standard non-spatial methods, since you know the pixel size - perhaps aggregate() or even table(). Sarah On Thu, Sep 12, 2019 at 3:30 AM Enoch Gyamfi Ampadu wrote: > > Dear List, > > Please I have carried out an RF and SVM forest cover classification in R. I > want to determine the area in hectors for each of the forest cover classes. > I have not been able to find my way out on it. I wanted to ask if it is > possible to do this in R and will be glad to have assistance on how to > carry that out. And possibly some lead codes to use (I am still learning R > and and how to code.) > > Thank you. > > Best regards, > > Enoch > -- Sarah Goslee (she/her) http://www.numberwright.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Gridding a daily time series in R
Hi, Creating the NetCDF file is easy - there are multiple packages to do that. Everything else you ask about is hard, and not really R questions. You need to know: What is the best way to impute missing precipitation data to fit my needs? What is the best way to grid point-based precipitation data to fit my needs? Both of these are very complex, and questions better suited to experts in the field. At the very least, you need to review the copious existing statistical literature on those topics. Once you have the theoretical questions answered, the question of "How do I do this in R?" might be suitable for the list. But honestly, you are probably better off finding extant gridded data for your region, rather than trying to do it yourself. Sarah On Thu, Sep 12, 2019 at 11:21 AM Cristo Facundo Pérez wrote: > > Dear community, > > I have a daily time series of precipitation, which I intend to transform it > into a single NetCDF file of daily precipitation. So, first, I would like > to explore the best way to impute missing values, grid the daily values of > the different available weather stations and get daily raster files into a > .nc format. I have read about different climate/hydrological packages such > as "hyfo", "meteoland", "gstat" and "hydroTMS". However, I haven't found a > way to do it. I am a beginner in spatial/temporal analysis with R. So, my > question is *does anybody have experience/document in developing a similar > task so I can get some ideas?* > > My database contains id, date, cod, lon, lat, elev, and precipitation value > of 41 climate stations for the period 1980-2018. I have NAs values in the > database. I organised my database in two datasets: > > 1. where the first column presents date and the other 50 columns present a > climate station, while rows present the values/NAs [14245 observations of > 42 variables]. > > 2. where the name, long, lat, and elev, are presented in the columns. 4 > columns presenting information of 41 weather stations. > > I would appreciate any input, idea or suggestion to find a way out to grid > the daily time series and get the ".nc" file. > > Thank you, > > Cristo Facundo Pérez > > [[alternative HTML version deleted]] > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Sarah Goslee (she/her) http://www.numberwright.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Data conversion
Hi, gdal_translate() by default returns NULL, but also writes your destination tiff to the specified location, in this case modisndvi.tiff in your working directory. Is that file not created? >From ?gdal_translate: Value: NULL or if(output_Raster), a RasterBrick. So what you're seeing is exactly what I'd expect if everything worked perfectly. Your commands don't load anything into R. If that's your goal, you could set output_Raster=TRUE. Here's an actual reproducible example. library(rgdal) library(gdalUtils) hdf4_dataset <- system.file("external/test_modis.hdf", package="gdalUtils") all.subsets <- get_subdatasets(hdf4_dataset) # returns NULL as expected gdalUtils::gdal_translate(src_dataset = all.subsets[1], dst_dataset = "testfile.tiff") # shows testfile.tiff in the working directory, as expected list.files(pattern=".tiff") If that reproducible example does not work on your system, and testfile.tiff is not created, then we need more information, like the output of sessionInfo(), and confirmation that you have a correctly installed GDAL. Sarah On Tue, Aug 27, 2019 at 3:46 PM Fatih Kara wrote: > > Hi, > > I have a very simple problem which I couldn't solve nowadays: I can't convert > '.hdf' files to '.tif' files. > > I use this code: > > install.packages("raster",dependencies = TRUE) > install.packages("rgdal",dependencies = TRUE) > install.packages("rgeos",dependencies = TRUE) > install.packages("sp",dependencies = TRUE) > install.packages("lwgeom", dependencies = TRUE) > library(raster) > library(lwgeom) > library(maptools) > library(rgdal) > library(gdalUtils) > > subsets <- gdalUtils::get_subdatasets("modisndvi.hdf"[1]) > gdalUtils::gdal_translate(src_dataset = subsets[1], dst_dataset = > "modisndvi.tiff") > > NULL > > What can I do? > > -- > Fatih Kara > -- Sarah Goslee (she/her) http://www.numberwright.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] extract data from multilayer nc file
Hi Antonio, I work with NetCDF files a lot, and I find it enormously easier to split up multidimensional files before importing them into R. I use NCO for this (http://nco.sourceforge.net/) but I'm sure there are other options. I'm afraid I have no idea how well that works on windows. For your sample file, here's how you could split it by depth and by variable. ncks -d depth,0,0 -v to dataset-armor-3d-rep-monthly_1559213337443.nc vo50.nc ncks -d depth,0,0 -v so dataset-armor-3d-rep-monthly_1559213337443.nc so50.nc ncks -d depth,1,1 -v to dataset-armor-3d-rep-monthly_1559213337443.nc vo75.nc ncks -d depth,1,1 -v so dataset-armor-3d-rep-monthly_1559213337443.nc so75.nc > library(raster) Loading required package: sp > vo75 <- stack("vo75.nc") Loading required namespace: ncdf4 > dim(vo75) [1] 29 41 12 Sarah On Thu, May 30, 2019 at 10:24 AM Antonio Silva wrote: > > Hello all, > > I want to extract monthly sea water temperature and salinity (50 and 75 m > depth) for a given area. > > To do so I downloaded dataset-armor-3d-rep-monthly (product > MULTIOBS_GLO_PHY_REP_015_002) from Copernicus Marine environment monitoring > service (http://marine.copernicus.eu/). A sample file can be found at > https://app.box.com/s/f8yyf3jn9kye1htqc7aktjk38jp39yrm. > > I also prepared a shapefile delimiting the area of interest ( > https://app.box.com/s/ciq76w7918zir3hu89l8d3y9dn3csuxp). > > Some time ago I dealt with monthly salinity data files, that is, with only > one variable. I prepared a script and made it available at > https://gist.github.com/aolinto/59e43cdbac3ff3e0cd5eb2eab5efcbc4. > > Now I have a nc file with several variables (so and to) and each one has 4 > dimensions (time (for each month), lat, lon and depth (50 and 75 m)). > > For a file with 3 dimensions per variable I write > rst.data <- > stack("dataset-sss-ssd-rep-monthly_sos_2008_2017.nc",varname="sos") > > > But this turn I receive the message > > rst.data <- > > stack("dataset-armor-3d-rep-monthly_1559213337443.nc",varname="to") > # indicate the nc file > Warning messages: > 1: In .stackCDF(x, varname = varname, bands = bands) : > to has 4 dimensions, I am using the last one > 2: In .rasterObjectFromCDF(x, type = objecttype, band = band, ...) : > "level" set to 1 (there are 2 levels) > > I tried several commands (bands, layers) but I couldn't make a stack to 50 > and another to 75 data. > > I appreciate any help. > > Best regards, > > Antônio Olinto > Instituto de Pesca (Fisheries Institute) > São Paulo, Brasil > > [[alternative HTML version deleted]] > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Sarah Goslee (she/her) http://www.numberwright.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] GRID based calculations
Hi, You probably haven't gotten any answers because this is an extremely vague question, and a problem not very well suited for R. You could do the preliminary calculations in R, but other GIS software is more suited to the point and click model. If you run into specific problems with R code, we can certainly help, but with a question this general all I can really suggest are a. Lots of time with google. b. Looking at similar applications developed by other people. c. Hiring a GIS programmer. Best, Sarah On Thu, May 23, 2019 at 8:20 AM Fatih Kara wrote: > > Hi, > > We are developing a grid based database which provides several types of data. > One of the layers in this database will be land cover data with 30 land cover > types. Our grids will cover almost 90 pixels and our purpose is that if > someone click on the grid, percentage of land cover types should be seen > automatically like 20% forest, 30% water, and 50% grass. > > What should we do? Is there any related code samples? > > Thanks > -- > Fatih Kara > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Sarah Goslee (she/her) http://www.numberwright.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Converting a variable's units from gigatons to teratons
ncvar_get() should return a data frame, so just get2.teratons <- get2 / 1000 Even if it's a higher-dimensional array, that will work. You could then write it back with ncvar_put(), subject to the data type of that variable in the NetCDF file. Sarah On Thu, Mar 28, 2019 at 11:55 AM rain1290--- via R-sig-Geo wrote: > > Hi there, > I am currently working with a variable whose units are expressed in gigatons. > However, I would like to convert all of these values in this variable to > teratons. Effectively, I would have to somehow have R divide all values (90 > values) within the variable by 1000. > So far, I have read in the variable (called CanESM2) as follows: > ncfname1 <- "cumulative_emissions_RCP45.nc" > Model3 <- nc_open(ncfname1) > get2 <- ncvar_get(Model3, "CanESM2") > Is there a way to accomplish this conversion? > Thanks, and any assistance would be greatly appreciated! > > [[alternative HTML version deleted]] > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Sarah Goslee (she/her) http://www.numberwright.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] editing a correlogram
Of course. The ... argument to the plot method means that you can use standard base graphics options to customize as you wish. ?par gives the whole list, although they may not all be useful for correlograms. If you have specific questions after you try customizing to your liking, the list can certainly help with details. Sarah On Sat, Mar 16, 2019 at 11:00 AM Leonardo Matheus Servino wrote: > > Hello, > > I've been tried to use the function "sp.correlogram". After plot the > correlogram, I would like to edit the grafic's appearence, to publish it. > It is possible? > > Thanks > > -- > Leonardo Matheus Servino > Pós-Graduação em Evolução e Diversidade > Universidade Federal do ABC - UFABC - Centro de Ciências Naturais e Humanas > -- Sarah Goslee (she/her) http://www.numberwright.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Geographically weighted regression
The first step should be to look at str(Daten90) str(Daten10) and if that doesn't solve the problem, then consider a reproducible example, or at the very least posting the results of the above to this list. Sarah On Fri, Feb 22, 2019 at 7:38 AM wrote: > > Dear all, > > I am currently working out a geographically weighted regression, in which 90% > of the data set the model should be calculated and for 10% of the values to > be predicted. For the prediction I use the function gwr.predict from the > package GWModel: > > Erg<-gwr.predict(formula=Ziel~ as.factor(Var1) + log(Var2, base = exp(1)) + > Var3, data = Daten90,predictdata = Daten10,bw = bwG, kernel = > "gaussian",adaptive = FALSE, p = 2, theta = 0, longlat = FALSE) > > I always get this error, although Daten10 and Daten90 have the same structure: > Error in gwr.predict(formula = Ziel~ as.factor(Var1) + log(Var2, base = > exp(1)) + Var3, : > All the independent variables should be included in the predictdata. > > Can you tell me what the problem with this code is? > Or is there any other way for a GWR and the prediction? > > Thank you, > Christoph > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Sarah Goslee (she/her) http://www.numberwright.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] error when trying to use RStudio within GRASS
gt; NUMBER_OF_PROCESSORS8 > > OneDriveC:\Users\...\OneDrive > > OS Windows_NT > > PATHC:\Program > > > Files\R\R-3.5.1\bin\x64;C:\Rtools\bin;C:\ProgramData\Oracle\Java\javapath;c:\Rtools\gcc-4.6.3\bin;C:\Program > > Files (x86)\Intel\iCLS Client\;C:\Program > > Files\Intel\iCLS > > > Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program > > Files\Intel\Intel(R) Management Engine > > Components\DAL;C:\Program Files\Intel\Intel(R) > > Management Engine Components\IPT;C:\Program > Files > > (x86)\Intel\Intel(R) Management Engine > > Components\DAL;C:\Program Files > (x86)\Intel\Intel(R) > > Management Engine Components\IPT;C:\Program > Files > > (x86)\ATI > Technologies\ATI.ACE\Core-Static;C:\Program > > Files\MiKTeX 2.9\miktex\bin\x64\;C:\Program > > Files\Git\cmd;C:\Program Files > > (x86)\Skype\Phone\;C:\Program > > Files\R\R-3.5.1\bin\x64;C:\Program > > > Files\RStudio\bin;C:\WINDOWS\System32\OpenSSH\;C:\Program > > Files (x86)\Calibre2\;C:\Program > > Files\Intel\WiFi\bin\;C:\Program Files\Common > > Files\Intel\WirelessCommon\;C:\Users\... > \AppData\Local\Microsoft\WindowsApps > > PATHEXT > .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC > > PROCESSOR_ARCHITECTURE AMD64 > > PROCESSOR_IDENTIFIERIntel64 Family 6 Model 60 Stepping 3, > GenuineIntel > > PROCESSOR_LEVEL 6 > > PROCESSOR_REVISION 3c03 > > ProgramData C:\ProgramData > > ProgramFilesC:\Program Files > > ProgramFiles(x86) C:\Program Files (x86) > > ProgramW6432C:\Program Files > > PROJ_LIBC:/Program Files/R/R-3.5.1/library/rgdal/proj > > PSModulePath > C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ > > PUBLIC C:\Users\Public > > R_ARCH /x64 > > R_COMPILED_BY gcc 4.9.3 > > R_DOC_DIR C:/PROGRA~1/R/R-35~1.1/doc > > R_HOME C:/PROGRA~1/R/R-35~1.1 > > R_LIBS_USER C:\Program Files\R\R-3.5.1\library > > R_MAP_DATA_DIR C:/Program > Files/R/R-3.5.1/library/maps/mapdata/ > > R_MAP_DATA_DIR_WORLDC:/Program > Files/R/R-3.5.1/library/maps/mapdata/ > > R_USER C:/Users/…/Documents > > RCRAN C:\Program Files\R\R-3.5.1\bin\x64 > > RMARKDOWN_MATHJAX_PATH C:/Program Files/RStudio/resources/mathjax-26 > > RS_LOCAL_PEER \\.\pipe\30976-rsession > > RS_RPOSTBACK_PATH C:/Program Files/RStudio/bin/rpostback > > RS_SHARED_SECRET63341846741 > > RSTUDIO 1 > > RSTUDIO_CONSOLE_COLOR 256 > > RSTUDIO_CONSOLE_WIDTH 80 > > RSTUDIO_MSYS_SSHC:/Program Files/RStudio/bin/msys-ssh-1000-18 > > RSTUDIO_PANDOC C:/Program Files/RStudio/bin/pandoc > > RSTUDIO_SESSION_PORT30976 > > RSTUDIO_USER_IDENTITY … > > RSTUDIO_WINUTILSC:/Program Files/RStudio/bin/winutils > > SystemDrive C: > > SystemRoot C:\WINDOWS > > TEMPC:\Users\...\AppData\Local\Temp > > TERMxterm-256color > > TMP C:\Users\...\AppData\Local\Temp > > USERDOMAIN … > > USERDOMAIN_ROAMINGPROFILE … > > USERNAME… > > USERPROFILE C:\Users\... > > windir C:\WINDOWS > > > > > > > sessionInfo() > > R version 3.5.1 (2018-07-02) > > Platform: x86_64-w64-mingw32/x64 (64-bit) > > Running under: Windows >= 8 x64 (build 9200) > > > > Matrix products: default > > > > 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] stats graphics grDevices utils datasets methods base > > > > other attached packages: > > [1] dbscan_1.1-2rgdal_1.3-4 geostatsp_1.7.2 > Matrix_1.2-14 > > [5] raster_2.6-7maptools_0.9-3 maps_3.3.0 > spatstat_1.56-1 > > [9] rpart_4.1-13nlme_3.1-137spatstat.data_1.3-1 > rgrass7_0.1-10 > > [13] XML_3.98-1.16 sp_1.3-1 > > > > > > > > Thanks in advance, > > > > William > [[alternative HTML version deleted]] > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > -- Sarah Goslee (she/her) http://www.sarahgoslee.com [[alternative HTML version deleted]] ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] A practical guide to geostatistical mapping
Assuming you're looking for relevant R information, it seems like packages such as EGRET, dbhydroR, waterData, and RSAlgaeR are potentially relevant. My lab uses R extensively, including EGRET and in-house code. There's a lot of information out there, including case studies: Try a search for water quality on the incredibly useful rseek.org Most research uses the same data sources you bemoan - we sometimes have our own data, but largely rely on USGS etc. Sarah On Fri, Aug 31, 2018 at 11:03 AM Rich Shepard wrote: > > On Fri, 31 Aug 2018, Rich Shepard wrote: > > > My work as an environmental science consultant, ... means that all data > > available to me are generated by regulatory requirements, not by the needs > > for a research project. And, the overwhelming number involve aquatic > > chemistry (and biota such as fish) which adds the constant movement of the > > medium into consideration. > >I did two web searches this morning, one for 'aquatic geochemistry' the > other for 'water quality geochemistry'. They both returned many hits on > soils and ground waters, but only two related to surface waters. > >There is a need to improve on this. > >If anyone knows of documentation relevant to surface water quality, > particularly flowing waters, please point me to them. > > Regards, > > Rich > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] How do i plot a graph with x axis vertically labelled?
The graphics parameters are all in the help file for par ?par The one you need is las. Without trying to wade thru your mangled HTML data (dput() is the best way to provide reproducible data), check this out: barplot(runif(5), names.arg = c("25/08/2004", "26/09/2004", "02/11/2004", "11/11/2004", "22/11/2004"), main = 'Females 2005', ylab = ' Age/Days', xlab = 'Birth/Hatch date', las=2) You'll need to mess with label positioning, and with margin size, to get everything looking as you wish. But I'm not sure this is the most effective way to show irregularly-spaced dates. Why not convert your dates to Date or other time series, and plot them to scale as points? Sarah On Mon, Aug 13, 2018 at 6:25 AM Vasana Tutjavi via R-sig-Geo wrote: > > Dear R-sig-geo experts, > > I want to plot a bar graph with the labels on the x axis in a vertical > format. The data is the Ages of Squid (on the Y axis) and the date of Birth > on the X axis, I am struggling to change the labels on the x axis to a > vertical format and I want all the dates to show at all the bars. My data is > as follows: > Birth > Sex > Age > 25/08/2004 > F > 2 > 26/09/2004 > F > 3 > 02/11/2004 > F > 3 > 11/11/2004 > F > 1 > 22/11/2004 > F > 3 > 04/12/2004 > F > 1 > 08/12/2004 > F > 4 > 15/12/2004 > F > 4 > 21/12/2004 > F > 5 > 24/12/2004 > F > 1 > 04/01/2005 > F > 1 > 06/01/2005 > F > 3 > 13/01/2005 > F > 2 > 18/01/2005 > F > 1 > 19/01/2005 > F > 3 > 09/02/2005 > F > 2 > 11/02/2005 > F > 1 > 13/02/2005 > F > 1 > 17/02/2005 > F > 1 > 18/02/2005 > F > 8 > 19/02/2005 > F > 5 > 24/02/2005 > F > 1 > 28/02/2005 > F > 42 > 01/03/2005 > F > 1 > 07/03/2005 > F > 1 > 08/03/2005 > F > 2 > 09/03/2005 > F > 1 > 14/03/2005 > F > 7 > 16/03/2005 > F > 1 > 25/03/2005 > F > 3 > 01/04/2005 > F > 1 > 06/04/2005 > F > 5 > 07/04/2005 > F > 1 > 08/04/2005 > F > 1 > 13/04/2005 > F > 1 > 14/04/2005 > F > 1 > 27/04/2005 > F > 1 > 01/05/2005 > F > 2 > 07/05/2005 > F > 1 > 08/05/2005 > F > 2 > 16/05/2005 > F > 1 > 30/05/2005 > F > 8 > 06/06/2005 > F > 1 > Here is the script I tried: > > barplot(Females2005$Age, names.arg = c("25/08/2004", "26/09/2004", > "02/11/2004", "11/11/2004", "22/11/2004", "04/12/2004", "08/12/2004", >"15/12/2004", "21/12/2004", > "24/12/2004", "04/01/2005", "06/01/2005", "13/01/2005", "18/01/2005", >"19/01/2005", "09/02/2005", > "11/02/2005", "13/02/2005", "17/02/2005", "18/02/2005", "19/02/2005", > "24/02/2005", "28/02/2005", > "01/03/2005", "07/03/2005", "08/03/2005", "09/03/2005", "14/03/2005", > "16/03/2005", "25/03/2005", "01/04/2005", > "06/04/2005", "07/04/2005", "08/04/2005", "13/04/2005", > "14/04/2005", "27/04/2005", > "01/05/2005", "07/05/2005", "08/05/2005", "16/05/2005", "30/05/2005", > "06/06/2005"), main = 'Females 2005', > ylab = 'Age/Days', xlab = 'Birth/Hatch date') > > Many thanks > Vasana > Sent from Mail for Windows 10 > > > [[alternative HTML version deleted]] > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Transform hexagonal to raster - a wife's question
Hi! I nearly didn't open this email thread: glad I did! I have some odd R tools for weaving, but nothing for beading. I suspect this is the best way to do it, although the actual result would depend on the particular pattern. http://www.bellaonline.com/articles/art61406.asp Whether it's worth writing R code to perform this task depends a lot on how many patterns need to be converted. A more R-geo approach might be to import the original pattern from an image file, turn it into spatial polygons, then rasterize it, completely ignoring the hexagonal nature of the original. With some playing with the raster grid size, you could probably get a decent approximation. Sarah On Mon, Jul 30, 2018 at 10:40 AM, chris english wrote: > Thank you Ben!, I'll actually send her directly > to Sarah, http://www.sarahgoslee.com/ . > Dr. Massa, meet Dr. Goslee, Professor of indeterminate studies & weaver, > and writer, > Dr. Goslee, meet Dr. Massa, cognitive neuro research scientist, felter and > loom beader. > Thanks again, > Chris > > On Mon, Jul 30, 2018 at 9:12 AM, Ben Tupper wrote: > >> If I were in your shoes I would be doing a hop-skip to ring Sarah Goslee's >> doorbell. She's our resident ecology-spatial-textiles guru... >> >> http://www.stringpage.com/ >> >> >> >> >> >> >> >> On Jul 29, 2018, at 12:26 AM, chris english >> wrote: >> >> My wife showed me a beading pattern that she was working on that looks to >> my eye like a hexagonal grid, its called a peyote stitch, and she needs to >> transform it to a loom stitch, essentially a raster. In the beading world >> they suggest combining two rows into one. If asked, what have you tried, I >> would say I tried to duck, but... In practical application, the two rows >> equals one doesn't appear to preserve the desired pattern when beading the >> loom, probably something like netting out the half-steps when you're going >> from two rows to one = n+1 or n +2 for bead count on the combined row. >> 40x40 hex grid, OK, I'll get out my graph paper. Summer. >> >> Thank you for your forbearance, and any very general thoughts appreciated, >> ie transforms sans datums & etc. >> >> Chris >> ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] rgdal installation on Fedora 28
I can confirm that the patched R-Forge version of rgdal installs correctly on my systems with no other change. Thank you to Roger and Colin, and everyone else who took a look. The R community is the BEST. Sarah On Sat, Jun 16, 2018 at 5:55 PM, Roger Bivand wrote: > On Sat, 16 Jun 2018, Colin Rundel wrote: > >> As I mentioned in the tweet, I was able to fix this on both a Fedora 23 >> and >> Fedora 27 machine by making the following change to configure.ac: >> >> diff --git a/configure.ac b/configure.ac >> index 8ff72be..ab4c772 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -3,6 +3,8 @@ define([pkgversion], esyscmd([sh -c "grep Version: >> DESCRIPTION | cut -d' ' -f2 | >> AC_INIT(rgdal, [pkgversion], roger.biv...@nhh.no) >> AC_CONFIG_SRCDIR(src/gdal-bindings.cpp) >> >> +AC_PROG_CXX() >> + >> # find R home and set correct compiler + flags >> : ${R_HOME=`R RHOME`} >> if test -z "${R_HOME}"; then >> >> rerunning autoconf (also assuming m4/ax_cxx_compile_stdcxx.m4 is added) >> results in ./configure working for me. I don't have a deep enough >> understanding of the vagaries of autoconf to know why exactly this is >> necessary on redhat systems and why this fixes it but at least everything >> seems to work. > > > Thanks very much, committed to R-forge as revision 758. > > Roger > > >> >> -Colin >> >> On Fri, Jun 15, 2018 at 7:29 PM Thiago V. dos Santos via R-sig-Geo < >> r-sig-geo@r-project.org> wrote: >> >>> The following lines in your config.log: >>> >>> /usr/bin/ld: /tmp/cc9pfZ1b.o: relocation R_X86_64_32 against .rodata' can >>> not be used when making a shared object; recompile with -fPIC >>> >>> make me wonder: maybe there is a -fPIC compilation flag lacking for you >>> platform in the makefile? >>> >>> Greetings, -- Thiago V. dos Santos >>> Postdoctoral Research FellowDepartment of Climate and Space Science and >>> EngineeringUniversity of Michigan >>> >>> On Friday, June 15, 2018, 3:27:44 PM EDT, Sarah Goslee < >>> sarah.gos...@gmail.com> wrote: >>> >>> Hi folks, >>> >>> I updated all of my linux computers to Fedora 28, and now can’t install >>> rgdal. >>> >>> I can install sf with no problems, so it doesn't appear to be an issue >>> with GDAL or with proj. >>> >>> I checked with Roger Bivand, the package maintainer, who asked me to >>> confirm whether I could install sf, to make sure it wasn’t a >>> dependency issue, and to post the logs online, then ask on the >>> R-sig-geo mailing list. I’m putting the full problem here, and the >>> abbreviated version on the mailing list. >>> >>> I’d appreciate any thoughts: I rely very heavily on the incredibly >>> useful rgdal package. >>> >>>> sessionInfo() >>> >>> R version 3.5.0 (2018-04-23) >>> Platform: x86_64-redhat-linux-gnu (64-bit) >>> Running under: Fedora 28 (Workstation Edition) >>> >>> Matrix products: default >>> BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so >>> >>> locale: >>> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C >>> [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 >>> [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 >>> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C >>> [9] LC_ADDRESS=C LC_TELEPHONE=C >>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C >>> >>> attached base packages: >>> [1] statsgraphics grDevices utilsdatasets methods base >>> >>> loaded via a namespace (and not attached): >>> [1] compiler_3.5.0 tools_3.5.0 >>> >>> >>> The install message is: >>> >>> installing *source* package ‘rgdal’ ... >>> ** package ‘rgdal’ successfully unpacked and MD5 sums checked >>> configure: CC: gcc -m64 >>> configure: CXX: g++ -m64 >>> configure: rgdal: 1.3-2 >>> checking for /usr/bin/svnversion... no >>> configure: svn revision: 755 >>> checking whether the C++ compiler works... yes >>> checking for C++ compiler default output file name... a.out >>> checking for suffix of executables... >>> checking whether we are cross compiling... configure: error: in >>> `/tmp/RtmpfMGBY5/R.INSTALL66c3b8deddb/rgdal': >>> configure: error: cannot run C++ compiled programs. >>> If you meant to cross compile, use `--host'. >>> See `config.log' for more details >>> ERROR: configuration failed for package ‘rgdal’ >>> * removing ‘/usr/lib64/R/library/rgdal’ >>> * restoring previous ‘/usr/lib64/R/library/rgdal’ >>> >>> >>> The complete information and config.log are posted online at: >>> >>> http://numberwright.com/2018/06/stuck-on-rgdal/ >>> >>> >>> Any ideas? Or any other information that would be useful? >>> >>> Thanks! >>> Sarah >>> ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] rgdal installation on Fedora 28
If you read that whole thread, as far as I can tell it's a permissions error, possibly due to using an external drive. I can't see how it would apply to installing an R package from /tmp as root. Other compiled packages install correctly; rgdal is the only one giving me this error. Am I missing something in that thread? Sarah On Fri, Jun 15, 2018 at 4:31 PM Ista Zahn wrote: > > https://askubuntu.com/questions/360329/error-cannot-run-c-compiled-programs-if-you-meant-to-cross-compile-use-host > might help. > > --Ista > > On Fri, Jun 15, 2018 at 3:27 PM, Sarah Goslee > wrote: > > Hi folks, > > > > I updated all of my linux computers to Fedora 28, and now can’t install > rgdal. > > > > I can install sf with no problems, so it doesn't appear to be an issue > > with GDAL or with proj. > > > > I checked with Roger Bivand, the package maintainer, who asked me to > > confirm whether I could install sf, to make sure it wasn’t a > > dependency issue, and to post the logs online, then ask on the > > R-sig-geo mailing list. I’m putting the full problem here, and the > > abbreviated version on the mailing list. > > > > I’d appreciate any thoughts: I rely very heavily on the incredibly > > useful rgdal package. > > > >> sessionInfo() > > R version 3.5.0 (2018-04-23) > > Platform: x86_64-redhat-linux-gnu (64-bit) > > Running under: Fedora 28 (Workstation Edition) > > > > Matrix products: default > > BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so > > > > locale: > > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > > [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 > > [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 > > [7] LC_PAPER=en_US.UTF-8 LC_NAME=C > > [9] LC_ADDRESS=C LC_TELEPHONE=C > > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > > > attached base packages: > > [1] stats graphics grDevices utils datasets methods base > > > > loaded via a namespace (and not attached): > > [1] compiler_3.5.0 tools_3.5.0 > > > > > > The install message is: > > > > installing *source* package ‘rgdal’ ... > > ** package ‘rgdal’ successfully unpacked and MD5 sums checked > > configure: CC: gcc -m64 > > configure: CXX: g++ -m64 > > configure: rgdal: 1.3-2 > > checking for /usr/bin/svnversion... no > > configure: svn revision: 755 > > checking whether the C++ compiler works... yes > > checking for C++ compiler default output file name... a.out > > checking for suffix of executables... > > checking whether we are cross compiling... configure: error: in > > `/tmp/RtmpfMGBY5/R.INSTALL66c3b8deddb/rgdal': > > configure: error: cannot run C++ compiled programs. > > If you meant to cross compile, use `--host'. > > See `config.log' for more details > > ERROR: configuration failed for package ‘rgdal’ > > * removing ‘/usr/lib64/R/library/rgdal’ > > * restoring previous ‘/usr/lib64/R/library/rgdal’ > > > > > > The complete information and config.log are posted online at: > > > > http://numberwright.com/2018/06/stuck-on-rgdal/ > > > > > > Any ideas? Or any other information that would be useful? > > > > Thanks! > > Sarah > > > > -- > > Sarah Goslee > > http://www.functionaldiversity.org > > > > ___ > > R-sig-Geo mailing list > > R-sig-Geo@r-project.org > > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org [[alternative HTML version deleted]] ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[R-sig-Geo] rgdal installation on Fedora 28
Hi folks, I updated all of my linux computers to Fedora 28, and now can’t install rgdal. I can install sf with no problems, so it doesn't appear to be an issue with GDAL or with proj. I checked with Roger Bivand, the package maintainer, who asked me to confirm whether I could install sf, to make sure it wasn’t a dependency issue, and to post the logs online, then ask on the R-sig-geo mailing list. I’m putting the full problem here, and the abbreviated version on the mailing list. I’d appreciate any thoughts: I rely very heavily on the incredibly useful rgdal package. > sessionInfo() R version 3.5.0 (2018-04-23) Platform: x86_64-redhat-linux-gnu (64-bit) Running under: Fedora 28 (Workstation Edition) Matrix products: default BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_3.5.0 tools_3.5.0 The install message is: installing *source* package ‘rgdal’ ... ** package ‘rgdal’ successfully unpacked and MD5 sums checked configure: CC: gcc -m64 configure: CXX: g++ -m64 configure: rgdal: 1.3-2 checking for /usr/bin/svnversion... no configure: svn revision: 755 checking whether the C++ compiler works... yes checking for C++ compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... configure: error: in `/tmp/RtmpfMGBY5/R.INSTALL66c3b8deddb/rgdal': configure: error: cannot run C++ compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details ERROR: configuration failed for package ‘rgdal’ * removing ‘/usr/lib64/R/library/rgdal’ * restoring previous ‘/usr/lib64/R/library/rgdal’ The complete information and config.log are posted online at: http://numberwright.com/2018/06/stuck-on-rgdal/ Any ideas? Or any other information that would be useful? Thanks! Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] 'help'
Hi, It's pretty much impossible, since we don't know what GIS software you used, what commands, what R package and code, or what your data look like. As a starting point, I'd suggest carefully rereading the help files for both the GIS and the R functions, to make sure that they are doing the same thing, and what you expect them to, and to review your data in both places to ensure that it is the same values and projection, etc. It is entirely possible that one software is scaling your data for you automatically, or some other processing step that is not duplicated by the other software. If trying those things doesn't clarify it for you, then please post back to the list with more information about the software and data you're using. Sarah On Sat, Apr 14, 2018 at 1:18 AM, Yalemzewod Gelaw wrote: > Hi > > I tried to compute the Moran's I statistics using GIS and R. However, I got > different values. > > Could you please brief me how the difference can occurs? > > Using GIS > > Global Moran's I Summary > > Moran's Index: 0.151485 > > Expected Index: -0.007692 > > Variance:0.001040 > > z-score: 4.935027 > > p-value: 0.01 > > > > Using R > > Moran I test under randomisation > > data: Dat$allprop > > weights: Xlist > > Moran I statistic standard deviate = 0.82453, p-value = 0.4096 > > alternative hypothesis: two.sided > > sample estimates: > > Moran I statistic Expectation Variance > > 0.034154753 -0.007299270 0.002527644 > > NB: in the neighbour links there are 2 regions with no links > > > Thank you for any help > > > > *Regards, * > > Yalem -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] DataGrid
When you create a full grid, there will be many NA values in your data for grid coordinates that you didn't provide data for. str() is only showing you the first few elements: unless your dataset has values in that corner, NA is the expected return. Use summary() or image() to investigate the whole dataset. I think you will find that you have non-missing values where appropriate. You need to then use na.rm=TRUE in many functions. Sarah On Sun, Oct 15, 2017 at 5:39 AM Anastasia Johannes wrote: > I am trying to create DataGrid but I am failing to do so > > Below find my code and see how my grid dataset just end up with no data. > > > library(sp) > > > library(gstat) > > > coordinates(cor)=~x+y > > > str(cor) > > Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots > > ..@ data :'data.frame': 550 obs. of 28 variables: > > .. ..$ F : num [1:550] 22.2 65 44.4 30 88.2 ... > > .. ..$ Poor: num [1:550] 0 85 0 65 35.3 ... > > .. ..$ Middle : num [1:550] 0 15 0 30 58.8 ... > > .. ..$ NoEdu : num [1:550] 0 35 0 5 17.6 ... > > .. ..$ Prim: num [1:550] 0 25 5.56 65 47.06 .. > > > > > gridded(cor)<-TRUE > > > str(cor) > > Formal class 'SpatialPixelsDataFrame' [package "sp"] with 7 slots > > ..@ data :'data.frame': 550 obs. of 28 variables: > > .. ..$ F : num [1:550] 22.2 65 44.4 30 88.2 ... > > .. ..$ Poor: num [1:550] 0 85 0 65 35.3 ... > > .. ..$ Middle : num [1:550] 0 15 0 30 58.8 ... > > .. ..$ NoEdu : num [1:550] 0 35 0 5 17.6 ... > > .. ..$ Prim: num [1:550] 0 25 5.56 65 47.06 ... > > .. ..$ Sec : num [1:550] 88.9 40 22.2 25 35.3 ... > > > > *But when I transform to spatialGrid, the data disappear and this cause NA > in the calculation of var1.pred and var.var* > > > fullgrid(cor)<-TRUE > > > str(cor) > > Formal class 'SpatialGridDataFrame' [package "sp"] with 4 slots > > ..@ data :'data.frame': 1372406 obs. of 28 variables: > > .. ..$ HH : num [1:1372406] NA NA NA NA NA NA NA NA NA NA ... > > .. ..$ Poor: num [1:1372406] NA NA NA NA NA NA NA NA NA NA ... > > .. ..$ Middle : num [1:1372406] NA NA NA NA NA NA NA NA NA NA ... > > .. ..$ NoEdu : num [1:1372406] NA NA NA NA NA NA NA NA NA NA ... > > .. ..$ Prim: num [1:1372406] NA NA NA NA NA NA NA NA NA NA ... > > [[alternative HTML version deleted]] > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org [[alternative HTML version deleted]] ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Same mask for two rasters, but obtaining different extents in R
The most likely explanation seems to me that the rasters were not aligned before cropping, so they are not aligned after cropping. Have you checked the original extent and resolution? Sarah On Tue, Mar 14, 2017 at 5:31 PM, Vijay Ramesh via R-sig-Geo wrote: > I loaded a shapefile in R, and cropped and masked it with the same mask, > but I get different extents. Any suggestions? > > Code below: > > library(raster) > library(rgdal) > library(GISTools) > library(sp) > library(maptools) > > ##Loading the first mask > Mask <- readOGR("C:\\Users\\rameshv\\Downloads\\Climate > Stability\\SPV_Mask\\mask.shp") > proj4string(Mask) <- CRS("+init=epsg:4326") > > #Loading the Rasters For Present and LGM and clipping them to the right > extent > bio5 <- raster("C:\\Users\\rameshv\\Downloads\\Climate > Stability\\Data_LGM_Present\\Present\\1_RawData\\bio_5") > proj4string(bio5) <- CRS("+init=epsg:4326") > lg5 <- raster("C:\\Users\\rameshv\\Downloads\\Climate > Stability\\Data_LGM_Present\\LGM\\1_RawData\\cclgmbi5.tif") > proj4string(lg5) <- CRS("+init=epsg:4326") > > ##Cropping by using the Crop and Mask functions > cr<- crop(bio5, extent(Mask)) > bio5 <- mask(cr, Mask) > > cr2<- crop(lg5, extent(Mask)) > lg5<- mask(cr2, Mask) > > > bio5 > class : RasterLayer > dimensions : 339, 246, 83394 (nrow, ncol, ncell) > resolution : 0.0417, 0.0417 (x, y) > extent : 72.45835, 82.70835, 8.083337, 22.20834 (xmin, xmax, > ymin, ymax) > coord. ref. : +init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs > +ellps=WGS84 +towgs84=0,0,0 > data source : in memory > names : bio_5 > values : 207, 432 (min, max) > attributes : > ID COUNT > from: -86 1 > to : 48938 > > > lg5 > class : RasterLayer > dimensions : 339, 246, 83394 (nrow, ncol, ncell) > resolution : 0.0417, 0.0417 (x, y) > extent : 72.45833, 82.70833, 8.083333, 22.20833 (xmin, xmax, > ymin, ymax) > coord. ref. : +init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs > +ellps=WGS84 +towgs84=0,0,0 > data source : in memory > names : cclgmbi5 > values : 187, 392 (min, max) > > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] R Help
You'd get better results if you send your information to the list, and as plain-text email with data either included or using one of the built-in datasets in R. I don't necessarily know the answer even though I know the right way to ask the question. Sarah On Thu, Jan 7, 2016 at 3:35 PM, Mistry, Krishan wrote: > Dear Sarah, > > This isn't homework, but in fact optional extra work for a R practical > session. I am new to R and haven't done any programming before. Would you be > able to assist me, if i am able to send you the question on a word document > along the data that is used. > > Kind Regards > Krishan > > ____ > From: Sarah Goslee > Sent: 07 January 2016 20:31 > To: Mistry, Krishan > Cc: r-sig-geo@r-project.org > Subject: Re: [R-sig-Geo] R Help > > As you will see below, posting in HTML format made your question unreadable. > > However, this looks rather like homework, and if so then you should > look for help from the resources associated with your course. > > If it isn't homework, you will get much more assistance if you provide > a reproducible example including data and the code you've tried > already. > > Sarah > > On Thu, Jan 7, 2016 at 3:24 PM, Mistry, Krishan > wrote: >> Dear Sir/Madame, >> >> I am currently a Masters student at the University of Leicester in the UK >> studying MSc Geographical Information Science and am having a bit of >> difficulty with the programme R. I am a new user of the programme and don't >> have any previous experience in programming. Having looked at various web >> sites, I wondered if you are able to help me with some trouble i am having >> in trying to write some code for a mathematical equation. >> I have attached the question to this email and it can be seen below. The >> dataset is a list of polygons with each polygon containing another list >> within it, of x and y coordinates. >> >> I would really appreciate it, if you could help me with this question. >> >> Question >> Create functions to compute the area, centroid and perimeter of a polygon >> list (as in the format of georgia.polys). The formula for the area of a >> polygon is >> >> A=0.5*?(x? y???) (x??? y?) for i until n-1 >> >> where A is the polygon area, xi is the ith x-coordinate of the polygon >> boundary (x[i] in R), yi is the ith ycoordinate of the polygon boundary >> (y[i] in R) - and n is the number of points used to specify the polygon >> boundary. The polygon is assumed to be in closed form so that the x1 and y1 >> take the same value as xn and yn. >> >> Hope to hear from you soon. >> >> Yours sincerely >> >> Krishan Mistry >> ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] R Help
As you will see below, posting in HTML format made your question unreadable. However, this looks rather like homework, and if so then you should look for help from the resources associated with your course. If it isn't homework, you will get much more assistance if you provide a reproducible example including data and the code you've tried already. Sarah On Thu, Jan 7, 2016 at 3:24 PM, Mistry, Krishan wrote: > Dear Sir/Madame, > > I am currently a Masters student at the University of Leicester in the UK > studying MSc Geographical Information Science and am having a bit of > difficulty with the programme R. I am a new user of the programme and don't > have any previous experience in programming. Having looked at various web > sites, I wondered if you are able to help me with some trouble i am having in > trying to write some code for a mathematical equation. > I have attached the question to this email and it can be seen below. The > dataset is a list of polygons with each polygon containing another list > within it, of x and y coordinates. > > I would really appreciate it, if you could help me with this question. > > Question > Create functions to compute the area, centroid and perimeter of a polygon > list (as in the format of georgia.polys). The formula for the area of a > polygon is > > A=0.5*?(x? y???) (x??? y?) for i until n-1 > > where A is the polygon area, xi is the ith x-coordinate of the polygon > boundary (x[i] in R), yi is the ith ycoordinate of the polygon boundary (y[i] > in R) - and n is the number of points used to specify the polygon boundary. > The polygon is assumed to be in closed form so that the x1 and y1 take the > same value as xn and yn. > > Hope to hear from you soon. > > Yours sincerely > > Krishan Mistry > ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] "Paste" with poly titles
I think we need more information, and ideally a reproducible example. I'm getting exactly what I'd expect: myLabel <- paste("1234", "ABCD", sep="\n") library(sp) data(meuse.riv) meuse.sr <- SpatialPolygons(list(Polygons(list(Polygon(meuse.riv)),"meuse.riv"))) plot(meuse.sr) title(myLabel) I don't think the problem lies in paste(), (which is not the same thing as Paste), but in something else you are doing. Sarah On Sun, Nov 15, 2015 at 3:14 PM, Jim Burke wrote: > myLabel <- paste(PctShp$PCT, PctShp$Last_Name, sep = "\n", collapse = NULL) > > GIVEN > PCT = "1234" > Last_name = "Open Seat" > > EXPECTED BEHAVIOUR > 1234 > Open Seat > > ACTUAL BEHAVIOUR Prints on maps like below. > 1234 > > Open Seat > > > I suspect I do not know something important about "Paste" > > All criticism and comments appreciated, > Jim Burke > > [[alternative HTML version deleted]] > --- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Landscape metrics: SDMTools. Error installation
>> install.packages('SDMTools',,'http://www.rforge.net/') > Error in install.packages : argument is missing, with no default I'd start by rerunning this command without the extra comma. On Wed, Sep 16, 2015 at 11:14 AM, juan jose mena wrote: > Dear all, > > I am Juan José Mena, this is my first post but I need some help because I > need to compute patch and class metrics and the SDMTools package failed in > the installation. Does anyone know how to install it? Is there any > alternative? > thanks in advance > > Juan > >> install.packages('SDMTools',,'http://www.rforge.net/') > Error in install.packages : argument is missing, with no default >> library(SDMTools) > Error: package ‘SDMTools’ was built before R 3.0.0: please re-install it >> library("SDMTools", lib.loc="C:/Program Files/R/R-3.1.3/library") > Error: package ‘SDMTools’ was built before R 3.0.0: please re-install it >> install.packages("C:/Program Files/R/SDMTools_1.1-14.zip", repos = NULL) > package ‘SDMTools’ successfully unpacked and MD5 sums checked > Warning messages: > 1: display list redraw incomplete > 2: display list redraw incomplete >> library(SDMTools) > Error: package ‘SDMTools’ was built before R 3.0.0: please re-install it > > [[alternative HTML version deleted]] > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] New package > RStoolbox: Remote Sensing Data Analysis in R
And also the landsat package, also on CRAN. Sarah On Tue, Sep 15, 2015 at 1:11 PM, Tim Appelhans wrote: > Benjamin, > I think we should put our heads together at some stage as we have already > something very similar on CRAN (released in July) > > https://cran.r-project.org/web/packages/satellite/index.html > > The satellite package provides standard class(es) and methods for handling > satellite data. We deliberately avoided adding any functionality that goes > beyond basic image preparation (i.e. classification or prediction > capabilities). The idea is to provide a standard package for remote sensing > data handling (satellite) on top of which other packages can be built to > provide further functionality (such as the numerous classification > algorithms in RStoolbox). Think of it as the 'sp' package for satellite > remote sensing data analysis. > > To get a better idea of how satellite is designed please have a look at the > following vignette (which is not quite finished but does provide an overview > of how the 'satellite' class is defined). > > https://github.com/environmentalinformatics-marburg/satellite/blob/develop/vignettes/satellite.Rmd > > I would appreciate your thoughts (maybe off-list) on how to best arrange our > efforts in order to avoid duplication and confusion for other users. > > Best > Tim > > On 14.09.2015 08:36, Benjamin Leutner wrote: >> >> Dear list members, >> >> We are happy to announce the initial release of our *RStoolbox* package. >> RStoolbox provides various tools for remote sensing data analysis and is >> now available from CRAN: >>https://cran.r-project.org/web/packages/RStoolbox >> >> The main focus of RStoolbox is to provide a set of high-level remote >> sensing tools for various classification tasks. This includes unsupervised >> and supervised classification with different classifiers, fractional cover >> analysis and a spectral angle mapper. Furthermore, several spectral >> transformations like vegetation indices, principal component analysis or >> tasseled cap transformation are available as well. >> >> Besides that, we provide a set of data import and pre-processing >> functions. These include reading and tidying Landsat meta-data, importing >> ENVI spectral libraries, histogram matching, automatic image >> co-registration, topographic illumination correction and so on. >> >> Last but not least, RStoolbox ships with two functions dedicated to >> plotting remote sensing data (*raster* objects) with *ggplot2* including RGB >> color compositing with various contrast stretching options. >> >> RStoolbox is built on top of the *raster* package. To improve performance >> some functions use embedded C++ code via the *Rcpp* package. Moreover, most >> functions have built-in support for parallel processing, which is activated >> by running raster::beginCluster() beforehand >> >> RStoolbox is hosted at www.github.com/bleutner/RStoolbox >> >> For a more details, including executed examples, please see >> http://bleutner.github.io/RStoolbox/rstbx-docu/ >> >> We sincerely hope that this package may be helpful for some people and are >> looking forward to any feedback, suggestions and bug reports. >> > > -- > # > Tim Appelhans > Department of Geography > Environmental Informatics > Philipps Universität Marburg > Deutschhausstraße 12 > 35032 Marburg (Paketpost: 35037 Marburg) > Germany > > Tel +49 (0) 6421 28-25957 > > http://environmentalinformatics-marburg.de/ > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] spBayes package spLM function
Are you sure that cook is a matrix and not a data frame? What are the outputs of: dim(cook) is.matrix(cook) str(cook) Sarah On Thu, Jul 23, 2015 at 6:12 PM, Helen Chen wrote: > Hi, > > I have tried to implement the spLM function from spBayes package to my data > (rainfall value, elevation, coordinates). > > However, the error message shows up when I run this chunk of codes: > > bef.sp <- spLM(S3~elv, > + data=A, coords=cook, starting=list("phi"=3/200,"sigma.sq"=0.08, > + "tau.sq"=0.02), tuning=list("phi"=0.1, "sigma.sq"=0.05, "tau.sq"=0.05), > +priors=list("phi.Unif"=c(3/1500, 3/50), "sigma.sq.IG"=c(2, > 0.08),"tau.sq.IG"=c(2, 0.02)), cov.model="spherical",n.samples=n.samples) > > the error message is > > Error in spLM(S3 ~ elv, data = A, coords = cook, starting = list(phi = > 3/200, : > error: coords must n-by-2 matrix of xy-coordinate locations > > I am sure that my coordinates is a 29 by 2 matrix, but it also tells me > this error message. > > Could anyone help me to figure out. Thanks for all your help. > > > > Helen > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[R-sig-Geo] readGDAL and unz
Hi folks, I'm stuck trying to read spatial data from a zip archive using unz() rather than unzipping it. The latter option works, but the zip archives I'm working with have hundreds of files in them, and I'd rather avoid the mess of unzipping the whole thing. Using readGDAL(unz()) throws an error: rror in .local(.Object, ...) : `3' does not exist in the file system, and is not recognised as a supported dataset name. It appears that the name of the connection isn't being passed correctly. Do any of you know a way around this, or shall I just resign myself to unzipping everything? Here's both a working (csv) and nonworking (tif) example: ### library(rgdal) # create files to test with # NOTE: WRITES TO CURRENT DIRECTORY # creates x.tif and zip archive x.zip using rgdal built-in data x <- readGDAL(system.file("external/simple.ag", package="sp")[1]) writeGDAL(x, "x.tif") zip("x.zip", "x.tif") # creates y.csv and zip archive y.zip y <- data.frame(A=1:3, B=letters[6:8]) write.csv(y, "y.csv") zip("y.zip", "y.csv") ## works as expected # list files in y.zip y.files <- unzip("y.zip", list=TRUE) # read in first file y.in <- read.csv(unz("y.zip", y.files$Name[1])) ## does not work: fails with error ## Error in .local(.Object, ...) : `3' does not exist in the file system, ## and is not recognised as a supported dataset name. ## Note: the number increments. # list files in x.zip x.files <- unzip("x.zip", list=TRUE) # read in first file x.in <- readGDAL(unz("x.zip", x.files$Name[1])) ## There's no difference in the connection provided by unz(): # > unz("y.zip", y.files$Name[1]) # description class mode textopened # "y.zip:y.csv" "unz" "r""text" "closed" # can read can write # "yes" "yes" # > unz("x.zip", x.files$Name[1]) # description class mode text opened # "x.zip:x.tif" "unz" "r""text" "closed" # can read can write # "yes" "yes" ## unzipping the file first works as expected unzip("x.zip") x.in2 <- readGDAL(x.files$Name[1]) Thanks, Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Verify units of distance between coordinates
On Thu, Aug 28, 2014 at 9:32 AM, Michael Sumner wrote: > On Thu, Aug 28, 2014 at 10:50 PM, Sarah Goslee wrote: >> They don't make sense. >> >> Best: convert them into a projection where the distances are in meters >> already, like UTM. Then distances calculated on your new coordinates >> are in meters. > > However great circle from lat/lon is arguably the best since you can > really do get distance along a great circle (on the ellipsoid or the > sphere). (There are several algorithms, and also other methods for > e.g. loxodromes, and even other definitions of "straight".) > > No projection has the property that any straight line is a great > circle, and most certainly *not* any of UTM family. True, but as long as your points are reasonably close together, something like UTM is a very useful approximation. And even great circle is an approximation. The best answer depends on the data and the objectives (as always!). > Cheers, Mike. > > >> >> Latitude and longitude don't translate neatly into distances on their own. >> >> Second best: find and use a great circle distance function that can >> determine the correct distances for where those lat/lon coordinates >> are on the earth's surface. There's been discussion on this list >> before about calculating distances from geographic coordinates; google >> should find them. >> >> Sarah >> >> On Thu, Aug 28, 2014 at 8:44 AM, Justin Michell wrote: >>> Dear geo R group >>> >>> I have a data frame like this: >>> >>> df <- data.frame(Lon = c(29.6000,29.7333,30.3887,30.6667,30.6833,30.8667), >>> Lat = c(-4.9000,-4.6000,-5.1280,-1.0667,-2.7500,-3.3833), >>> LonWater = >>> c(29.6,29.6,30.25000,30.65000,30.35444,30.83278), LatWater = >>> c(-4.31667,-4.31667,-4.76667,-1.35000,-2.46667,-3.57000), DstClW = >>> c(0.5842815,0.3004491,0.3870362,0.2837918,0.4340793,0.1897561) ) >>> >>> At these locations (Lon, Lat pairs) I calculated the shortest distance to a >>> water source (DstClW) and where that source is (LonWater, LatWater). >>> >>> I want to now determine what units DstClW is in, and also verify that these >>> distances make sense and were calculated correctly. >>> >>> Any suggestions as to how this might be done? >>> >>> Regards >>> Justin Michell >>> >>> -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Verify units of distance between coordinates
They don't make sense. Best: convert them into a projection where the distances are in meters already, like UTM. Then distances calculated on your new coordinates are in meters. Latitude and longitude don't translate neatly into distances on their own. Second best: find and use a great circle distance function that can determine the correct distances for where those lat/lon coordinates are on the earth's surface. There's been discussion on this list before about calculating distances from geographic coordinates; google should find them. Sarah On Thu, Aug 28, 2014 at 8:44 AM, Justin Michell wrote: > Dear geo R group > > I have a data frame like this: > > df <- data.frame(Lon = c(29.6000,29.7333,30.3887,30.6667,30.6833,30.8667), > Lat = c(-4.9000,-4.6000,-5.1280,-1.0667,-2.7500,-3.3833), > LonWater = > c(29.6,29.6,30.25000,30.65000,30.35444,30.83278), LatWater = > c(-4.31667,-4.31667,-4.76667,-1.35000,-2.46667,-3.57000), DstClW = > c(0.5842815,0.3004491,0.3870362,0.2837918,0.4340793,0.1897561) ) > > At these locations (Lon, Lat pairs) I calculated the shortest distance to a > water source (DstClW) and where that source is (LonWater, LatWater). > > I want to now determine what units DstClW is in, and also verify that these > distances make sense and were calculated correctly. > > Any suggestions as to how this might be done? > > Regards > Justin Michell > > > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] histogram matching of cloud masked Landsat 8 messages
What Barry says is completely correct: the landsat package (not Landsat), is not currently compatible with the format used by the raster package, only with sp classes or base R object types. You can convert the raster objects, or use the rgdal package to import your tifs as SGDFs. And as I told you in private email, the landsat package was developed pre-Landsat 8, and has not been updated for the new data source. Both raster compatibility and Landsat 8 support are in the works, but will not be available in the very near future. Sarah On Tue, Aug 12, 2014 at 12:25 PM, Barry Rowlingson wrote: > Instructions say (help(histmatch)) > > > Arguments: > > master: The target image, in SpatialGridDataFrame, data frame, matrix > or vector format. > >tofix: The image to be normalized, in any format. > > but what you have is a *raster* object, not a SpatialGridDataFrame, or > any other of those. > > You can convert a raster, r, to a SpatialGridDataFrame, rg: > > > rg = as(r,"SpatialGridDataFrame") > > and then feed those to histmatch. You probably have to convert both arguments. > > Barry > > > > On Tue, Aug 12, 2014 at 4:45 PM, sarah crabbe wrote: >> Dear all, >> >> We are trying to apply a histogram matching on cloudmasked landsat 8 images, >> with the intention to fill the clouds. >> Therefore we want to use the package "Landsat" >> >> We tried to import two bands with the package "raster": >> >> image1<-raster("LC82280562013211LGN00_B1.tif") >> image2<-raster("LC82280562013227LGN00_B1.tif") >> >> whereafter we try to apply a histogram matching with the landsat package: >> >> histmatch(image1, image2, minval=0, maxval= 65535, by=1) >> >> And we get following error: >> >> Error in as.vector(data) : >> no method for coercing this S4 class to a vector >> >> This might be easy to solve, but we just started to learn how to work with R >> for image processing, So could we please get some advice on this.. >> Many thanks >> Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] space time error message
On Fri, Aug 8, 2014 at 7:55 AM, Abdoulaye Sarr wrote: > I am still hoping to have a quick explanation on what is causing the error > or a suggestion on another way to do it? Then you need to provide the small reproducible example that has already been requested. This may help: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Sarah > > Cheers, > eus > > > On Sun, Aug 3, 2014 at 2:20 PM, Abdoulaye Sarr > wrote: > >> I think the problem could be related to dates in precip, in fact here I am >> using dekadal precip( 10 days average therefor for each month you have 01, >> 11 and 21 as you can see in the date in sample dataframes dprec84.rda and >> the stations1.rda. >> >> After creating these dataframes I am trying to use use meteo to create a >> STFDF (I guess other packaged could do it?) using the command below: >> >> > prec <- meteo2STFDF(dprec84,stations1, crs= CRS('+proj=longlat >> +datum=WGS84')) >> Joining by: staid, date >> >> Joining by: staid >> Error in ST(sp, time, endTime) : time is not a time based class >> >> If doable with other package also will be fine for me. >> >> asarr >> >> >> On Sun, Aug 3, 2014 at 9:40 AM, Edzer Pebesma < >> edzer.pebe...@uni-muenster.de> wrote: >> >>> Please provide a small, reproducible example. >>> >>> Wbr, >>> >>> On 07/26/2014 08:29 PM, Abdoulaye SARR wrote: >>> > >>> > Hello list, >>> > >>> > I am creating a space time full data frame but having this error >>> message: >>> > >>> > Joining by: staid >>> > Error in ST(sp, time, endTime) : time is not a time based class >>> > >>> > the data frame 10 days average precip used looks like this: >>> > >>> > staid time prec >>> > 1 38007200 1984-01-01 0.0 >>> > 2 38008400 1984-01-01 0.8 >>> > 3 38014000 1984-01-01 0.0 >>> > 4 38008100 1984-01-01 0.0 >>> > 5 38008700 1984-01-01 0.0 >>> > 6 38009200 1984-01-01 0.0 >>> > >>> > >>> > The next date 1984-01-11 etc.. >>> > >>> > could someone help solve this urgent issue. >>> > >>> > Best regards, >>> > >>> > eus >>> > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Kernel smoothing density function
On Thu, Jul 24, 2014 at 4:06 PM, Ferra Xu wrote: > Dear Sarah > Thank you for your response. I have attached the data that I'm using. I > noticed that no estimate and eval.points are generated...Would you please > take a look at it? Of course the estimate is generated, just as the help file promised. hat$estimate contains the estimate: all the named components given in the Value section of the helpfile are part of hat, and you can see that with names(hat) Have you read the Introduction to R that comes with your R installation? Perhaps you should. > It creates a plot in R environment but the pdf file doesn't work. > > Appreciate your help, Well, ?plot.kde states that for 3D data it produces an interactive RGL plot, and unlike for 1D and 2D there are no other options. What do you expect to be printed to PDF when you create an interactive plot? Reading ?rgl suggests that you might want to look into ?rgl.snapshot Sarah > > On Thursday, July 24, 2014 12:35 PM, Sarah Goslee > wrote: > > > Hi, > > On Thu, Jul 24, 2014 at 1:22 PM, Ferra Xu wrote: >> Hello all, >> In order to find the kernel smoothing density function of a 3 dimensional >> data-set, I wrote this code in R: >> library(ks)defect <-read.table(file.choose(),sep=",")hat >> <-kde(defect)pdf("SampleGraph.pdf")plot(hat,drawpoints=TRUE)dev.off() >> But I have problem in interpretation of the result..I don't see the >> estimated values for density function (I need to have the values of f to use >> it in another code). The other problem is that the pdf file is not created >> correctly..Although the plot is created in R window, when I want to open the >> pdf file, it says:There was an error opening this document. This file cannot >> be opened because it has no pages. > >>[[alternative HTML version deleted]] > > > See why you shouldn't post HTML to this list? > > Trying to parse that, I see that I can't run your example because no > data are provided (dput() is a good function to know). > > When I run the example code given in ?kde it works as expected. Does > your plot command create a plot on other devices, like the default for > your OS? Does the example code in ?kde work when you run it? Does it > create a plot? > > As for the estimated values, did you carefully read the Value section > of the help file? > > A kernel density estimate is an object of class ‘kde’ which is a > list with fields: > > x: data points - same as input > > eval.points: points at which the estimate is evaluated > > estimate: density estimate at ‘eval.points’ > > If this density estimate is not the estimate you are looking for, > you'll need to be more specific. > > Sarah > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Kernel smoothing density function
Hi, On Thu, Jul 24, 2014 at 1:22 PM, Ferra Xu wrote: > Hello all, > In order to find the kernel smoothing density function of a 3 dimensional > data-set, I wrote this code in R: > library(ks)defect <-read.table(file.choose(),sep=",")hat > <-kde(defect)pdf("SampleGraph.pdf")plot(hat,drawpoints=TRUE)dev.off() > But I have problem in interpretation of the result..I don't see the estimated > values for density function (I need to have the values of f to use it in > another code). The other problem is that the pdf file is not created > correctly..Although the plot is created in R window, when I want to open the > pdf file, it says:There was an error opening this document. This file cannot > be opened because it has no pages. > [[alternative HTML version deleted]] See why you shouldn't post HTML to this list? Trying to parse that, I see that I can't run your example because no data are provided (dput() is a good function to know). When I run the example code given in ?kde it works as expected. Does your plot command create a plot on other devices, like the default for your OS? Does the example code in ?kde work when you run it? Does it create a plot? As for the estimated values, did you carefully read the Value section of the help file? A kernel density estimate is an object of class ‘kde’ which is a list with fields: x: data points - same as input eval.points: points at which the estimate is evaluated estimate: density estimate at ‘eval.points’ If this density estimate is not the estimate you are looking for, you'll need to be more specific. Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Conversion geographical coodinate in UTM
Hi, At a guess, your Front dataset doesn't have a CRS set, so spTransform() doesn't know what to transform *from*. See the examples in ?spTransform for the whole process, including setting the CRS for your data. Sarah On Mon, Jun 30, 2014 at 10:10 AM, Gilles Benjamin Leduc wrote: > Hi, > > I need to convert some geographical coordinate it UTM. > First I have a shapefile: > Front<-readShapeSpatial("ISL_adm0.shp") > class(Front) > [1] "SpatialPolygonsDataFrame" > > then… I tried this after googling: > DataUTM <- spTransform(Front, CRS("+proj=utm +zone=27 +north +datum=WGS84")) > Erreur dans spTransform(xSP, CRSobj, ...) : > No transformation possible from NA reference system > > My UTM area is 27 W (If I understood the system) > > What is wrong? > > Thanks in advance > > Benjamin > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Export object class SpatialPixelsDataFrame to GIS
Hi, You can use writeGDAL() from the rgdal package. Sarah On Tue, Jun 3, 2014 at 4:24 PM, Hazlehurst, Jenny A wrote: > ?Thanks in advance. Using the package adehabitatHR for kernel analysis of > bird home ranges. > > > Looking for how to get a specific kernel, which is of class > SpatialPixelsDataFrame, into a format use-able by GIS platform, mostly QGIS, > so that I can work within specific kernels in the field. > > > Thanks! > > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] mcp calculation
Hi, On Fri, Dec 6, 2013 at 4:04 PM, Lutfor wrote: > Dear Mathieu, I have no idea who Mathieu is: you sent this message to the entire r-sig-geo list, if by way of the horrid nabble "interface." > Thanks for extending your kind help. > It works perfect with the example data. > However, I had difficulty when I wanted to use following data unless I > converted x, y corordinates to spatial data by the command of > SpatialPointsDataFrame. Please see commands below. I wonder is there any > other way to calculate MCP without converting SpatialPointsDataFrame. > > mcpdata1<-read.csv("DataMCPKernel.csv",header=T) > attach(mcpdata1) > XY=mcpdata1[,c("x","y")] > #Convering your coordinates to spatial data > *rel2<-SpatialPointsDataFrame(XY, data=mcpdata1)* > cp2 <- mcp(rel2[,1], percent=100) > as.data.frame(cp2) > mcp.area(rel2[,1]) You don't say, but I'm assuming you are using the package adehabitatHR. It's very important to tell us where you get your functions from. If you read the help for mcp.area, you will see: Arguments xy An object inheriting the class SpatialPoints containing the x and y relocations of the animal. If xy inherits the class SpatialPointsDataFrame, it should contain only one column (a factor) corresponding to the identity of the animals for each relocation. So yes, you need a Spatial object. There are other advantages to Spatial objects, though. This might be a slightly less convoluted approach: mcpdata1 <- structure(list(Stage = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "incubation", class = "factor"), x = c(646395.1, 646395.1, 646395.1, 646395.1, 646382.9, 646395.1, 646238.7, 646531.6, 646408, 646395.1, 646395.1), y = c(5213765L, 5213765L, 5213765L, 5213765L, 5213765L, 5213765L, 5213946L, 5213897L, 5213765L, 5213765L, 5213765L)), .Names = c("Stage", "x", "y"), class = "data.frame", row.names = c(NA, -11L)) library(adehabitatHR) rel2 <- mcpdata1 coordinates(rel2) <- ~x + y cp2 <- mcp(rel2, percent=100) mcp.area(rel2) Sarah > Data: > > Stage x y > incubation 646395.15213765 > incubation 646395.15213765 > incubation 646395.15213765 > incubation 646395.15213765 > incubation 646382.95213765 > incubation 646395.15213765 > incubation 646238.7 5213946 > incubation 646531.65213897 > incubation 646408 5213765 > incubation 646395.15213765 > incubation 646395.15213765 > > Kind regards > Lutfor > > > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] where's spatstat?
On Wed, Nov 27, 2013 at 1:12 PM, wrote: > i would not think the version would have anything to do with the packages > available on the sites...anyway, here's what's reported at startup: > > R version 3.0.1 (2013-05-16) -- "Good Sport" > Copyright (C) 2013 The R Foundation for Statistical Computing > Platform: x86_64-w64-mingw32/x64 (64-bit) http://cran.r-project.org/web/packages/spatstat/index.html Version: 1.34-1 Depends: R (≥ 3.0.2) You need to upgrade. Sarah > > > Lee De Cola. > - Original Message - > From: "Timothy Gregoire" > To: ldec...@comcast.net > Cc: "r-sig-geo" > Sent: Wednesday, November 27, 2013 1:00:46 PM > Subject: RE: [R-sig-Geo] where's spatstat? > > Is your version of R up-to-date? If not, that might explain absence of > spatstat from list. > > Timothy G. Gregoire > J. P. Weyerhaeuser Professor of Forest Management > School of Forestry & Environmental Studies, Yale University > 360 Prospect Street, New Haven, CT 06511-2104 U.S.A. > > office: 1.203.432.9398 mobile: 1.203.508.4014, fax: 1.203.432.3809 > timothy.grego...@yale.edu > G&V sampling text: http://crcpress.com/product/isbn/9781584883708 > > > -Original Message- > From: r-sig-geo-boun...@r-project.org > [mailto:r-sig-geo-boun...@r-project.org] On Behalf Of ldec...@comcast.net > Sent: Wednesday, November 27, 2013 12:56 PM > Cc: r-sig-geo > Subject: Re: [R-sig-Geo] where's spatstat? > > i install packages on my windows7 pc by clicking packages > install and then > i select a mirror site, which brings up a list of 100s of packages in alpha > order, including SpatioTemporal followed by spBayes. > > Lee De Cola. - Original Message - > From: "Sarah Goslee" > To: ldec...@comcast.net > Cc: "r-sig-geo" > Sent: Wednesday, November 27, 2013 12:43:59 PM > Subject: Re: [R-sig-Geo] where's spatstat? > > Where are you looking? > > Not, apparently, on CRAN: > http://cran.r-project.org/web/packages/spatstat/index.html > > Sarah > > On Wed, Nov 27, 2013 at 12:34 PM, wrote: >> i don't see it among available packages to install... >> >> > > ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] where's spatstat?
You can can download the Windows binary from the link I provided and use the install local packages option, or you can select a different mirror. You can also use the install.packages() command, and specify the package name and mirror. If your particular method and mirror are not working for you, there are a multitude of other options. But do note that the more information about OS, procedure, etc, you include in your initial query, the more helpful the answers are likely to be. "This does not work" is not a well-formed query. Sarah On Wed, Nov 27, 2013 at 12:55 PM, wrote: > i install packages on my windows7 pc by clicking packages > install and then > i select a mirror site, which brings up a list of 100s of packages in alpha > order, including SpatioTemporal followed by spBayes. > > Lee De Cola. - Original Message - > From: "Sarah Goslee" > To: ldec...@comcast.net > Cc: "r-sig-geo" > Sent: Wednesday, November 27, 2013 12:43:59 PM > Subject: Re: [R-sig-Geo] where's spatstat? > > Where are you looking? > > Not, apparently, on CRAN: > http://cran.r-project.org/web/packages/spatstat/index.html > > Sarah > > On Wed, Nov 27, 2013 at 12:34 PM, wrote: >> i don't see it among available packages to install... >> >> > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] where's spatstat?
Where are you looking? Not, apparently, on CRAN: http://cran.r-project.org/web/packages/spatstat/index.html Sarah On Wed, Nov 27, 2013 at 12:34 PM, wrote: > i don't see it among available packages to install... > > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Landsat soil moisture index
Hi, Well, you need to start at the beginning. Where did you get your Landsat images? What format are they in? Has someone already calculated NDVI and surface temperature for you, or do you need to do that? If so, what level of processing have the images already received? How have you imported the images into R? Do you already know how to perform a linear regression in R? It's not a difficult task programmatically, but there are a number of steps that you need to consider, and things you must understand before you can get good results. Remote sensing isn't necessarily an easy field. The landsat package and associated references may help you get started. Sarah On Fri, Nov 8, 2013 at 8:52 AM, Allen McIlwee wrote: > Dear list > > > > WANG et al. 2009 "Satellite remote sensing applications for surface soil > moisture monitoring" derived a Landsat soil moisture index: > > > > SMI = (Tsmax - Ts) / (Tsmax - Tsmin) > > > > where Tsmax, Tsmin are the maximum and minimum surface temperatures for a > given NDVI value, and Ts is the surface temperature at a given pixel for a > given NDVI. Values near 1 (low surface temp & low greenness) have the > highest estimated soil moisture, while values near 0 (high surface temp & > greenness) have the lowest. > > > > Could anyone please advise me how I can create an image matrix that will > extract the min and max surface temperatures for each unique NDVI value. I > then need to apply a linear regression to the max temp vs NDVI & min temp vs > NDVI scatter plots, and use the corresponding slopes and intercepts to > calculate Tsmax and Tsmin > > > > Tsmax = (a1 x NDVI) + b1 > > TSmin = (a2 x NDVI) + b2 > > > > Hoping this is not such a difficult task for someone mathematically inclined > > > > Thanks > > Allen > > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Does sp::coordinates() behave correct?
Hi, It's purely a printing issue; the coordinates are unchanged: > coordinates(gis.k) x y [1,] 3469125 5521625 [2,] 3469375 5521125 [3,] 3471875 5522875 [4,] 3472500 5524510 A number of print methods in R round things to 'look nice', which can lead to unexpected side-effects, like confused users. Thanks for the short reproducible example; much appreciated. Sarah On Mon, Oct 21, 2013 at 3:27 PM, Rainer Hurling wrote: > I am using 'coordinates(x) <- ~x+y' to convert data.frames into > SpatialPointsDataFrames. > > It seems, that some coordinates will be rounded(?), when they are > transformed by coordinates(): > > > library(maptools) > > # Defining some Datapoints with coordinates > gis.k <- data.frame(name=c("K0001","K0002","K0016","K0020"), > rsoll=c(3469125,3469375,3471875,3472500), > hsoll=c(5521625,5521125,5522875,5524510)) > > # Converting them into a SpatialPointsDataFrame > gis.k$x <- gis.k$rsoll > gis.k$y <- gis.k$hsoll > coordinates(gis.k) <- ~x+y > > # Show contents of new SpatialPointsDataFrame > gis.k > coordinates name rsoll hsoll > 1 (3469120, 5521620) K0001 3469125 5521625 > 2 (3469380, 5521120) K0002 3469375 5521125 > 3 (3471880, 5522880) K0016 3471875 5522875 > 4 (3472500, 5524510) K0020 3472500 5524510 > > > In lines 1 to 3 the coordinates from rsoll and hsoll are rounded, for > example 3469125 into 3469120 and 3471875 into 3471880. (In some cases > they are rounded up, in others round down?) Only coordinates with last > digit =0 are not changed. > > Is this an expected behaviour and if this is right, why? If not, what > would be the correct solution to convert these coordinates? Or do I > missunderstand something here. > > Any help is appreciated. Thanks in advance, > Rainer Hurling > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] space-time clustering
Have you tried rseek.org? Searching for Moran or for spatio-temporal clustering turns up lots of information, including tutorials and functions/packages. You're likely to get more help on the list if you ask questions that demonstrate you've made a basic effort to solve your own problem, and then come to the list with specific problems. You might also take a look at the relevant CRAN task views. Sarah On Thursday, October 17, 2013, Simone Ruzza wrote: > I have asked for the same thing a few days ago. Let's see whether they > reply to you. > > Cheers, > > Simone > > > On Thu, Oct 17, 2013 at 10:53 AM, è¡èº > > wrote: > > Dear all, > > > > I would like to ask whether there is a package in R that can calculate > > global space-time Moran's I and visualize the local space-time Moran's I. > > Or please recommend any package that explore spatio-temporal clustering > > (for lattice and geostatistical process) . Thanks very much > > > > Best > > > > Yi > > > -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org [[alternative HTML version deleted]] ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Which are the most suitable, elegant or efficient packages for geographical maps in R? Which did you use yourself?
HI Markus, That's... rather broad. I'd suggest installing the Spatial taskview, reading about what's available as part of that collection at http://cran.r-project.org/web/views/Spatial.html and then thinking about what you are trying to accomplish. Surely a more focused answer would be more useful than having everyone list all the packages they use, as well as requiring less time from the list members. Sarah On Tue, Jul 23, 2013 at 11:56 AM, Markus Jenning wrote: > Hi everyone. > > I remember some very interesting and professional-looking R projects that > somehow involved geographical maps. > Now that I'd like to work with maps myself, let me ask you this question: > Which of the packages that are currently available would you think are the > most elegant and useful for an R project that use maps? > Which packages (other than the "maps" package) did you use in your own > projects and why? > Are there any packages that are not available on CRAN (or in some way hard > to find) but that still deserve recognition? > > Thanks for your help, and feel free to redirect me to a more suitable thread > or even another group if you feel that this question could better be asked > elsewhere. > > Cheers, > Markus > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Fwd: help with matrix
Hi, Please don't cross-post: choose the most appropriate email list and send your question only to that one. The best place for general questions like this is R-help. On Fri, Jul 19, 2013 at 9:12 AM, Kátia Emidio wrote: > > Hi, > I am a beginner at R and I would like to get information from a matrix, > where the numbers are larger than or equal to 50m . This means that plants > need to be apart 50m. I need to get the selection(the results) as a matrix > or another object that allows me to identify which pair of species are 50m > apart. Attached it is an example... Attaching your data isn't nearly as useful as using dput() to include it directly in the email. Many people dislike opening unsolicited attachments, and the mail server strips most of them off anyway. There are almost certainly more elegant ways to accomplish this. Please move the discussion to R-help if you wish to continue it. # recreate your data adist <- structure(list(Nauc_calo_1 = c(0, 118.74, 172.27, 152.72, 119.45, 85.351), Nauc_calo_2 = c(118.74, 0, 165.8, 141.68, 67.186, 151.47 ), Nauc_calo_3 = c(172.27, 165.8, 0, 24.331, 98.671, 104.72), Nauc_calo_4 = c(152.72, 141.68, 24.331, 0, 74.673, 93.503 ), Nauc_calo_5 = c(119.45, 67.186, 98.671, 74.673, 0, 108.95 ), Nauc_calo_6 = c(85.351, 151.47, 104.72, 93.503, 108.95, 0)), .Names = c("Nauc_calo_1", "Nauc_calo_2", "Nauc_calo_3", "Nauc_calo_4", "Nauc_calo_5", "Nauc_calo_6"), class = "data.frame", row.names = c("Nauc_calo_1", "Nauc_calo_2", "Nauc_calo_3", "Nauc_calo_4", "Nauc_calo_5", "Nauc_calo_6" )) # identify which elements are >= 50 index50 <- data.frame(which(adist >= 50, arr.ind=TRUE)) # take unique pairs from your symmetric matrix index50 <- subset(index50, row < col) # get the associated names results50 <- data.frame(row = rownames(adist)[index50$row], col = colnames(adist)[index50$col], stringsAsFactors = FALSE) Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Problem with NDVI difference with subset image
Hi, On my system, it's a writeRASTER() options issue. I don't use raster very often, but I played with the options enough to come up with a working solution. ## this doesn't work in the right way - something about the format ## used by writeRaster isn't compatible with lssub() #Create geotiff writeRaster(stackIm1, filename="stackIm1.tif", format="GTiff",overwrite=TRUE) ## also, lssub() creates a file but does not return anything, so no ## need to assign it to an object stackIm1.sample<-lssub("stackIm1.tif", "stackIm1.sample.tif", centerx = 0, centery = 0, widthx = 50, widthy = 50) ## this works, confirming that it's a writeRaster issue stackIm1a <- readGDAL("stackIm1.tif") writeGDAL(stackIm1a, "stackIm1a.tif") lssub("stackIm1a.tif", "stackIm1a.sample.tif", centerx = 0, centery = 0, widthx = 50, widthy = 50) ## This also works, but note the name of the output file writeRaster(stackIm1, filename="stackIm1b.tif", format="GTiff",overwrite=TRUE, bylayer=TRUE) lssub("stackIm1b_1.tif", "stackIm1b.sample.tif", centerx = 0, centery = 0, widthx = 50, widthy = 50) Sarah On Sun, Jun 23, 2013 at 4:08 PM, ASANTOS wrote: > Hi Dra. Goslee, > > I work in OS linux and I like very much your lssub function, > despites your notice. I think that the problems are in linux system, > because: > >> landc<- stack(c("stackIm1.sample.tif","tackIm2.sample.tif")) > Error in .local(.Object, ...) : > `/home/asantos/Documentos/Sensoriamento remoto percevejo > bronzeador/Contornos/tackIm2.sample.tif' does not exist in the file system, > and is not recognised as a supported dataset name. > > Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer", > : > Cannot create a RasterLayer object from this file. (file does not exist) > > > When I try to look the geotiff created (stackIm1.sample.tif) > there are something wrong, because the pictures doesn't open (complete > example below). > > Thanks for your attention, > > Alexandre > > > require(raster) > require(sp) > require(rgdal) > require(landsat) > # > #Create raster > r <- raster(nc=1000, nr=1000) > set.seed(20130622) > stackIm1 <- stack(lapply(1, function(x) setValues(r, round(runif(ncell(r))* > 255## Simulation red band > stackIm2 <- stack(lapply(1, function(x) setValues(r, round(runif(ncell(r))* > 255## Simulation nir > > # define projection system > r.geo <- CRS("+proj=utm +zone=23 +south +datum=WGS84 +units=m +no_defs") > # geographical datum WGS84 > proj4string(stackIm1) <- r.geo > proj4string(stackIm2) <- r.geo > # > > #Create geotiff > writeRaster(stackIm1, filename="stackIm1.tif", > format="GTiff",overwrite=TRUE) > writeRaster(stackIm2, filename="stackIm2.tif", > format="GTiff",overwrite=TRUE) > # > > #Subset a geotiff image 50 x 50 pixels > stackIm1.sample<-lssub("stackIm1.tif", "stackIm1.sample.tif", centerx = 0, > centery = 0, widthx = 50, widthy = 50) > stackIm2.sample<-lssub("stackIm1.tif", "sstackIm2.sample.tif", centerx = 0, > centery = 0, widthx = 50, widthy = 50) > # > landc<- stack(c("stackIm1.sample.tif","tackIm2.sample.tif")) > > > > > > Em 23/06/2013 12:59, Sarah Goslee escreveu: > >> Hi, >> >> What happens? >> >> Do you get an error? Where? >> >> What is your sessionInfo()? >> >> As it says in the lssub() help, this function was written for a >> particular purpose, is only known to work on linux, and may not be >> widely applicable. >> >> It's a "use at your own risk" kind of function, and you may well be >> better off using one of the many other methods available for >> subsetting raster data, which would save you the whole "export as >> GeoTIFF, subset, reimport" sequence. >> >> Sarah >> >> On Sun, Jun 23, 2013 at 11:36 AM, Alexandre Santos >> wrote: >>> >>> Dear Members, >>> >>> >>> I'm having trouble calculating NDVI difference, first the images Geotiff >>> can not view using Ubuntu 4.12 64-bit and therefore can not get to the NDVI, >>> follow an example: >>> >>> require(raster) >>> require(sp) >>> require(rgdal) >>> require(landsat) >>> # >>> #Create raster >>> r <- raster(nc=1000, nr=1000) >>> set.seed(20130622) >>> stackIm1 <- stack(lapply(1, function(x) setValues(
Re: [R-sig-Geo] Problem with NDVI difference with subset image
Hi, What happens? Do you get an error? Where? What is your sessionInfo()? As it says in the lssub() help, this function was written for a particular purpose, is only known to work on linux, and may not be widely applicable. It's a "use at your own risk" kind of function, and you may well be better off using one of the many other methods available for subsetting raster data, which would save you the whole "export as GeoTIFF, subset, reimport" sequence. Sarah On Sun, Jun 23, 2013 at 11:36 AM, Alexandre Santos wrote: > Dear Members, > > > I'm having trouble calculating NDVI difference, first the images Geotiff can > not view using Ubuntu 4.12 64-bit and therefore can not get to the NDVI, > follow an example: > > require(raster) > require(sp) > require(rgdal) > require(landsat) > # > #Create raster > r <- raster(nc=1000, nr=1000) > set.seed(20130622) > stackIm1 <- stack(lapply(1, function(x) setValues(r, round(runif(ncell(r))* > 255## Simulation red band > stackIm2 <- stack(lapply(1, function(x) setValues(r, round(runif(ncell(r))* > 255## Simulation nir > > # define projection system > r.geo <- CRS("+proj=utm +zone=23 +south +datum=WGS84 +units=m +no_defs")# > geographical datum WGS84 > proj4string(stackIm1) <- r.geo > proj4string(stackIm2) <- r.geo > # > > #Create geotiff > writeRaster(stackIm1, filename="stackIm1.tif", format="GTiff",overwrite=TRUE) > writeRaster(stackIm2, filename="stackIm2.tif", format="GTiff",overwrite=TRUE) > # > > #Subset a geotiff image 50 x 50 pixels > stackIm1.sample<-lssub("stackIm1.tif", "stackIm1.sample.tif", centerx = 0, > centery = 0, widthx = 50, widthy = 50) > stackIm2.sample<-lssub("stackIm1.tif", "sstackIm2.sample.tif", centerx = 0, > centery = 0, widthx = 50, widthy = 50) > # > > #Calculate NDVI difference > > multi.espc<-stack(c("stackIm1.sample.tif","stackIm2.sample.tif")) > > band3<-raster(multi.espc,1) > band4<-raster(multi.espc,2) > > ndvi<-(band4-band3)/(band4+band3) > > # > > > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] plotting counties of two states
Hi, Since you sent me your data (I'd still prefer dput() and you should use that in the future so you can send your data to the list): I don't see how your problem has anything to do with YNP. See below. On Mon, Jun 17, 2013 at 9:18 AM, Milan Sharma wrote: > Could you please run my code and see the problem? I spent couple days in it. > please help me, I attached my data to u. > library(maps) > library(maptools) > library(spdep) > data<-read.csv("2data.csv",header=TRUE) > dim(data)#79 rows > data$stateco <- paste(tolower(data$state),tolower(data$county), sep='.') > comap <- map("county",c("montana","wyoming"), fill=T, plot=F) > commaReplace <- function(x) { > return(gsub(",",".", x)) > } > comap$names <- sapply(comap$names, commaReplace, simplify=TRUE) > names(comap$names) <- NULL > length(comap$names) > comapP <- map2SpatialPolygons(comap, comap$names) > proj4string(comapP) <- CRS("+proj=longlat") > comapP<-comapP[-1] ^^^ This line deletes Montana's Beaverhead county from your SpatialPolygon object. Is that really what you wanted to do? > index <- match(comap$names,data$stateco) > index > data2 <- data[index,] > row.names(data2) <- comap$names This adds NA values for YNP, which makes sense. > counties <- SpatialPolygonsDataFrame(comapP, data=data2) But now you're trying to use an 80-element data frame with a 79-element Spatial Polygon object. If you refrain from deleting a perfectly good county, your code runs. Sarah > > From: Sarah Goslee > To: Milan Sharma > Cc: "r-sig-geo@r-project.org" > Sent: Monday, June 17, 2013 6:56 AM > Subject: Re: [R-sig-Geo] plotting counties of two states > > Hi, > > On Sun, Jun 16, 2013 at 10:46 PM, Milan Sharma > wrote: >> Hi all, >> As I already mentioned, this is the problem due to one extra county >> "yellowstone national" in montana. I am trying to plot Montana and wyoming >> together for further analysis.. At the last line, index does not match >> between counties$names and data$co(see NA below). I know this is is due to >> the extra county of montana. I would appreciate any help in this. > > Well, what do you want to have happen for Yellowstone National Park? > > You could import your own shapefile with the county boundaries you > expect, you could insert NA values into your data for YNP, you could > modify the file that you're using to remove that entry. And so on. > There's not an extra county, but there is an extra-county geographic > area. You need to decide what the best way for your purposes is to > handle that. > > >> I attached data if u want to have a look. > > The server blocks most attachments, and dput() is the best way to > provide data as part of a reproducible example. > >> library(maps) >> data<-read.csv("2data.csv",header=TRUE) >> dim(data)#79 rows >> [1] 79 6 >> data[1,]#first row >>statecountyYX Longitude Latitude >> 1 Montana Beaverhead 5.393363 7.893883 -112.8929 45.13386 >> data$co <- paste(tolower(data$state),tolower(data$county), sep='.') >> counties <- map("county",c("montana","wyoming"), fill=T, plot=F) >> commaReplace <- function(x) { >> + return(gsub(",",".", x)) >> + } >> counties$names <- sapply(counties$names, commaReplace, simplify=TRUE) >> names(counties$names) <- NULL >> length(counties$names) >> [1] 80 >> index <- match(counties$names,data$co) >> index >> [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 >> 24 25 >> [26] 26 27 29 28 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 >> 49 50 >> [51] 51 52 53 54 55 56 NA 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 >> 73 74 >> [76] 75 76 77 78 79 >> # >> Thanks in advance, >> Milan >> > > > -- > Sarah Goslee > http://www.functionaldiversity.org > > -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] plotting counties of two states
Hi, On Sun, Jun 16, 2013 at 10:46 PM, Milan Sharma wrote: > Hi all, > As I already mentioned, this is the problem due to one extra county > "yellowstone national" in montana. I am trying to plot Montana and wyoming > together for further analysis.. At the last line, index does not match > between counties$names and data$co(see NA below). I know this is is due to > the extra county of montana. I would appreciate any help in this. Well, what do you want to have happen for Yellowstone National Park? You could import your own shapefile with the county boundaries you expect, you could insert NA values into your data for YNP, you could modify the file that you're using to remove that entry. And so on. There's not an extra county, but there is an extra-county geographic area. You need to decide what the best way for your purposes is to handle that. > I attached data if u want to have a look. The server blocks most attachments, and dput() is the best way to provide data as part of a reproducible example. > library(maps) > data<-read.csv("2data.csv",header=TRUE) > dim(data)#79 rows > [1] 79 6 > data[1,]#first row > state countyYX Longitude Latitude > 1 Montana Beaverhead 5.393363 7.893883 -112.8929 45.13386 > data$co <- paste(tolower(data$state),tolower(data$county), sep='.') > counties <- map("county",c("montana","wyoming"), fill=T, plot=F) > commaReplace <- function(x) { > + return(gsub(",",".", x)) > + } > counties$names <- sapply(counties$names, commaReplace, simplify=TRUE) > names(counties$names) <- NULL > length(counties$names) > [1] 80 > index <- match(counties$names,data$co) > index > [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 > 25 > [26] 26 27 29 28 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 > 50 > [51] 51 52 53 54 55 56 NA 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 > 74 > [76] 75 76 77 78 79 > # > Thanks in advance, > Milan > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Problem with gdalinfo in landsat package
[forgot to copy the list] Hi, You need to install gdal following the usual procedure for your linux distro, possibly like this: sudo apt-get install proj sudo apt-get install gdal-bin Sarah On Wed, Jun 12, 2013 at 5:05 PM, Alexandre Santos wrote: > Dear members list, > > > I > try to subset a Landsat geotiff image with the lssub( > ) function in > a landasat package, but always done: gdalinfo: not found error. I make: > > band5.sample<-lssub("LANDSAT_5_TM_20100506_217_074_L2_BAND5.tif", > "subimage.tif", centerx = 773810, centery = 7841515, > centerepsg=29193,widthx = 100, widthy = 100) > > sh: > 1: gdalinfo: not found > > Error > in system(paste("gdalinfo ", filename, sep = ""), > intern = TRUE) > > There > are any member group that uses the landsat package that helps me. I > use Ubuntu OS Ubuntu 12.04 and R 3.0.0 > > Thanks, > > Alexandre > Santos -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Distance converted in koordinates
Hi, I'm not sure I entirely understand your question, but here are some thoughts. If all you have is distance from the station, that can't be turned into coordinates because a distance from a point describes a circle around that point. If you also have mapped bus route and order in time, then it should be possible to place points along that route. What other information do you have, and what are you trying to accomplish? Sarah On Wednesday, April 17, 2013, Endri Raco wrote: > Hi group, > I am stucked in a problem like this. > I have distances from a bus station in km generated in R language like > > > 0. 0.02725136 1.07634471 1.15963225 1.71421571 2.54945626 > 4.29135102 4.53532958 4.58512710 4.86466833 5.24266630 5.63505465 > > I need to convert this distances in coordinates in order to reflect > them as points in map > > Any ideas about this? > > Please help > > Regards > > > -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org [[alternative HTML version deleted]] ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] calculate semivariogram values and perform kriging BY HAND for a simple dataset
Hi, This sounds rather like homework. On Tue, Mar 19, 2013 at 11:00 AM, ToNoY wrote: > Can anyone tell me how to calculate semivariogram values by hand for point C And by hand? How is this an R question? If you have an R question, by all means ask here. If you have a homework question, please ask your professor or TA. If you have a general stats question, StackOverflow is a good choice. Sarah > and D considering the distance between point A and B? say I have the > following data points: > > point A: 60 (X-cord), 50 (Y-cord), & 1.2 (Z) > point B: 30 (X-cord), 20 (Y-cord), & 2.1 (Z) > point C: 20 (X-cord), 50 (Y-cord), & ? (Z) > point D: 60 (X-cord), 50 (Y-cord), & ? (Z) > > Now, say, the best fit for model for the semivariogram is given by a > spherical model as: > > y(h) = C0 + C(1-e^(h/a)) > > where, C0 = nugget effect, h = distance, and a = range. How can I do > ordinary kriging by hand to estimate the Z value at point C and D. Also, how > much weight (w) should be given to ZA and ZB while estimating ZC > (ZC=w1*ZA+w2*ZB) or ZD (ZD=w1*ZA+w2*ZB)? Thanks in advance. > > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Distance between two points
Hi Simon, I've copied this back to the list, as is encouraged. On Fri, Dec 7, 2012 at 9:41 AM, O'Hanlon, Simon J wrote: > Hi Sarah, thank you. > > My data points are located in West Africa, so I think a good projection would > be Lambert Azimuthal Equal Area. > > This does raise one more question for me. I also have some raster data that I > wish to use as covariates which is also in geographic coordinates. If I try > to simply reproject a raster, I think it would screw up the regular grid. > Does it make sense if I convert the lat-long raster to a > SpatialPointsDataFrame and transform this to LAEA so I could then create a > grid in the desired planar coordinates from scratch and use over() to assign > values from the reprojected spatial points onto the raster? A reprojected raster is still a raster, and thus a regular grid. Or am I missing something? Sarah > Thanks again for your help. > > Cheers, > > Simon > > -Original Message- > From: Sarah Goslee [mailto:sarah.gos...@gmail.com] > Sent: 07 December 2012 14:18 > To: O'Hanlon, Simon J > Cc: r-sig-geo@r-project.org > Subject: Re: [R-sig-Geo] Distance between two points > > Precisely. You should use great-circle distances with lat-lon coordinates, > rather than Euclidean distance, because the actual length varies with > position on the globe. > > Converting to UTM or something similar is one solution if your points are not > too far apart. > > There are many other R solutions: searching for "great circle distance" at > rseek.org will get you quite a list. > > Sarah > > On Fri, Dec 7, 2012 at 8:10 AM, O'Hanlon, Simon J > wrote: >> Dear list, >> I am using the package geoRglm to do some predictive mapping. There is a >> function that calculates the distance between observed data points and the >> prediction locations using a .C call to a function which eventually >> calculates the length of the hypotenuse between one location and the other >> given the vertical and horizontal separation distance of those points. >> >> My question is, is this method of distance-finding incompatible with >> long-lat style coordinates? Should I first transform my data and prediction >> locations into something where the unit of measurement is in metres rather >> than decimal degrees? >> >> Many thanks, >> >> Simon >> -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Distance between two points
Precisely. You should use great-circle distances with lat-lon coordinates, rather than Euclidean distance, because the actual length varies with position on the globe. Converting to UTM or something similar is one solution if your points are not too far apart. There are many other R solutions: searching for "great circle distance" at rseek.org will get you quite a list. Sarah On Fri, Dec 7, 2012 at 8:10 AM, O'Hanlon, Simon J wrote: > Dear list, > I am using the package geoRglm to do some predictive mapping. There is a > function that calculates the distance between observed data points and the > prediction locations using a .C call to a function which eventually > calculates the length of the hypotenuse between one location and the other > given the vertical and horizontal separation distance of those points. > > My question is, is this method of distance-finding incompatible with long-lat > style coordinates? Should I first transform my data and prediction locations > into something where the unit of measurement is in metres rather than decimal > degrees? > > Many thanks, > > Simon > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] saving results from a loop
Well, yes: summary(results[[i]]) gives you the summary for the i-th element of the list results, which is presumably the last of your loop iterations. summary(results[[1]]) summary(results[[2]]) summary(results[[3]]) or better, lapply(results, summary) You'd be well advised to read some intro to R materials, especially the sections about lists. Sarah On Tue, Dec 4, 2012 at 2:07 PM, alemante zd wrote: > Thanks Sarah. > > The code runs fine but I still dont get 3 different resukts (corresponding > to the 3 zs). Here is what I get instead: > >> summary(results[[i]]) > > Min.0.5900 > 1st Qu. 0.5911 > Median 0.5917 > Mean0.5918 > 3rd Qu. 0.5924 > Max.0.5936 >> summary (IDWRaster.temp) > > Min.0.5900 > 1st Qu. 0.5911 > Median 0.5917 > Mean0.5918 > 3rd Qu. 0.5924 > Max.0.5936 > > > the code > > library(gstat) > library(raster) > x <- 1:10 > #y <- 1:10 > z<- 1:10 > results <- list() > setwd("f:/Grids") > r2 <- raster("idgd_wgs.asc") > > z.list <- list(z1<-runif(10), z2 <- runif(10), z3 <- runif(10)) > da1<-data.frame(x=1:10, y=1:10) > for (i in 1:length(z.list)) { > da.temp<-data.frame(da1, z=z.list[[i]]) > > IDW.temp<- gstat(id = "z", formula = z~1, locations = ~x+y, data=da.temp, > set=list(idp =2)) > IDWRaster.temp <- interpolate(r2, IDW.temp) > results[[i]] <- IDWRaster.temp > } > > > Thanks again. > minti > On Tue, Dec 4, 2012 at 6:19 PM, Sarah Goslee wrote: >> >> I would save the information you're interested in as a list: >> >> >> library(gstat) >> library(raster) >> x <- 1:10 >> #y <- 1:10 >> z<- 1:10 >> >> results <- list() >> >> setwd("f:/Grids") >> r2 <- raster("idgd_wgs.asc") >> z.list <- list(z1<-runif(10), z2 <- runif(10), z3 <- runif(10)) >> da1<-data.frame(x=1:10, y=1:10) >> for (i in 1:length(z.list)) { >> da.temp<-data.frame(da1, z=z.list[[i]]) >> IDW.temp<- gstat(id = "z", formula = z~1, locations = ~x+y, data=da.temp, >> set=list(idp =2)) >> IDWRaster.temp <- interpolate(r2, IDW.temp) >> >> >> # I want to save the results from IDWRaster.temp >> >> results[[i]] <- IDWRaster.temp >> } >> >> On Tue, Dec 4, 2012 at 1:15 PM, alemante zd >> wrote: >> > Dear R-sig-geo users, >> > >> > I have the following code in a loop. I was wondering how I can get the >> > results saved from the loop. The result I am interested in >> > is IDWRaster.temp >> > >> > library(gstat) >> > library(raster) >> > x <- 1:10 >> > #y <- 1:10 >> > z<- 1:10 >> > setwd("f:/Grids") >> > r2 <- raster("idgd_wgs.asc") >> > z.list <- list(z1<-runif(10), z2 <- runif(10), z3 <- runif(10)) >> > da1<-data.frame(x=1:10, y=1:10) >> > for (i in 1:length(z.list)) { >> > da.temp<-data.frame(da1, z=z.list[[i]]) >> > IDW.temp<- gstat(id = "z", formula = z~1, locations = ~x+y, >> > data=da.temp, >> > set=list(idp =2)) >> > IDWRaster.temp <- interpolate(r2, IDW.temp) >> > # I want to save the results from IDWRaster.temp >> > } >> > Thanks in advance for any help. >> > Miniti >> > >> > [[alternative HTML version deleted]] >> > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] saving results from a loop
I would save the information you're interested in as a list: library(gstat) library(raster) x <- 1:10 #y <- 1:10 z<- 1:10 results <- list() setwd("f:/Grids") r2 <- raster("idgd_wgs.asc") z.list <- list(z1<-runif(10), z2 <- runif(10), z3 <- runif(10)) da1<-data.frame(x=1:10, y=1:10) for (i in 1:length(z.list)) { da.temp<-data.frame(da1, z=z.list[[i]]) IDW.temp<- gstat(id = "z", formula = z~1, locations = ~x+y, data=da.temp, set=list(idp =2)) IDWRaster.temp <- interpolate(r2, IDW.temp) # I want to save the results from IDWRaster.temp results[[i]] <- IDWRaster.temp } On Tue, Dec 4, 2012 at 1:15 PM, alemante zd wrote: > Dear R-sig-geo users, > > I have the following code in a loop. I was wondering how I can get the > results saved from the loop. The result I am interested in > is IDWRaster.temp > > library(gstat) > library(raster) > x <- 1:10 > #y <- 1:10 > z<- 1:10 > setwd("f:/Grids") > r2 <- raster("idgd_wgs.asc") > z.list <- list(z1<-runif(10), z2 <- runif(10), z3 <- runif(10)) > da1<-data.frame(x=1:10, y=1:10) > for (i in 1:length(z.list)) { > da.temp<-data.frame(da1, z=z.list[[i]]) > IDW.temp<- gstat(id = "z", formula = z~1, locations = ~x+y, data=da.temp, > set=list(idp =2)) > IDWRaster.temp <- interpolate(r2, IDW.temp) > # I want to save the results from IDWRaster.temp > } > Thanks in advance for any help. > Miniti > > [[alternative HTML version deleted]] > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Saving a variogram in gstat
On Mon, Nov 5, 2012 at 10:55 AM, carolina monmany wrote: > I see, Sarah. Thank you! > > Now I need to transfer those variograms to my PC running windows and that > was the reason I was doing > > save(variog11.2, file="tuc11.2.200.var.Rdata") > > and transfering those files from Linux to Windows. Should I transfer the > .Rdata in the directory instead? Where are the objects themselves? The R object named variog11.2 is saved in the binary file named tuc11.2.200.var.Rdata. That file can be copied to other computers and loaded using load(), which will create the variogram variog11.2 in that workspace (potentially overwriting any object already named variog11.2). I don't understand your question about directories. Sarah > > 2012/11/5 Sarah Goslee > >> On Mon, Nov 5, 2012 at 10:26 AM, carolina monmany >> wrote: >> > Thanks Sarah and Mauricio, >> > >> > here's the example >> > >> >> library(gstat) >> >> setwd("/home/acmonmany/matricesDN") >> >> tuc11.2.frm = read.table("plot11_2.txt", header=T) >> >> coordinates(tuc11.2.frm) <- c("X", "Y") >> >> proj4string(tuc11.2.frm) <-CRS("+proj=utm +zone=20 +south +ellps=intl >> > +towgs84=-355,21,72,0,0,0,0 +units=m +no_defs") >> >> variog11.2 <- variogram(reflectance~1, data=tuc11.2.frm) >> >> save(variog11.2, file="tuc11.2.200.var.Rdata") >> > >> > NOW when I try to load the saved file (I do not change directory and I >> can >> > see the files there, in the directory stated above): >> > >> > >> >> load("tuc11.2.200.var.Rdata") >> >> class("tuc11.2.200.var.Rdata") >> > [1] "character" >> >> Of course it is: >> >> "tuc11.2.200.var.Rdata" is a character string, as is anything in quotes. >> >> >> >> summary(tuc11.2.200.var) >> > Error in summary(tuc11.2.200.var) : >> > error in evaluating the argument 'object' in selecting a method for >> > function 'summary': Error: object 'tuc11.2.200.var' not found >> >> That's not anything, just the name of your Rdata file. The R object >> itself keeps the same name as it had when you saved it: variog11.2 >> summary(variog11.2) >> will show you its properties. If you ls() you'll see there is no R object >> called >> tuc11.2.200.var >> >> If you want your saved object to have that name, you need to rename it >> before saving. >> >> Sarah >> >> -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Saving a variogram in gstat
On Mon, Nov 5, 2012 at 10:26 AM, carolina monmany wrote: > Thanks Sarah and Mauricio, > > here's the example > >> library(gstat) >> setwd("/home/acmonmany/matricesDN") >> tuc11.2.frm = read.table("plot11_2.txt", header=T) >> coordinates(tuc11.2.frm) <- c("X", "Y") >> proj4string(tuc11.2.frm) <-CRS("+proj=utm +zone=20 +south +ellps=intl > +towgs84=-355,21,72,0,0,0,0 +units=m +no_defs") >> variog11.2 <- variogram(reflectance~1, data=tuc11.2.frm) >> save(variog11.2, file="tuc11.2.200.var.Rdata") > > NOW when I try to load the saved file (I do not change directory and I can > see the files there, in the directory stated above): > > >> load("tuc11.2.200.var.Rdata") >> class("tuc11.2.200.var.Rdata") > [1] "character" Of course it is: "tuc11.2.200.var.Rdata" is a character string, as is anything in quotes. >> summary(tuc11.2.200.var) > Error in summary(tuc11.2.200.var) : > error in evaluating the argument 'object' in selecting a method for > function 'summary': Error: object 'tuc11.2.200.var' not found That's not anything, just the name of your Rdata file. The R object itself keeps the same name as it had when you saved it: variog11.2 summary(variog11.2) will show you its properties. If you ls() you'll see there is no R object called tuc11.2.200.var If you want your saved object to have that name, you need to rename it before saving. Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Saving a variogram in gstat
Please provide a reproducible example with fake data and the exact commands you used. My suspicion is that you've tried to assign the output of load(), but you don't provide enough information for us to definitively diagnose your problem. Sarah On Monday, November 5, 2012, carolina monmany wrote: > Thanks, Sarah. I've tried that and it looks like it is loaded but when I > try to do anything such as plot(variog1) or fit it it does not work. When I > ask > > class(variog1) > > it says > > character > > > 2012/11/5 Sarah Goslee > > > > If you use save() to save your variograms, you need to use load() to load > > them. > > > > load("variog1.Rdata") > > > > Sarah > > > > > > On Monday, November 5, 2012, carolina monmany wrote: > > > >> Dear all, > >> > >> I am using R 2.15.1 and the package gstat in Linux to calculate > variograms > >> from large datasets (200x200m high resolution satellite images). > >> > >> I need to save all the variograms for later modelling and others and I > >> realized late that I was using the wrong command: > >> > >> save(variog1, file="variog1.Rdata") > >> > >> the variograms were being indeed saved but I cannot open them again > >> because they not being saved as variograms but as characters. > >> > >> I tried to save them using the suggested command: > >> > >> data(variog1): 'variog1'; > >> > >> with no success. My main question is: is there a way I can recover the > >> already saved variograms? > >> And the other question : what is the correct syntaxis for saving > >> variograms > >> in gstat? > >> > >> Thanks a lot. > >> -- > >> --- > >> A. CAROLINA MONMANY > >> Universidad de Puerto Rico > >> Departamento de Biologia - CN 235 > >> POBOX 23360 > >> San Juan, Puerto Rico 00931-3360 > >> Tel: +1 787 764 x2847 > >> Fax: +1 787 764 2610 > >> > >> [[alternative HTML version deleted]] > >> > >> ___ > >> R-sig-Geo mailing list > >> R-sig-Geo@r-project.org > >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo > >> > > > > > > -- > > Sarah Goslee > > http://www.stringpage.com > > http://www.sarahgoslee.com > > http://www.functionaldiversity.org > > > > > > -- > --- > A. CAROLINA MONMANY > Universidad de Puerto Rico > Departamento de Biologia - CN 235 > POBOX 23360 > San Juan, Puerto Rico 00931-3360 > Tel: +1 787 764 x2847 > Fax: +1 787 764 2610 > > [[alternative HTML version deleted]] > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org [[alternative HTML version deleted]] ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] How to cite raster package ?
Great question, and I'm glad you are planning to cite the packages you use. Load the package, and type: citation("raster") To get the proper citation for R itself: citation() Sarah On Fri, Oct 19, 2012 at 11:59 AM, Narayani Barve wrote: > Hi All, > > I have a genuine question. I want to cite raster package in my paper. But I > could not find the citation details. Any help will be appreciated. > > Thanks, > Narayani > > [[alternative HTML version deleted]] > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Help in simultaneous equations
On Mon, Jun 18, 2012 at 3:15 PM, Saima Bashir wrote: > HI, > I want to run simultaneous equation model. I installed packages sphet, > spdep, and spse. After you installed them did you load them into R with library("sphet") library("spdep") library("spse") > I imported weight matrix from matlab. when I tried to run the model with > these codes: > se <- spsegm(formula, data = pdata, w = W.txt, panel = TRUE, lags = list > (c(TRUE, FALSE, FALSE, FALSE), c(FALSE, TRUE, FALSE, FALSE), c(FALSE, FALSE, > TRUE, FALSE), c(FALSE, FALSE, FALSE, TRUE)), errors = list(FALSE, TRUE, TRUE, > TRUE), endogenous = list(c(FALSE, TRUE, TRUE, TRUE), c(TRUE, FALSE, TRUE, > TRUE), c(TRUE, TRUE, FALSE, TRUE), c(TRUE, TRUE, TRUE, FALSE))) > > I get this error: > > Error: could not find function "spsegm" If the packages installed correctly and loaded with library(), and you still get this error, please provide the information requested in the posting guide on OS, versions, data, etc. Sarah > Note: I have four equations and I am using cross section data. > > I will really appreciate if someone can help me out. > > Thanks > > Saima > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Simultaneous model
Precisely. You're missing the final closing parenthesis, and you've misspelled TRUE at least once. The proper tools will help with that, even without diving into a full IDE. Any text editor intended for programmers will match parentheses and highlight reserved words. Sarah On May 27, 2012, at 2:15 AM, Roman Luštrik wrote: > You are probably missing a close bracket. You could try one of developer's > environments that can handle code completion, match brackets, code folding > and much more. From top of my head, you can try ESS, RStudio and Eclipse + > StatET. > > > Cheers, > Roman > > > > On Sun, May 27, 2012 at 2:08 AM, Saima Bashir wrote: > >> Hi, >> >> >> I want to analyze Simultaneous equation mode. I had weight matrix imported >> from Matlab as read.table. whenever, I type codes and hit enter i get + >> sign. I have four equations in my model. Can any one please tell if I have >> problem in codes. Codes are: >> se <- spsegm(formula, data = pdata, w = W.txt, panel = TRUE, lags = list >> (c(TRUE, FALSE, FALSE, FALSE), c(FALSE, TRUE, FALSE, FALSE), c(FALSE, >> FALSE, TRUE, FALSE), c(FALSE, FALSE, FALSE, TRUE)), errors = list(c(FALSE, >> TRUE, TRUE, TURE), c(TRUE, FALSE, TRUE, TRUE), c(TRUE, TRUE, FALSE, TRUE), >> c(TRUE, TRUE, TRUE, FALSE)), endogenous = list(c(FALSE, TRUE, TRUE, TRUE), >> c(TRUE, FALSE, TURE, TRUE), c(TRUE, TRUE, FALSE, TRUE), c(TRUE, TRUE, TRUE, >> FALSE)) >> >> >> Thanks >> >> Saima >> >> [[alternative HTML version deleted]] >> >> ___ >> R-sig-Geo mailing list >> R-sig-Geo@r-project.org >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo >> > > > > -- > In God we trust, all others bring data. > >[[alternative HTML version deleted]] > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Need help in R
Hi, It looks like spse isn't on CRAN, but that you can get it straight from R Forge: https://r-forge.r-project.org/R/?group_id=1117 Sarah On Thu, May 24, 2012 at 3:08 PM, Saima Bashir wrote: > I have to use package "spse" to analyze my model. I am using R2.14.2 and was > unable to find this package in R 2.14.2. Can some one tell me please if I can > use any previous version of R. I have to use packages spse, spdep, and sphet > in one version. > > Thank you > > Saima > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] [R-sig-eco] Question about Mantel Test
Hi, Please don't cross-post. A Mantel test is most suited to problems that must be expressed in terms of distances, as Legendre states, although there is a mathematical relationship between correlation between distances and correlation between raw data. If your main concern is statistical testing, you can use a permutation test for significance of correlations without converting them to distances first, thus avoiding the parametric assumptions. If you want to use a Mantel approach to investigate *linear* spatial autocorrelation, then "distance apart" is relevant, and this does become a distance problem. You could then obtain the correlation between difference in variable X and difference in variable Y given their distance apart. Are you sure there's significant spatial autocorrelation? Have you tested for it in your data? If there is, is it meaningful in the context of your question? There are many approaches to dealing with spatial autocorrelation, and you might be best served to do some reading on your own and to consult a statistician, if you have access to one who is familiar with ecological data. Sarah On Thu, May 10, 2012 at 4:45 PM, Jaime Burbano Girón wrote: > Hi every body. > > I have some questions about Mantel Test. I expect that with experience in > spatial analysis of people in this list I can resolve them. Your > explanations and suggestions will help me so much, so, thanks in advance. > > For contextualizing. I want to explore the association between some > environmental variables: precipitation, temperature, bio-climatic > indicators (construction of "bio variables" proposed in WorlClim), EVI > (Enhanced Vegetation Index from MODIS-NDVI), NPP (Net Primary Product from > MODIS), and VCF (Vegetation Continues Fields for trees from MODIS). > > *1. *At first instance, I thought to calculate Pearson´s correlation > coefficient from Mantel Test approach, however, I have some doubts about > what I am actually doing with this. > > I think that I can obtain a more accurate correlation coefficient with out > the problem of spatial auto-correlation, due to permutation implicit in > Mantel Test, using as matrices for calculate it two grids of the set of > environmental variables. > > My real questions comes from the definition of matrices used in Mantel > Test, because they are proposed from literature to represent a relationship > between points included in them (often distances), but the grids do not > represent this, they are the raw values of environmental variables. In > fact, Legendre recommends that Mantel tests should not be used to test > hypotheses about the relationships of the original data tables. > > So am I correct in try to perform a correlation coefficient with out the > problem of spatial auto-correlation between any two grids using the Mantel > Test? > > *2. *An other option that I have thought for involving distances is to > perform the Mantel Test using a distance matrix between the two grids (this > distance measure could be the correlation coefficient) and the geographic > distance between grid points (Euclidean distance), since this is a way to > explore if a variable is spatially autocorrelated, even this is less used > than Moran Index or Correlogram. > > However, I am not sure if with this option I would test the spatial > correlation of the distance measure used, or I would obtain a correlation > index of the association of the two grids (distance measure used) with out > the problem of spatial auto-correlation due to permutation. Or both? > > *3.* How else can you recommend me to measure the relationship between two > environmental grids trying to minimize the effect of spatial > auto-correlation? > > Regards to all and thanks in advance for your help. > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] convex hull on PCA results of BIOCLIM variables
Hi, We don't know anything about your data. Providing a small reproducible example would go a long way toward making it possible to answer your question. The help file for s.chull gives some fake data; perhaps you could use that to more clearly describe what you are doing and what is going wrong. Or you could use dput() to give us a small portion of your actual data. Sarah On Wed, May 9, 2012 at 4:43 AM, Julian WITTISCHE wrote: > > Dear all, > I have a problem to plot a convex hulls on PCA results. The PCA has reduced > the 19 BIOCLIM variables to two axes and I want to plot a convex hull to be > able to illustrate the environmental space overlap of two species. > This is my script: > library(Hmisc);library(ade4); > #Import data > batrabio<-read.table(file="Bioclimfull.txt", sep="\t", > header=TRUE);batrabio<-batrabio[,c(1,4:22)]; #To select only species name > and the 19 bioclim variables columns > batrapair<-batrabio[batrabio$SCIENTIFIC_NAME=="Batrachoseps minor"| > batrabio$SCIENTIFIC_NAME=="Batrachoseps incognitus",]; #To select two species > to compare and illustrate their environmental space > batrapair<-unique(batrapair[,]);#To select only unique localities > #Run PCAs based on columns with climate data > pca.ade4<-dudi.pca(batrapair[,2:20], center=T, scale=T, scannf=T); 2;#number > of axes > #Create convex hull using PCA axes, and colour-code points according to > species name > convex.hull<-s.chull(pca.ade4$li,as.factor(batrapair$SCIENTIFIC_NAME),add.plot=F, > grid=F, clabel=0, origin=c(0,0),addaxes=T,col=c("red","blue"), cpoint=.65) > > I get the axes, the grid, the species name label but nothing else. I would > greatly appreciate any advice as I have not been able to figure myself how to > solve this problem. > Thank you very much, > Julian > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] problem when cropping soil layers
I think that should be: On Wed, Apr 4, 2012 at 12:51 PM, Agus Camacho wrote: > Dear list, > > For first time after using it several times, I had warnings using the crop > function with a raster stack from soil layers in format geotiiff derived > from the HWSD. > http://spatial-analyst.net/wiki/index.php?title=Global_datasets#Soil.2Fgeology_maps > > specifically, when: > > soil=crop(soil, extent(-180,180,-56,83.5)) soil <- crop(soil, extent(c(-180,180,-56,83.5))) See ?extent >> warnings()Warning messages: > 1: In if (!datatype %in% c("LOG1S", "INT1S", "INT2S", "INT4S", ... : > the condition has length > 1 and only the first element will be used > 2: In if (datatype == "LOGIC") { ... : > the condition has length > 1 and only the first element will be used > 3: In if (datatype == "BYTE") { ... : > the condition has length > 1 and only the first element will be used > 4: In if (datatype == "SMALL") { ... : > the condition has length > 1 and only the first element will be used > 5: In if (datatype == "INTEG") { ... : > > > a so on for a number of datatypes. > > I am new to soil modeling and cant figure out any reason for this, > specially because in other instances it did not appear such a messages. > Anybody could tell me what happened and if the layers are still usable > after these warnings? > > Thanks a lot! Think modelling would not be possible for a lot of people > without this list.. > > > There it goes my session info. > >> sessionInfo()R version 2.14.1 (2011-12-22) > Platform: x86_64-pc-mingw32/x64 (64-bit) > > locale: > [1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 > LC_MONETARY=English_Australia.1252 > [4] LC_NUMERIC=C LC_TIME=English_Australia.1252 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] maptools_0.8-14 foreign_0.8-48 geosphere_1.2-26 > rgdal_0.7-8 outliers_0.14 XML_3.9-4.1 > [7] PBSmapping_2.62.34 dismo_0.7-14 raster_1.9-58 > sp_0.9-93 ggplot2_0.9.0 lattice_0.20-0 > [13] plyr_1.7.1 > > loaded via a namespace (and not attached): > [1] colorspace_1.1-1 dichromat_1.2-4 digest_0.5.2 > grid_2.14.1 MASS_7.3-16 memoise_0.1 > [7] munsell_0.3 proto_0.3-9.2 RColorBrewer_1.0-5 > reshape2_1.2.1 scales_0.2.0 stringr_0.6 > [13] tools_2.14.1 > > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] a world type mapping question
Unsurprisingly, the maps package would be a good place to start. There have been a number of fairly recent discussions on this list and the r-help list about how to color entities according to some scheme. Sarah On Thu, Mar 29, 2012 at 6:19 PM, Hodgess, Erin wrote: > Dear People: > > > > I have a data set with rankings for 18 different countries on several > different concepts. I would like to produce a world map with colors on > the ones with rankings and perhaps grays on the NA countries. > > > > Is there a data frame/set with a list of countries available, please? > > > > Thanks, > > Erin > > > > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] great circle distances
Hi, On Mon, Mar 26, 2012 at 7:43 AM, A.P.B. Carneiro wrote: > Hi > > I need to calculate the average nearest neighbor distance between nests > coordinates (lat/long). However, I would like to use the great circle > distances in spite or Euclidian distances. Is it possible to do this in > ArcGis 10? Probably, but you're more likely to find out the answer if you ask on an ArcGIS list instead of an R list. Just for completeness, here's a nice answer for R: http://www.r-bloggers.com/great-circle-distance-calculations-in-r/ I don't use ArcGis, but googling "great circle distance ArcGIS" turns up a lot of potentially-helpful answers. I think StackOverflow probably has an ArcGIS discussion board you could try for more concrete answers. Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Fw: impuating non-zero values for 'zeros' in OpenBugs
On Mar 16, 2012 1:36 AM, "Subramanian Swaminathan" wrote: > > Dear listers, > > Apologies for sending this mail again. Hope this time I would get response from the listers. Well, it's not clear to me why you would expect the r-sig-geo list to be able to help with OpenBugs. It's even less clear to me whether you're even using R. If you are using BRugs, then the relevant R list would be appropriate. And if you're not using R at all, some OpenBugs list must surely exist. Either way, this isn't the appropriate place for your question. Sarah > I am trying to fit a Bayes Gaussian model on the log-odds of prevalence (as there is no denominator for binomial model) with imputed values for observed 'zero' prevalence. For this purpose I used the following OpenBugs code: > > model { > for( i in 1 : N ) { > r[i]~ dunif(0.001,100) > Y[i]r(k in 1:sumNumNeigh) { > weights[k] pha0 ~ dflat() > p.alpha0-step(alpha1) > alpha1 ~ dnorm(0.01, 1.0E-5) > tau ~ dgamma(0.001,0.001) > sigma anum(b[]) > } > > While compiling, I get an error message that there are multiple definitions for Y[5]. As I am newbie I am unable to resolve this error. Could you kindly help me out from this hurdle. Thanking you in advance > > yours sincerely > subramanian > > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo [[alternative HTML version deleted]] ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] spdep and server
A reproducible example and the basis system information requested in the posting guide would be very helpful. OS, version of R, versions of the relevant packages... We really do need this information to answer questions. Sarah On Thu, Dec 1, 2011 at 9:45 AM, Matilde Karakachoff wrote: > Ok, I’m sorry. I think that there was a little problem with my previous > message. > > I’m trying to execute some R commands on a linux server (where I installed R > and packages previously) to create a SpatialGridDataFrame. It has to be a > grid 10*10 to which I will associate data resulting from simulations of the > spatial distribution of genotypic data (Fregene). > > > Some lines and columns of my data frame: > coord x y f.all1s1 f.all2s1 > 4040 40 40 0,665 0,335 0,05346675 > 4041 40 41 0,72 0,28 0,049152 > 4042 40 42 0,825 0,175 0,04141875 > 4043 40 43 0,81 0,19 0,042483 > 4044 40 44 0,82 0,18 0,041772 > 4045 40 45 0,59 0,41 0,059643 > 4046 40 46 0,585 0,415 0,06006675 > 4047 40 47 0,405 0,595 0,07632075 > > My script: >> >> library(spdep) >> Locus1 <- read.csv2(file='data.csv', head=T) >> coordinates(Locus1) <- c('x', 'y') >> Locus1.sp <- as(Locus1, 'SpatialPixels') >> Locus1.gr <- as(Locus1.sp, 'SpatialGridDataFrame') > > > The first four lines are ok, but the last one gives the following error: > > Error in asMethod(object, Class, value) : replace-coercion not allowed > > But if I run it on my computer it works. So, why it doesn’t work on a > server? May be the ‘spdep’ package doesn't work in the same way on linux? > Thanks a lot, > > Matilde > > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Ideas on qualifying urban shapes: linear / circular / star
Fragstats used to be more freely available; too bad the source version is no longer available. It hasn't been supported for a very long time, but used to be downloadable anyway. Regardless, if I were going to implement that functionality in R, I would start with the r.le code from GRASS GIS. Using the R-GRASS would give you almost the same effect, but only if you already use GRASS. Sarah On Mon, Oct 3, 2011 at 7:04 AM, Barry Rowlingson wrote: > On Mon, Oct 3, 2011 at 10:47 AM, Mathieu Rajerison > wrote: > >> I'm not an R developper but I do think it would deserve an R package or at >> least an implementation in an existing one :) > > It seems to be only available as a Windows binary download with a > Public Domain license. Step 1 would be asking the authors to publish > their source code under an open source license. Then we can talk about > R packges! > > Barry > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Ideas on qualifying urban shapes: linear / circular / star
Mathieu, On Fri, Sep 30, 2011 at 9:24 AM, Mathieu Rajerison wrote: > Hi, > > > Maybe you're right: perimeter/ratio could be sufficient... > > Fractal dimension and lacunarity are good indicators for urban areas. Do you > know any R package, tool to quantify these? I've always just used Fragstats, as I already suggested, but you might look into SDMtools: http://cran.r-project.org/web/packages/SDMTools/ http://mo-seph.com/node/302 Sarah > I have found an ImageJ plugin called Fraclac. > > There is another one called r.lacunarity included in spatialtools > http://www.clusterville.org/spatialtools/index.html > r.lacunarity is interesting compared to ImageJ::Fraclac because it uses a > moving window and generates a raster. > > I launched a post about lacunarity and fractal dimension on R but didn't > have any answer. > > > So, if anyone manages to use r.lacunarity or knows other tools than Fraclac, > I'd be happy! > > > For those interested , here is some literature on fractal dimension applied > to analysis or aerial images or cities: > http://www.public.asu.edu/~smyint/publications/CEUS-Lacunarity-Myint-Lam.pdf > http://cybergeo.revues.org/8902 > http://www.isprs.org/proceedings/XXXVII/congress/3b_pdf/80.pdf > http://www.fatih.edu.tr/~mcadams/geo352/fractal.pdf > > > 2011/9/30 Sarah Goslee >> >> Hi, >> >> On Fri, Sep 30, 2011 at 5:21 AM, Mathieu Rajerison >> wrote: >> > Hello list, >> > >> > >> > I have determined major urban areas. >> > >> > This is just a post to get ideas from R-users on how to qualify urban >> > shapes. >> > >> > The data can either be binary raster (urban/ not urban), either vector. >> > >> > 1) Some urban areas follow linear infrastructures, thus are linear >> > 2) Some other diverge equally from a central heart, and are circular. >> > 3) Some are a mix and are like stars. >> >> That sounds like the kind of task that patch metrics such as >> perimeter/area >> ratio and fractal dimension were created for. Take a look at the copious >> Fragstats literature. I don't know if any have been implemented in R, but >> wouldn't be surprised. >> >> Sarah >> >> > The idea would be to get an index that give for each area, the >> > probability >> > of belonging to each of these three classes. Like a 3-column data frame >> > >> > I wondered if packages already existed, or statistical methods for this >> > purpose. Notably, I think that topographic derivatives derived from >> > smoothed/unsmoothed binary data like aspect, could be used to qualify >> > these >> > shapes (?) >> > >> > Thanks for any idea or exchange on the subject! >> > >> >> -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Ideas on qualifying urban shapes: linear / circular / star
Hi, On Fri, Sep 30, 2011 at 5:21 AM, Mathieu Rajerison wrote: > Hello list, > > > I have determined major urban areas. > > This is just a post to get ideas from R-users on how to qualify urban > shapes. > > The data can either be binary raster (urban/ not urban), either vector. > > 1) Some urban areas follow linear infrastructures, thus are linear > 2) Some other diverge equally from a central heart, and are circular. > 3) Some are a mix and are like stars. That sounds like the kind of task that patch metrics such as perimeter/area ratio and fractal dimension were created for. Take a look at the copious Fragstats literature. I don't know if any have been implemented in R, but wouldn't be surprised. Sarah > The idea would be to get an index that give for each area, the probability > of belonging to each of these three classes. Like a 3-column data frame > > I wondered if packages already existed, or statistical methods for this > purpose. Notably, I think that topographic derivatives derived from > smoothed/unsmoothed binary data like aspect, could be used to qualify these > shapes (?) > > Thanks for any idea or exchange on the subject! > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Generating a regular point pattern
Lacking any actual information on your problem, what about: expand.grid(x=1:10, y=1:10) modified as appropriate? On Thu, Jul 28, 2011 at 1:36 PM, Vero wrote: > Dear all, > > I need to generate a regular point pattern on a square-shaped grid. Can > anyone tell me of an easy way to do this? > > Thank you, > Vero -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Calculating distance (km) between points by sea
Hi, On Tue, Jun 28, 2011 at 9:24 AM, Ruth Kelly wrote: > Hi, > > I'm trying to calculate the shortest distances by sea between points in the > Meditteranean sea. I've been trying to do this using a costDistance > approach in the gdistance package. (See code below). > > I have imported maps from ArcGIS in which sea has a value of 1 and land > 10,000 there are also NA values at edges of the ascii matrix. I have set > the transition values to resistance so that points should choose travel by > sea. The projection is WCS 1984 (lat long) and the cell size (after > aggregate command) is 0.1 > > Hopefully the steps along the way are correct, but the output of the > costDistance command is confusing to me. The actually distances in km > should be in the region of from <10 to 100km. As a very quick first look, you're calculating distances on lat-lon units, so you're getting distances in lat-lon units. If I were doing it, I would reproject into m or km before calculating the distances, since lat-lon isn't a surface distance measure. In particular, a unit of longitude varies in length depending on the latitude, so you really can't convert after the fact. > Could anybody help me to find a way of converting this? I have tried a lot > of variations on the code and hope it is correct. I would appreciate > someone looking over it for me and letting me know if it's right. > > Many thanks > > Ruth > > ### code > > library(maptools) > > y <- readAsciiGrid("C:\\R\\Marine_algae\\westmed1.asc", proj4string = > CRS("+proj=longlat + ellps=WGS84")) > > > # vector of values from ascii grid ## > v1 <- y@data$westmed1.asc > > ## create raster ### > > library(raster) > med <- raster(y) > setValues(med, v1) > > med2 <- aggregate(med, fact=10, fun=min) > > > ### g distance ## > > library(gdistance) > tr2 <- transition(med2, transitionFunction="mean", directions = 8) > tr2 <- geoCorrection(tr2, type = "c") > matrixValues(tr2) <- "resistance" > > ## test points ## > > p1 <- read.table("C:\\R\\Marine_algae\\test_points_med.csv", header = T, sep > =",") > p1 <- unique(p1) > p1 <- as.matrix(cbind(p1$x, p1$y)) > > > cost1 <- costDistance(transition = tr2, fromCoords = p1, toCoords = p1) > > cost1 > [,1] [,2] [,3] [,4] [,5] [,6] [,7] > [1,] 0.00 2.7774957 2.7774957 2.7774957 2.0402271 2.306833 3.386609 > [2,] 2.777496 0.000 0.000 0.000 0.7372686 2.479186 3.576727 > [3,] 2.777496 0.000 0.000 0.000 0.7372686 2.479186 3.576727 > [4,] 2.777496 0.000 0.000 0.000 0.7372686 2.479186 3.576727 > [5,] 2.040227 0.7372686 0.7372686 0.7372686 0.000 1.741917 2.839459 > [6,] 2.306833 2.4791858 2.4791858 2.4791858 1.7419172 0.00 3.106073 > [7,] 3.386609 3.5767274 3.5767274 3.5767274 2.8394588 3.106073 0.00 > > > ## ??? conversion to km??? > > > ___ -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Text label buffering
I would just use rect() to draw a white rectangle, then put the text on top of it. Trying to frame each letter just seems like too much work. par(bg='black') plot.new() rect(.4, .4, .6, .6, col="white") text(0.5, 0.5, label='text', col='black', font=1, cex=3) Sarah On Thu, Jun 23, 2011 at 2:10 PM, Matthew Vavrek wrote: > Hello all, > I'm making up some maps in R, but some of the labels are being obscured by > other lines on the map. I'd like to be able to buffer my labels, so that > there's a bit of whitespace surrounding each letter to make them more > readable. I've tried doing this by doing a double call to text(), with white > in bold (font=2) and then a regular font, and by adjusting the text size, > but the text doesn't really match up between the two labels this way. > > for example: > > par(bg='black') > plot.new() > text(0.5, 0.5, label='text', col='white', font=2, cex=3) > text(0.5, 0.5, label='text', col='black', font=1, cex=3) > > or: > > par(bg='black') > plot.new() > text(0.5, 0.5, label='text', col='white', cex=3) > text(0.5, 0.5, label='text', col='black', cex=2.9) > > give the idea of what I want, but not quite as cleanly as I'd like. > > Is there some way of doing this? Seems like there should be, but searching > the internets hasn't turned up anything yet. > > Thanks > Matthew > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Help to eliminate duplicated from data.frame but Special Problem
So you want to look at all rows, not just the index? Then specify that: > my.df[!duplicated(my.df),] Id value1 value2 1 1 10100 2 2 20200 3 3 30300 4 4 40400 5 5 50500 7 6 60600 8 7 70700 9 8 80800 11 8 81799 12 9 90900 R will do exactly what you tell it, and only that. And thank you for including a workable example! Sarah On Wed, Mar 9, 2011 at 9:42 AM, gianni lavaredo wrote: > Dear Reseacher, > i need to resolve the following problem. I wish to delete duplicate row from > a data.frame but not all duplicate row: > > > ex: > > my.df <- data.frame(Id=c(1,2,3,4,5,5,6,7,8,8,8,9), > value1=c(10,20,30,40,50,50,60,70,80,80,81,90), > value2=c(100,200,300,400,500,500,600,700,800,800,799,900)) > > >> my.df > Id value1 value2 > 1 1 10 100 > 2 2 20 200 > 3 3 30 300 > 4 4 40 400 > 5 5 50 500 > 6 5 50 500 > 7 6 60 600 > 8 7 70 700 > 9 8 80 800 > 10 8 80 800 > 11 8 81 799 > 12 9 90 900 > > > eliminate > >> my.df > Id value1 value2 > 1 1 10 100 > 2 2 20 200 > 3 3 30 300 > 4 4 40 400 > 5 5 50 500 > 7 6 60 600 > 8 7 70 700 > 9 8 80 800 > 11 8 81 799 > 12 9 90 900 > > but if I use > > xx <- my.df[!duplicated( my.df$Id), ] > > my result is > >> xx > Id value1 value2 > 1 1 10 100 > 2 2 20 200 > 3 3 30 300 > 4 4 40 400 > 5 5 50 500 > 7 6 60 600 > 8 7 70 700 > 9 8 80 800 > 12 9 90 900 > > > thanks in advance > Gianni > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] How do you produce a output table containing distances between mineral grains at various azimuthal directions?
Michael, Do you have quantitative data, or just images. If the former, seeing an example of what you have and what you'd like the output to be would be very helpful. If the latter, a program like ImageJ (free and Open Source; google for it) might be more what you need. Sarah On Sat, Feb 12, 2011 at 2:57 PM, Michael Stillwagon wrote: > I am using *R* and I am a senior at Western Carolina University and working > on my senior thesis and the data set in which I have are images of mineral > thin sections all separated into different groups of grains, magnetite, > quartz, etc.. either being a vector layer or a raster layer or any other > image format needed. I am wanting to calculate the distance between each > grain or the grain spacing, boundary to boundary, *NOT* center to center and > also have those distances given every 10 degrees on a 0 to 360 degree > directional scale. Is there any code out there that does this very exact > method? Or is there another program, ArcGIS 10 or Fragstats, R preferably. > > Thanks, > > -Michael Stillwagon > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Differing pch symbols for categorical data in spplot
Hi Lee, Here's a neat way to do that (with fake data, since it doesn't actually have anything to do with polygons): pointclass <- c(1, 2, 1, 1, 3, 2) classcol <- c("red", "blue", "green") classpch <- c(5, 17, 3) plot(1:6, 1:6, col=classcol[pointclass], pch=classpch[pointclass]) Sarah On Mon, Dec 20, 2010 at 4:00 PM, Lee Hachadoorian wrote: > I managed to get something working here, but can't take it any further. I > would like to map points on top of polygons using spplot, and control the > pch symbols and colors used by the points, which represent categorical > data. > > I was able to get this partially working. An example using data included > with the sp package is: > > #LOAD LIBRARY > library(sp) > > #CREATE SpatialPolygonsDataFrame OF RIVERBED > data(meuse.riv) > meuse.lst = list(Polygons(list(Polygon(meuse.riv)), "meusee.riv")) > spdfMeuse = SpatialPolygonsDataFrame( > SpatialPolygons(meuse.lst), > data.frame(anything = 1, row.names = "meusee.riv") > ) > > #CREATE SpatialPoints OF SOIL SAMPLES > data(meuse) > coordinates(meuse) = c("x", "y") > > #PLOT > spplot(spdfMeuse, > sp.layout = list( > "sp.points", > meuse, > pch = as.integer(meuse$soil) > ) > ) > > Since I'm casting soil (a 3-level factor) to integer, I can pass it as an > argument to pch. But this gives me very limited control over the symbols > used. I can add an integer to get, for example, pch 15, 16, & 17, but what > if I want to use pch 5, 13, & 17? Also, I can set the color with col = > "whatever", but I haven't been able to figure out how to print three > different colors that are linked to the three factors. > > Any suggestions on how to accomplish this or otherwise improve this call > to spplot would be greatly appreciated. > > Regards, > Lee Hachadoorian > PhD Student, Geography > Program in Earth & Environmental Sciences > CUNY Graduate Center -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo