Skip to content

Commit

Permalink
CRAN Submission
Browse files Browse the repository at this point in the history
  • Loading branch information
rCarto committed Jan 19, 2021
1 parent 9cdd2bc commit 7b846f1
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: linemap
Type: Package
Title: Line Maps
Version: 0.1.1
Version: 0.2.0
Authors@R: person("Timothée", "Giraud", email = "[email protected]",
role = c("cre","aut"), comment = c(ORCID = "0000-0002-1932-3323"))
Description: Create maps made of lines. The package contains two functions:
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# linemap 0.2.0

## Minor changes
- Remove some RData in favor of geopackage (This can lead to breaking changes using examples)
- fix NOTES by importing geopackage instead of RData
- Add test, code coverage and GH action
- Fix links

7 changes: 5 additions & 2 deletions R/getgrid.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#' @description Transform a polygon layer to a regular grid data.frame.
#' @param x an sf polygon layer.
#' @param cellsize size of the side of a grid cell.
#' @param var name of the variable to transform to the grid. It can be a vector of names.
#' @param var name of the variable to transform to the grid. It can be a vector
#' of names.
#' @return A data frame is returned.
#' @export
#' @examples
Expand Down Expand Up @@ -66,7 +67,9 @@ getgrid <- function(x, cellsize, var){
lvar <- vector(mode = "list", length = length(var))
names(lvar) <- var
for (i in 1:length(lvar)){
lvar[[i]] <- as.vector(parts[[names(lvar)[i]]] * parts$area_part / parts$area)
lvar[[i]] <- as.vector(
parts[[names(lvar)[i]]] * parts$area_part / parts$area
)
}
v <- stats::aggregate(do.call(cbind,lvar), by = list(id = parts[['id_cell']]),
FUN = sum, na.rm=TRUE)
Expand Down
12 changes: 8 additions & 4 deletions R/package.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
#' @rdname linemap-package
#' @name linemap-package
#' @description
#' Create maps made of lines. The package contains two functions: \code{\link{linemap}} and \code{\link{getgrid}}.
#' Create maps made of lines. The package contains two functions:
#' \code{\link{linemap}} and \code{\link{getgrid}}.
#'
#' \code{\link{linemap}} displays a map made of lines using a data frame of gridded data.
#' \code{\link{linemap}} displays a map made of lines using a data frame of
#' gridded data.
#'
#' \code{\link{getgrid}} transforms a set of polygons (\code{\link{sf}} objects) into a suitable data frame
#' \code{\link{getgrid}} transforms a set of polygons (\code{\link{sf}} objects)
#' into a suitable data frame
#' for \code{\link{linemap}}.
#' @note
#' These three mains sources gave me the inspiration to create \code{linemap}:\cr
#' These three mains sources gave me the inspiration to create
#' \code{linemap}:\cr
#' - Joy Division's 'Unknown Pleasures' Cover (\url{https://en.wikipedia.org/wiki/Unknown_Pleasures}) \cr
#' - the work of James Cheshire (Population Lines: How and Why I Created It - \url{https://jcheshire.com/featured-maps/population-lines-how-and-why-i-created-it/})\cr
#' - the work of Ryan Brideau (GeospatialLineGraphs - \url{https://github.com/Brideau/GeospatialLineGraphs})\cr
Expand Down
3 changes: 2 additions & 1 deletion inst/tinytest/test_linemap.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ data("popOcc")
popToulouse <- popOcc[findInterval(popOcc$X, c(3600234,3659444)) == 1 &
findInterval(popOcc$Y, c(2290913,2348192)) == 1, ]
expect_silent(linemap(x = popToulouse, var = "pop", k = 2.5, threshold = 50,
col = "ivory1", border = "ivory4", lwd = 0.6, add = FALSE))
col = "ivory1", border = "ivory4", lwd = 0.6,
add = FALSE))
expect_silent(linemap(x = popToulouse, var = "pop", add = TRUE))


Expand Down
3 changes: 2 additions & 1 deletion man/getgrid.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions man/linemap-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7b846f1

Please sign in to comment.