Problem with tidyr in R 3.2.4, works fine in 3.2.3
library(tidyr); library(dplyr); ##
## Attaching package: 'dplyr'
| obably have to think through some books I've read over the years, but right now it's dominated by R. I used to read a fair bit about object-oriented stuff, and now trying to learn C++ I realize how much I've learnt from R over the last 8-10 years. I love John Chamber's "Programming with Data", but I haven't read his newer one and that's probably a better read now. | |
| I would like to have a wiki-thing that we could dump these lists on and then re-edit prioritize etc. I have some notes I send people for R below. | |
| My current reading list is | |
| "The C++ Programming Language", by Bjarne Stroustrup (go for Ed. 4 which is up to date for C++11). | |
| http://alignedleft.com/work/d3-book |
| A recreation of http://gis.stackexchange.com/questions/152094/heatmap-on-globe-distortion-problems | |
| ```{r} | |
| library(raster) | |
| library(geosphere) | |
| library(MASS) | |
| r <- raster(extent(-180, 180, -90, 90), nrow = 256, ncol = 256) | |
| library(webp) | |
| library(png) | |
| library(curl) | |
| u <- "http://oceancolor.gsfc.nasa.gov/cgi/l3/V20160202016022.L3m_R3QL_NPP_CHL_chlor_a_9km.nc.png?sub=img" | |
| f <- gsub("\\?sub=img", "", basename(u)) | |
| curl_download(u, f) | |
| bm <- readPNG(f) | |
| newfile <- gsub("png", "webp", f) | |
| write_webp(bm, newfile) |
| ## My answer to https://stat.ethz.ch/pipermail/r-sig-geo/2016-January/023953.html | |
| library(raster) | |
| ## for example | |
| #r <- getData('SRTM', lon=147, lat=-42) | |
| # or | |
| r <- raster("C:/temp/srtm_66_21.tif") |
| ## wtf | |
| #' Combine a list of PolygonDataFrame objects into a single object. | |
| #' | |
| #' Objects are combined by modifying sequential IDs to increase. | |
| c_poly <- function(x) { | |
| poly <- x[[1]] | |
| if (length(x) == 1L) { | |
| warning("input of length one, returning first element") | |
| return(poly) | |
| } |
| ## NOTE: as is this code downloads 3 files, 22Mb in total | |
| ## files to compare | |
| files <- c("A2015283.L3m_DAY_CHL_chlor_a_4km.nc", "A2015284.L3m_DAY_CHL_chlor_a_4km.nc", "A2015285.L3m_DAY_CHL_chlor_a_4km.nc") | |
| baseu <- "http://oceandata.sci.gsfc.nasa.gov/cgi/getfile" | |
| ## download the files | |
| for (i in seq_along(files)) { | |
| if (!file.exists(files[i])) { |
| # centroids | |
| # still need Inner Centroid | |
| v <- cbind(c(0.3, 0.6, 0.4), c(0.2, 0, 0.8)) | |
| tri <- c(1, 2, 3) | |
| # centroid (weight) | |
| cw <- matrix(apply(v[tri, ], 2, mean), ncol = 2) | |
| library(tripack) |
| #' Mutate for Spatial | |
| #' | |
| #' mutate . . . | |
| #' | |
| #' @export | |
| #' @examples | |
| #' library(sp) | |
| #' library(maptools) | |
| #' data(wrld_simpl) | |
| #' library(dplyr) |
| #' Mutate for Spatial | |
| #' | |
| #' @param .data | |
| #' @param ... | |
| #' @param .dots | |
| #' | |
| #' @rdname spdplyr | |
| #' @export | |
| #' @examples | |
| #' library(sp) |
Problem with tidyr in R 3.2.4, works fine in 3.2.3
library(tidyr); library(dplyr); ##
## Attaching package: 'dplyr'