Description Usage Arguments Value Examples
View source: R/earthquake_functions.R
This function generates a timeline visualization for the NOAA earthquake data. The data should be subsetted in order to create an understandable visualization. There are several ways to call the function so that different visualizations are generated. The function is a wrapper function and calls geom_timeline and if a label is specified, also calls the geom_timeline_label function.
1 2 |
eq_clean |
The clean earthquake data in a tbl_df object. |
y |
Optional parameter for COUNTRY; specifes a separate timeline for each country. |
size |
Optional parameter for earthquake magnitude (EQ_PRIMARY); specifies a point size based on magnitude. |
color |
Optional parameter for number of deaths (DEATHS); specifies a point color based on deaths. |
alpha |
Optional parameter for point transparency. |
timeline_label |
Optional parameter to select timeline labeling. |
n_max |
Optional parameter to specify number of earthquakes to be labeled. The earthquakes with n_max highest magnitudes will be labeled. |
This function returns a timeline visualization for a subset of the earthquake data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ## Not run:
filename<-system.file("extdata","data.gz",package="ykvdpcap")
readr::read_delim(filename, delim = "\t") %>%
eq_clean_data() %>%
dplyr::filter(COUNTRY == "USA" & lubridate::year(DATE) >= 2000) %>%
eq_time(size="EQ_PRIMARY",color="DEATHS")
readr::read_delim(filename, delim = "\t") %>%
eq_clean_data() %>%
dplyr::filter(COUNTRY == "USA" & lubridate::year(DATE) >= 2000) %>%
eq_time(size="EQ_PRIMARY",color="DEATHS",alpha=0.5,timeline_label=TRUE,n_max=8)
readr::read_delim(filename, delim = "\t") %>%
eq_clean_data() %>%
dplyr::filter((COUNTRY=="USA" | COUNTRY=="CHINA") & lubridate::year(DATE) >= 2000) %>%
eq_time(y="COUNTRY",color="DEATHS",alpha=0.5)
readr::read_delim(filename, delim = "\t") %>%
eq_clean_data() %>%
dplyr::filter((COUNTRY=="USA" | COUNTRY=="CHINA") & lubridate::year(DATE) >= 2000) %>%
eq_time(y="COUNTRY",color="DEATHS",alpha=0.5,timeline_label=TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.