srkobakian / sugarbag Goto Github PK
View Code? Open in Web Editor NEWAn R package to create tessellated hexagon maps of Australia.
Home Page: https://srkobakian.github.io/sugarbag/
License: Other
An R package to create tessellated hexagon maps of Australia.
Home Page: https://srkobakian.github.io/sugarbag/
License: Other
My centroids data had an x
variable. This caused an issue downstream where lat_window
was calculated as it was using the x
in the centroids data instead of x in the environment (e.g. below with .env$x[1]
).
lat_window <- function(x, cents = centroids, maximum = nlat) {
max_int <- min(x[2], maximum)
cents_in <- filter(cents, between(lat_int, .env$x[1], max_int))
return(cents_in)
}
Prepare for release:
usethis::use_cran_comments()
devtools::check()
devtools::check_win_devel()
rhub::check_for_cran()
Submit to CRAN:
usethis::use_version('minor')
cran-comments.md
devtools::submit_cran()
Wait for CRAN...
usethis::use_github_release()
usethis::use_dev_version()
usethis::use_news()
Can you take a look at these problems we see in revdep check for tidyr? The release of v1.0.0 is on the horizon. Looks like something related to name repair.
https://github.com/tidyverse/tidyr/blob/master/revdep/problems.md#sugarbag
The allocate()
function assigns each geographical area to a hexagon on a pre-created grid.
allocate()
has an argument focal_points
. Users can supply a data frame of coordinates of map focal points, which are used to choose hex locations for each area that maximally preserve the relationship of the area to the focal point(s). A data frame capital_cities
is provided containing lon/lat coordinates of Australian capital cities. This dataframe is used in the README example.
However, allocate()
should work when focal_points = NULL
, the default for the function. Line 85 in allocate.R
contains code that should (I think) create a single focal point as the mean of all area centroids in the data where focal_points = NULL
. But instead allocate()
returns an error before getting to this point.
allocate()
should work without focal point(s) being specified.
We need to be able to translate the polygon data from sf to tibble and back again. I recommend making a function to do this.
A lot of spatial data is now provided in UTM. Could you include sample code to show how to translate from UTM to lat/long for the hexmap creation?
If the wrong coordinate system is provided for the focal points an error message about out of memory
There seems to be two LNP in the readme:
auscolours <- c(
"ALP" = "#DE3533",
"LNP" = "#080CAB",
"KAP" = "#b50204",
"GRN" = "#10C25B",
"XEN" = "#ff6300",
"LNP" = "#0047AB",
"IND" = "#307560")
while(NROW(f_grid) == 0) {
f_grid <- filter_grid_points(f_grid = hex_grid, f_centroid = centroid, f_dist = filter_dist)
if (NROW(f_grid) == 0) {
filter_dist <- filter_dist*1.5
print(paste("Filter Distance expanded 50% to ", filter_dist))
}
}
The endless loop occurs because there are no more available points in the direction, with the current buffer. You should be able to work out a maximum expansion size possible, based on the largest inter-grid point distance. When you reach this, break out of the while loop, print a warning to the user, and allocate to a randomly available grid point.
Expanding the buffer fixes the endless loop, temporarily.
"while"'s always need an escape route
Intended flow:
While no possible hexagon is available -> expand area considered to 1.5x original distance -> return points now available in the range
Current flow:
While no possible hexagon is available -> expand area considered to 1.5x original distance -> continues to expand, cannot break from while loop?
E.g. for create_grids
, it wasn't obvious to me that the centroids argument required a data frame with variables explicitly named longitude
and latitude
. A flexibility to refer to any columns for lat and lon is desirable IMO. That way I don't need an intermediate step to create a data frame with latitude and longitude.
(happy to do pull request on this if you like)
For the data sets provided, add some code to show the data, and what would be done with the data. It might need to be wrapped in a don't run to satisfy CRAN
E.g. the use of as.tibble
gives warning messages that it is deprecated.
> devtools::install_github("srkobakian/sugaRbag")
Downloading GitHub repo srkobakian/sugaRbag@master
✔ checking for file ‘/tmp/RtmpsZ4m0W/remotes461426473b70/srkobakian-sugaRbag-892d988/DESCRIPTION’ ...
─ preparing ‘sugaRbag’:
✔ checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ looking to see if a ‘data/datalist’ file should be added
─ building ‘sugaRbag_0.0.0.9000.tar.gz’ (1.3s)
Installing package into ‘/home/hyndman/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
* installing *source* package ‘sugaRbag’ ...
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘sugaRbag’ in namespaceExport(ns, exports):
undefined exports: sfc_to_tibble
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/hyndman/R/x86_64-pc-linux-gnu-library/3.5/sugaRbag’
Error in i.p(...) :
(converted from warning) installation of package ‘/tmp/RtmpsZ4m0W/file46141c79307c/sugaRbag_0.0.0.9000.tar.gz’ had non-zero exit status
Potential issues: may also require projection to be provided
when on downtime, needing something basic to do, write vignette
Develop a goodie bag of examples using the cancer data, to show off all sorts of aspects of the package
We want to be able to facet small chunks of the map, but the position in the facet should roughly match the geographic location. Like the geofacet package, but it only has US state layout currently. We would need to do a rough layout.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.