Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Fix bugs #9

Merged
merged 26 commits into from
Oct 19, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
re-edit rasterly documentation
  • Loading branch information
z267xu committed Oct 19, 2019
commit 990954aa1bb403ecaeb1027639758e998c977421
2 changes: 2 additions & 0 deletions .Rproj.user/84277BCC/sources/prop/INDEX
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ C%3A%2Frsa.pub="2A39FFB6"
~%2FGitHub%2Frasterly%2FR%2Fplotly_rasterizer.R="95A84FE4"
~%2FGitHub%2Frasterly%2FR%2Fplotly_rasterly.R="18228E5F"
~%2FGitHub%2Frasterly%2FR%2Frasterize_points.R="2E260DA6"
~%2FGitHub%2Frasterly%2FR%2Frasterly-package.R="BFCA8213"
~%2FGitHub%2Frasterly%2FR%2Frasterly.R="A9996F87"
~%2FGitHub%2Frasterly%2FR%2Frasterly_build.R="7A3C86EA"
~%2FGitHub%2Frasterly%2FR%2Freexports.R="D1B1BBF4"
Expand All @@ -85,6 +86,7 @@ C%3A%2Frsa.pub="2A39FFB6"
~%2FGitHub%2Frasterly%2Fdoc%2Fintroduction.html="A1AC1F18"
~%2FGitHub%2Frasterly%2Fman%2Fadd_rasterly.Rd="BB1B2B04"
~%2FGitHub%2Frasterly%2Fman%2Frasterly-package.Rd="4C8DB46B"
~%2FGitHub%2Frasterly%2Fman%2Frasterly.Rd="2FDA8D7B"
~%2FGitHub%2Frasterly%2Ftests%2Ftestthat%2Ftest_rasterizer.R="59F3C36"
~%2FGitHub%2Frasterly%2Ftests%2Ftestthat.R="7976063B"
~%2FGitHub%2Frasterly%2Fvignettes%2Fintroduction.Rmd="2F40B97A"
Expand Down
41 changes: 40 additions & 1 deletion R/rasterly.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,50 @@
#' @title rasterly
#' @description Create a rasterly object, to which aggregation layers may be added. This function is the first step in the process
#' of generating raster image data using the `rasterly` package.
#' @param data Dataset to use for generating the plot. If not provided, data must be supplied in each layer of the plot.
#' For best performance, particularly when processing large datasets, use of \link[data.table]{data.table} is recommended.
#' @param mapping Default list of aesthetic mappings to use for plot. The same with `ggplot2` \link[ggplot2]{aes}.
#' See details.
#' @param ... Other arguments which will be passed through to layers.
#' @param plot_width Integer. The width of the image to plot; must be a positive integer. A higher value indicates a higher resolution.
#' @param plot_height Integer. The height of the image to plot; must be a positive integer. A higher value indicates a higher resolution.
#' @param x_range Vector of type numeric. The range of `x`; it can be used to clip the image. For larger datasets, providing `x_range`
#' may result in improved performance.
#' @param y_range Vector of type numeric. The range of `y`; it can be used to clip the image. For larger datasets, providing `y_range`
#' may result in improved performance.
#' @param background Character. The background color of the image to plot.
#' @param color_map Vector of type character. Color(s) used to draw each pixel. The `color_map` is extended by linear interpolation
#' independently for RGB. The darkness of the mapped color depends upon the values of the aggregation matrix.
#' @param color_key Vector of type character. The `color_key` is used for categorical variables; it is passed when the `color` aesthetic
#' is provided.
#' @param show_raster Logical. Should the raster be displayed?
#' @param drop_data Logical. When working with large datasets, drops the original data once processed according to the provided
#' `aes()` parameters, using the `remove()` function. See details for additional information.
#' @param variable_check Logical. If `TRUE`, drops unused columns to save memory; may result in reduced performance.
#'
#' @return An environment wrapped by a list
#'
#' @note Calling `rasterly()` without providing `rasterly_...()` layers has no effect.
#' More info can be found in \href{https://github.com/plotly/rasterly/blob/master/README.md}{README.md}
#'
#' @seealso \link{rasterize_points}, \link{rasterly_build}, \link{[.rasterly}, \link{[<-.rasterly}
#' @details
#' \itemize{
#' \item{}{The rasterly package currently supports five aesthetics via `aes()`: "x", "y", "on", "color", and "size".
#' The "on" aesthetic specifies the variable upon which the reduction function should be applied to generate the raster data.
#' }
#' \item{}{`drop_data` can help save space, particularly when large datasets are used. However, dropping the original dataset
#' may result in errors when attempting to set or update `aes()` parameters within rasterly layers.
#' }
#' }
#'
#' @useDynLib rasterly
#' @import Rcpp
#' @import rlang
#' @import methods
#' @importFrom grDevices rgb col2rgb hcl extendrange as.raster
#' @importFrom stats ecdf approx setNames na.omit
#' @importFrom data.table data.table
#' @importFrom compiler cmpfun
#' @export
rasterly <- function(data = NULL,
mapping = aes(),
Expand Down