do_projection: Project points onto globe

Description Usage Arguments Details Value Examples

View source: R/functions.R

Description

Project points in data onto the globe and filter data to points within the current field of view.

Usage

1
2
do_projection(data, id, lon = 0, lat = 0, n.period = 360,
  n.frames = n.period, keep = FALSE)

Arguments

data

a data frame.

id

character, column name referring to column of data representing frame sequence integer IDs.

lon

starting longitude for rotation sequence or vector of arbitrary longitude sequence.

lat

fixed latitude or vector of arbitrary latitude sequence.

n.period

intended length of the period.

n.frames

intended number of frames in animation.

keep,

if TRUE, return the entire input data drame (no subsetting) along with the boolean inview column. Otherwise only return the row-filtered data frame with its original columns. Defaults to FALSE.

Details

do_projection projects the coordinates in data onto the globe and filters data to the subset of rows containing data which are visible given the current field of view. The field of view is defined by the centroid focus latitude and longitude pair in the sequence of latitudes and longitudes whose index corresponds to the frame ID in data. data may containing rows with multiple unique frame ID values, which the function will group the data by. These values are used to determine position in the user-defined lon/lat sequence and the corresponding in-view subset of data for each subset of data grouped by the 'id' variable.

Value

returns a data frame containing visible points on the globe or all points along with a boolean inview column.

Examples

1
2
3
4
5
6
library(dplyr)
library(purrr)
data(annualtemps)
temps <- mutate(annualtemps, frameID = Year - min(Year) + 1)
do_projection(temps, id="frameID")
do_projection(temps, id="frameID", keep=TRUE)

leonawicz/mapmate documentation built on May 21, 2019, 5:09 a.m.