Re: [R-sig-Geo] Count of Non-NA pixels in stars object

2020-10-03 Thread Vijay Lulla
t; cnt_pixels = function(s, na.rm = TRUE, ...) { > # Count number of non NA values in $Value attrib > sdf = as.data.frame(s) > if (na.rm) { > sdf = sdf[complete.cases(sdf),] > } > return(length(sdf$Value)) > } > > # Using st_apply > cnt = st_apply(m_stars, >MARGIN = "DOY", &g

Re: [R-sig-Geo] Count occurrences less memory expensive than superimpose function in several spatial objects

2020-08-19 Thread Vijay Lulla
s/n - Vila Real > Caceres - MT - CEP 78201-380 (ZIP code) > Phone: (+55) 65 99686-6970 / (+55) 65 3221-2674 > Lattes CV: http://lattes.cnpq.br/1360403201088680 > OrcID: orcid.org/-0001-8232-6722 > ResearchGate: www.researchgate.net/profile/Alexandre_Santos10 > Publons: https://publons.com/researcher/3085587/alexand

Re: [R-sig-Geo] indexing multi-layer rasters

2020-01-17 Thread Vijay Lulla
SS=C LC_TELEPHONE=C > > LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > # > > # attached base packages: > > # [1] stats graphics grDevices utils datasets methods base > > # > > # other attached packages: > > # [1] raster_3.0-7 sp_1.3-2 > > # > > # loaded via a

Re: [R-sig-Geo] raster: stackApply problems..

2019-11-27 Thread Vijay Lulla
, ymax) > crs: NA > names : layer.1, layer.2, layer.3, layer.4, layer.5, layer.6, > layer.7 > min values : 442.7436, 440.0467, 444.9182, 437.1589, 444.6946, 440.2028, > 429.6900 > max values : 556.2471, 563.8341, 561.7687, 560.4509, 565.8671, 560.1375, > 561.7972

Re: [R-sig-Geo] raster: stackApply problems..

2019-11-26 Thread Vijay Lulla
mains in memory) to > see that the indexes are identical (stackApply = ver_median = > lubridate::wday) > https://gist.github.com/kokkytos/5d554b5a725bb48d2189e2d1fa0e2206 > > Thank you again > On 11/26/19 9:00 PM, Vijay Lulla wrote: > > I'm sorry for the miscommunicatio

Re: [R-sig-Geo] raster: stackApply problems..

2019-11-26 Thread Vijay Lulla
-11-26_191439_7710_04780.grd > names : X1, X2, X3, X4, X5, > X6, X7 > min values : 440.0467, 444.9182, 437.1589, 444.6946, 440.2028, 429.6900, > 442.7436 > max values : 563.8341, 561.7687, 560.4509, 565.8671, 560.1375, 561.7972, > 556.2471 &

Re: [R-sig-Geo] raster: stackApply problems..

2019-11-26 Thread Vijay Lulla
If you read the code/help for `stackApply` and `zApply` you'll see that the results that you obtain make sense (at least they seem sensible/reasonable to me). IMO, if you want to control the ordering of your layers then just use sapply, like how you've used for ver_mean. IMO, this is the only

Re: [R-sig-Geo] Plotting median values globally

2019-10-29 Thread Vijay Lulla
Did you try `levelplot(raster(RCP1pctCO2median, 61))`? On Tue, Oct 29, 2019 at 12:17 AM rain1290--- via R-sig-Geo < r-sig-geo@r-project.org> wrote: > Hi there, > I am trying to create a global plot with median precipitation values. What > I would like to do is isolate the "median" values and

Re: [R-sig-Geo] Implementing a rolling window for stars object

2019-10-23 Thread Vijay Lulla
t;>> Thanks > >>>> -- > >>>> Micha Silver > >>>> Ben Gurion Univ. > >>>> Sde Boker, Remote Sensing Lab > >>>> cell: +972-523-665918 > >>>> ___ > >>>> R-sig-

Re: [R-sig-Geo] Adding a Few Neighbour Relationships to a nb List

2019-08-07 Thread Vijay Lulla
ing this with [[]] works really well to create nicely corrected graphs. >> >> >> >> But fails due it “out of bounds index errors” with regression >> equations >> >> >> >> I find this ever so confusing….??? >> >> >> >> Thankyou so much again, >> >&

Re: [R-sig-Geo] Adding a Few Neighbour Relationships to a nb List

2019-08-07 Thread Vijay Lulla
Maybe https://cran.r-project.org/web/packages/spdep/vignettes/nb_igraph.html can help with all your questions. https://cran.r-project.org/web/packages/spdep/vignettes/nb_sf.html contains a little more detail about nb structure. Finally, I encourage you to use `str` to study the structure of R

Re: [R-sig-Geo] Convert data.frame/SpatialPointsDataFrame to raster

2019-08-01 Thread Vijay Lulla
uji Sb wrote: >> >> > Dear Vijay, >> > >> > Thank you again for your reply. I have attached my data for two years >> and >> > two variables. Hope they will go through, otherwise the files are also >> > available here >> > <

Re: [R-sig-Geo] Convert data.frame/SpatialPointsDataFrame to raster

2019-07-31 Thread Vijay Lulla
3986143008625, 3.68043269045659, 4.09571655859075, > 4.57299670034984), year = c(2010, 2020, 2030, 2040, 2050, 2060, > 2070, 2080, 2090, 2100)), row.names = c(NA, 10L), class = "data.frame") > > Sincerely, > > Milu > > On Wed, Jul 31, 2019 at 9:20 PM Vijay Lulla w

Re: [R-sig-Geo] Convert data.frame/SpatialPointsDataFrame to raster

2019-07-31 Thread Vijay Lulla
?`rasterFromXYZ` states that "x and y represent spatial coordinates and must be on a regular grid." And, it appears to me that you might be losing values by rounding lon/lat values. The help file further suggests that `rasterize` might be the function you're looking for. List members will

Re: [R-sig-Geo] add a field to sf object and point shape in kml

2019-05-08 Thread Vijay Lulla
ue, May 7, 2019 at 6:11 PM Vijay Lulla wrote: > >> Good one Barry! As far as I'm aware sf uses rgdal to write various file >> formats and writeOGR has options called dataset_options and layer_options >> which are considered experimental. >> > > Not quite - `sf`

Re: [R-sig-Geo] add a field to sf object and point shape in kml

2019-05-07 Thread Vijay Lulla
Good one Barry! As far as I'm aware sf uses rgdal to write various file formats and writeOGR has options called dataset_options and layer_options which are considered experimental. Do you know if either of these options can be used instead of creating a new field/attribute for the sf dataframe?

Re: [R-sig-Geo] Selecting a range of longitude and latitudes

2019-04-18 Thread Vijay Lulla
It appears that you might have mistakenly typed cbind(103:110, 3:16) instead of cbind(103:116, 3:16). Regardless, the warning is telling you that the vectors were of unequal lengths and there was some recycling. You can learn about recycling rule from searching "recycling rule in R" and also

Re: [R-sig-Geo] [FORGED] Re: Aggregating points based on distance

2019-03-15 Thread Vijay Lulla
+1 from me too for Rolf's nomination! On Thu, Mar 14, 2019 at 6:43 PM Dexter Locke wrote: > FWIW: I agree with Rolfs nomination. > > +1 > > -Dexter > http://dexterlocke.com > > > > On Thu, Mar 14, 2019 at 5:30 PM Rolf Turner > wrote: > > > > > On 14/03/19 7:33 AM, Barry Rowlingson wrote: > > >

Re: [R-sig-Geo] Consolidated SRS database/list?

2018-09-22 Thread Vijay Lulla
Thanks, > Alex > > On 09/21/2018 12:32 AM, Roger Bivand wrote: > > On Thu, 20 Sep 2018, Vijay Lulla wrote: > > > >> Ok, thanks! While the page provided information about the project and > >> its > >> funding status I couldn't find the SQL

Re: [R-sig-Geo] Consolidated SRS database/list?

2018-09-20 Thread Vijay Lulla
Ok, thanks! While the page provided information about the project and its funding status I couldn't find the SQLite database. Do you happen to know when this will be available? On Thu, Sep 20, 2018 at 1:02 PM Roger Bivand wrote: > On Thu, 20 Sep 2018, Vijay Lulla wrote: > > &g

[R-sig-Geo] Consolidated SRS database/list?

2018-09-20 Thread Vijay Lulla
Dear list members, A few years ago Roger Bivand posted a discussion ( https://stat.ethz.ch/pipermail/r-sig-geo/2015-August/023204.html ) about consolidating SRS definitions into a SQLite database and I am wondering if there has been any development along those lines. Specifically, is there any

Re: [R-sig-Geo] help: Problem getting centroids inside lists

2018-09-12 Thread Vijay Lulla
e(lon = c(-9, -8, -3), lat = c(-1, > > 25, > > 5)), > > two = data.frame(lon = c(-90), lat = c(-1 > > > > coordinates(ct$a$one) <- ~lon+lat > > coordinates(ct$a$two) <- ~lon+lat > > coordinates(ct$b$one) <-

Re: [R-sig-Geo] drawing a polygon from several lines

2018-08-24 Thread Vijay Lulla
- > SpatialPolygons(list(Polygons(list(Polygon(rbind(limmin,limmax))),ID='1'))) > proj4string(spp.farea) <- CRS("+proj=longlat +datum=WGS84") > > plot(spp.farea,col="chocolate3",lwd=2,add=T) > > # select the squares under the polygon > fareasq <

Re: [R-sig-Geo] parallelize distance matrix

2018-08-21 Thread Vijay Lulla
You'll have to do clusterExport(cl, c("ll")) before you call parRapply. Please see ?`parRapply` and pages 10 and 11 of the parallel::parallel vignette. HTH, Vijay. On Tue, Aug 21, 2018 at 2:54 PM Roman Luštrik wrote: > Cross posted on SO: > >

Re: [R-sig-Geo] st_distance to replace dist in pipes - help needed

2018-08-16 Thread Vijay Lulla
y.x), c(utm_x.y, > utm_y.y))), NA)) > > dist.mat<-matrix(res$Distance,nrow = 20,ncol = 20) > > Data prep for eventually using sf::st_distance: > pts.utm.sf <- df12 %>% > st_as_sf(coords=c('X','Y'), crs=4326) %>% #wgs84 long lat > st_transform(32609) #wgs84 utm zone9 >

Re: [R-sig-Geo] how to create several polygons from a list of vertices

2018-08-14 Thread Vijay Lulla
Maybe something like this? poly <- SpatialPolygons(list(Polygons(tapply(seq_len(nrow(vertices)), vertices$cod, function(x) Polygon(vertices[x,1:2])), ID="1")),

Re: [R-sig-Geo] Extract coordinates from rasterbrick

2018-08-14 Thread Vijay Lulla
And if you need coordinates as part of your data frame just do cbind(coordinates(x), as.data.frame(x, xy = TRUE)) On Tue, Aug 14, 2018 at 11:50 AM Bede-Fazekas Ákos wrote: > Dear Milu, > > I think that you are looking for as.data.frame(x, xy = TRUE). > > HTH, > Ákos Bede-Fazekas > Hungarian

Re: [R-sig-Geo] CRAN releases of sp, rgdal and rgeos

2018-06-12 Thread Vijay Lulla
urse, > any help from anyone else on these kind of issues is highly appreciated. > > On 06/12/2018 04:41 PM, Vijay Lulla wrote: > > Thank you for the explanation of difference between proj.h and proj_api.h > > and the recommendation of setting environment variable for pkg-config. I &

Re: [R-sig-Geo] CRAN releases of sp, rgdal and rgeos

2018-06-12 Thread Vijay Lulla
, Roger Bivand wrote: > On Tue, 12 Jun 2018, Vijay Lulla wrote: > > I too use R on a mac but I cannot get rgdal to use proj5 (port info proj). >> rgdal still uses proj4 even when there is a newer version of proj already >> on my computer. Neither of these proj packages (proj

Re: [R-sig-Geo] CRAN releases of sp, rgdal and rgeos

2018-06-11 Thread Vijay Lulla
le as R's internal memory management is made > > even more efficient. This involves compiled code using memory allocated > by > > R to be freed by R's garbage collector, which has to know if an object is > > still being used. Tomas Kalibera, the author of rchk, helped resolve and >

Re: [R-sig-Geo] Extract xy coordinates from raster of interesting neighborhood cells

2018-05-30 Thread Vijay Lulla
mt.edu.br > > Lattes: http://lattes.cnpq.br/1360403201088680 > > OrcID: orcid.org/-0001-8232-6722 > > Researchgate: www.researchgate.net/profile/Alexandre_Santos10 > > LinkedIn: br.linkedin.com/in/alexandre-dos-santos-87961635 > > Mendeley:www.mendeley.com/profiles/alexandre-dos-santos6/ > > > > _

Re: [R-sig-Geo] Bug in raster::crop?

2018-05-01 Thread Vijay Lulla
..@hafogvatn.is > > > > ___ > > R-sig-Geo mailing list > > R-sig-Geo@r-project.org > > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > > > > [[alternative HTML version deleted]] > > ___

Re: [R-sig-Geo] WPS client implementation in R

2018-02-20 Thread Vijay Lulla
a some generic REST API you'd still have > to write some client code to interpret the outputs. > > Barry > > [[alternative HTML version deleted]] > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https

Re: [R-sig-Geo] Monte Carlo with mc2d

2018-01-30 Thread Vijay Lulla
4.html#a7367555 > > > > Thanks in advance for any suggestions, > > Todd > > > > -- > > Todd McDonnell > > Research Scientist, Ph.D. > > E Environmental Chemistry > > 2161 NW Fillmore Ave., Corvallis, OR > > > > > [[alter

Re: [R-sig-Geo] Change dataframe values using log and if condition

2017-12-29 Thread Vijay Lulla
ames(tcPainelLog[6:17]) > > for (j in cols) { > for (i in 1:length(j)) { > ifelse(tcPainelLog[[i]] > 0, log(i), log1p(i)) > } > } > > > > I would appreciate any help. > > Thank you. > > Daniel > > __

Re: [R-sig-Geo] Is the raster package still receiving updates?

2017-10-21 Thread Vijay Lulla
296, fax: > ++49.(0)6421.2828950, web: gis-ma.org, giswerk.org, > moc.environmentalinformatics-marburg.de > ___ > R-sig-Geo mailing list R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > > > > > >

Re: [R-sig-Geo] Multi-file raster stack from netcdf specifying levels

2017-10-19 Thread Vijay Lulla
ile read in the right way using the raster package? Any other > option? > > > Greetings, > -- Thiago V. dos Santos > > Postdoctoral Research Fellow > Department of Climate and Space Science and Engineering > University of Michigan > > ___

Re: [R-sig-Geo] Slow writing of point features to SpatialLite-DB or Geopackage

2017-08-24 Thread Vijay Lulla
According to http://gdal.org/drv_sqlite.html you can unset OGR_SQLITE_SYNCHRONOUS and it should improve performance. So, use Sys.setenv(OGR_SQLITE_SYNCHRONOUS="OFF") in your script/session before you wish to call writes.​ The SQLite and GPKG writes are still 11x and 13x respectively slower

Re: [R-sig-Geo] [FORGED] Re: Error when I try to interpolate NA for each cell from Rasterstack

2017-01-14 Thread Vijay Lulla
On 15/01/17 05:11, Vijay Lulla wrote: > >> I think this is because interpNA returns a matrix of one column whereas >> raster::setValues (used internally by calc) expects the values to be a >> vector of elements. Changing the last line in `fun_interp` from >> `return(z)`

Re: [R-sig-Geo] Error when I try to interpolate NA for each cell from Rasterstack

2017-01-14 Thread Vijay Lulla
I think this is because interpNA returns a matrix of one column whereas raster::setValues (used internally by calc) expects the values to be a vector of elements. Changing the last line in `fun_interp` from `return(z)` to `return(c(z))` might do the trick. HTH, Vijay. On Sat, Jan 14, 2017 at

Re: [R-sig-Geo] Simple features now on CRAN

2016-11-04 Thread Vijay Lulla
After reading the vignette I tried it with a few shapefiles and it seems to be going well so far! Good work! Congratulations. On Fri, Nov 4, 2016 at 11:03 AM, Edzer Pebesma < edzer.pebe...@uni-muenster.de> wrote: > Package sf (for "simple features") is now on CRAN: > >

Re: [R-sig-Geo] Shape file for Madhya Pradesh State in India with Districts

2016-11-04 Thread Vijay Lulla
Have you tried http://www.gadm.org/ ? On Fri, Nov 4, 2016 at 7:29 AM, SunilChoudhary wrote: > Hi Folks > > Can someone point me to Shape file for Madhya Pradesh State in India > preferably with districts. > > > Thanks > Sunil Choudhary > > > > [[alternative

Re: [R-sig-Geo] write.tgrass (spacetime) does not work for any RasterStack

2016-09-06 Thread Vijay Lulla
You can use the function `setZ` from raster package to set z (here "time") attribute. Please see ?`setZ`. On Tue, Sep 6, 2016 at 2:43 PM, Veronica Andreo wrote: > Hello > > I'm working with raster time series in GRASS, but I needed to apply a > gap-filling function

Re: [R-sig-Geo] Incorrect month order in zApply function

2016-07-29 Thread Vijay Lulla
Ben, You're right about a mistake in my code but it is not use of ordered function. It is that I shouldn't have used the name argument. Following your example this is what I get: > m <- function(x) ordered(months(x), labels=month.name) > x1 <- zApply(s, by=m, mean) # no name argument. > x1 #

Re: [R-sig-Geo] Incorrect month order in zApply function

2016-07-29 Thread Vijay Lulla
Maybe like this? R> m <- function(x) ordered(months(x),labels=month.name) R> x1 <- zApply(s, by=m, mean, name=month.abb[]) R> names(x1) # Appears to have natural ordering R> all(x[] == x1[]) # TRUE I'm not sure how using factors will impact other aspects of your project. HTH, Vijay. On Thu, Jul

Re: [R-sig-Geo] raster overlay: apply function on multiple RasterBrick

2016-07-20 Thread Vijay Lulla
I'm not sure that this is the best way but I think this does what you want. R> b1 <- brick(ncol=10,nrow=10,nl=15) R> b1[] <- rnorm(length(b1),3,2) R> b2 <- b1*b2 R> b3 <- stack(b1,b2) R> fun3 <- function(x) { lm(x[16:30] ~ x[1:15])$coefficients[[2]] } R> out3 <- calc(b3, fun3) This is similar to

Re: [R-sig-Geo] Add +1 to current value of a cell in a raster in R

2016-07-10 Thread Vijay Lulla
(1,1,1,1,1,1,1,5,5,1,5,5),ncol=2,byrow=TRUE) > r[idx] <- r[idx] + 1 > plot(r) > range(getValues(r)) > #[1] 0 1 > > I could be misreading the original posting, but I think the desire is that > the result will be increment for each repeated index using just one > suba

Re: [R-sig-Geo] Add +1 to current value of a cell in a raster in R

2016-07-10 Thread Vijay Lulla
Maybe something like this? R> r <- raster(nrows=5,ncols=5) R> r[] <- 0 R> idx <- matrix(c(1,1,1,5,5,1,5,5),ncol=2,byrow=TRUE) # four corners of the raster! R> r[idx] <- r[idx] + 1 R> image(r) >From R's ?`[` : When indexing arrays by '[' a single argument 'i' can be a matrix with as many columns

Re: [R-sig-Geo] How to calculate climatology in rasterbricks

2016-06-04 Thread Vijay Lulla
%%100 >> meanYM <- calc(s.c, fun=function(x) { by(x, idxYM, sum) }) >> meanM <- calc(meanYM, fun=function(x) { by(x, idxM, mean) }) >> plot(meanYM,1) # Note that no 0 was added across the extent >> plot(meanM,1) # This is OK too, no grey area >>

Re: [R-sig-Geo] How to calculate climatology in rasterbricks

2016-06-03 Thread Vijay Lulla
antos > > PhD student > Land and Atmospheric Science > University of Minnesota > > > > On Friday, June 3, 2016 4:25 AM, Loïc Dutrieux <loic.dutri...@wur.nl> wrote: > This can also be done with zApply: > > library(zoo) > > sYM <- zApply(s, by = as.yearmon, sum) >

Re: [R-sig-Geo] How to calculate climatology in rasterbricks

2016-06-02 Thread Vijay Lulla
I think the following StackOverflow question has the answer: http://stackoverflow.com/questions/16135877/applying-a-function-to-a-multidimensional-array-with-grouping-variable/16136775#16136775 Following the instructions listed on that page for your case might go something like below: > idxYM <-

Re: [R-sig-Geo] Overlay between polygons and their intersecting lines

2016-05-28 Thread Vijay Lulla
Thanks for the explanation. On Sat, May 28, 2016 at 6:15 AM, Edzer Pebesma <edzer.pebe...@uni-muenster.de> wrote: > > > On 28/05/16 00:21, Vijay Lulla wrote: >> Edzer, >> I'm having trouble replicating what you state. Below is from my R session. > > I don'

Re: [R-sig-Geo] Overlay between polygons and their intersecting lines

2016-05-27 Thread Vijay Lulla
Edzer, I'm having trouble replicating what you state. Below is from my R session. ### Start R session interaction > over(Inter2[1], PolyD2, byid=T) Attribute 11black > # The green (1st) segment intersects with the black (1st) polygon => good > over(Inter2[2], PolyD2, byid=T) # Still not

Re: [R-sig-Geo] Take mean of list of raster stacks

2015-12-02 Thread Vijay Lulla
Nice use of do.call Loic (Sorry, don't know how to do the accents). I wasn't aware that you can send in a list to args! So, thanks for it. Now here's my quesiton. If I change the statement l <- list(s1,s2,s3,s4,fun=mean) to l <- list(s1=s1,s2=s2,s3=s3,s4=s4,fun=mean) # similar to Thiago's

Re: [R-sig-Geo] Take mean of list of raster stacks

2015-12-02 Thread Vijay Lulla
solves in a call to overlay > of the form > > overlay(s1 = s1, s2 = s2, s3 = s3, s4 = s4, fun = mean) > > which has missing x and y. Not naming the arguments passes s1 to x, s2 > to y and the others to ... allowing overlay to choose the right method. > >> >> Chee

Re: [R-sig-Geo] How to calculate decadal average and percent change in raster stacks?

2015-12-01 Thread Vijay Lulla
Maybe something like below? R> avg_rainfall <- do.call(stack,lapply(1:9,function(x) overlay(stack(s,bands=10*x+(0:9)),fun=mean))) R> ss <- subset(avg_rainfall,1:9) #?raster::subset R> st <- subset(avg_rainfall, 2:10) R> pct_change <- 100 * (st-ss)/ss HTH, Vijay. On Tue, Dec 1, 2015 at 3:14 AM,

Re: [R-sig-Geo] Convert rasters to data frame with time stamp

2015-10-16 Thread Vijay Lulla
>From the help page of `getValues`: "The values returned for a RasterStack or RasterBrick are always a matrix, with the rows representing cells, and the columns representing layers" so all you have to do is transpose the matrix from getValues, cbind the date column, do your analysis. To go

Re: [R-sig-Geo] plotKML 'kml' function with raster input

2015-10-13 Thread Vijay Lulla
If you want to use backslash in your string then you'll have to double them to remove the escape mechanism. So your path should read "C:\\Program Files\\GDAL\\gdalwarp.exe" etc. Please see ?Quote in R help. However, there is another (simpler IMO) solution. If you have the latest QGIS installed

Re: [R-sig-Geo] gIntersection returns error "TopologyException: no outgoing dirEdge found at"

2015-09-25 Thread Vijay Lulla
> 'POLYGON( >(0 0, 0 10, 10 10, 10 0, 0 0), >(0 0, 10 0, 10 -10, 0 -10, 0 0))'::geometry, > 'POLYGON( >(0.5 0.5, 0.5 10.5, 10.5 10.5, 10.5 0.5, 0.5 0.5), >(0.5 0.5, 10.5 0.5, 10.5 -10.5, 0.5 -10.5, 0.5 0.5))'::geometry > )); > >

Re: [R-sig-Geo] gIntersection returns error "TopologyException: no outgoing dirEdge found at"

2015-09-25 Thread Vijay Lulla
Seems to be working in PostGIS! Below is from my PostGIS session: gisdb=# SELECT ST_Intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'POLYGON((0 0, 10 0, 10 -10, 0 -10, 0 0))'::geometry); st_intersects --- t (1 row) gisdb=# SELECT ST_Intersection('POLYGON((0 0, 0

Re: [R-sig-Geo] Conditional operations and rasters

2015-09-15 Thread Vijay Lulla
I have no idea what you're trying to accomplish with your program logic but I think the below might work for you. R> lai <- raster(ncols=360,nros=180) R> lai[] <- 1:ncell(lai) R> idx <- lai < 1000 R> emiss_0 <- lai R> emiss_0[] <- 0.95 R> emiss_0[idx] <- 0.95 + (lai[idx]*0.01) R> emiss_nb <-

Re: [R-sig-Geo] plotting spatial data on a map

2015-06-05 Thread Vijay Lulla
There's a mistake in proj_geog line. Shouldn't it be proj_geog - +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 ? On Fri, Jun 5, 2015 at 3:00 PM, José Luis Rotundo rotundo.j...@gmail.com wrote: Dear List, I am trying to have some spatial data of an atrribute (protein.db) in a map from