Unprofessional Documents
Unprofessional documents are messy and leave the reader struggling to follow the story of the analysis.
Examples of components:
missing introduction for purpose of document, as well as section headers
loading packages throughout document
missing comments, documentation between analysis steps, and formal and detailed data citation
unnecessary outputs and intermediate checks retained in final version
messy code indentation for lists, parameters, functions within functions, etc.
very plain plot/map that is lacking important components such as legend, appropriate zoom level, name of study area, etc.
missing map explanation or general document conclusion
Elephant tracking in Krugar National Park
Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE
fp <- list.files (path = here ("course-materials" ), pattern = "elephants.csv" , recursive = TRUE , full.names = TRUE )
elephants <- read_csv (fp) %>%
sf:: st_as_sf (coords = c ("location-long" , "location-lat" ), crs = st_crs (4326 )) %>%
filter (st_is_valid (.))
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (5): sensor-type, individual-taxon-canonical-name, tag-local-identifier...
dbl (4): event-id, location-long, location-lat, external-temperature
lgl (1): visible
dttm (1): timestamp
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Simple feature collection with 283688 features and 9 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 31.06269 ymin: -25.37676 xmax: 32.00439 ymax: -23.97868
Geodetic CRS: WGS 84
# A tibble: 283,688 × 10
`event-id` visible timestamp `external-temperature` `sensor-type`
* <dbl> <lgl> <dttm> <dbl> <chr>
1 9421351127 TRUE 2007-08-13 00:30:00 24 gps
2 9421351128 TRUE 2007-08-13 02:00:00 23 gps
3 9421351129 TRUE 2007-08-13 03:31:00 21 gps
4 9421351130 TRUE 2007-08-13 04:00:00 21 gps
5 9421351131 TRUE 2007-08-13 06:00:00 22 gps
6 9421351132 TRUE 2007-08-13 07:30:00 30 gps
7 9421351133 TRUE 2007-08-13 08:00:00 33 gps
8 9421351134 TRUE 2007-08-13 11:30:00 36 gps
9 9421351135 TRUE 2007-08-13 12:00:00 36 gps
10 9421351136 TRUE 2007-08-13 15:30:00 33 gps
# ℹ 283,678 more rows
# ℹ 5 more variables: `individual-taxon-canonical-name` <chr>,
# `tag-local-identifier` <chr>, `individual-local-identifier` <chr>,
# `study-name` <chr>, geometry <POINT [°]>
metadata_df <- read_csv (list.files (path = here ("course-materials" ),
pattern = "elephants_metadata.csv" ,
recursive = TRUE ,
full.names = TRUE ))
Rows: 14 Columns: 23
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (16): tag-id, animal-id, animal-taxon, animal-comments, animal-life-sta...
dbl (4): deploy-off-latitude, deploy-off-longitude, deploy-on-latitude, de...
lgl (1): animal-sex
dttm (2): deploy-on-date, deploy-off-date
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
sort (unique (elephants$ "individual-local-identifier" )) == sort (unique (metadata_df$ "animal-id" ))
[1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
min (metadata_df$ "deploy-on-date" )
[1] "2007-08-12 22:30:00 UTC"
max (metadata_df$ "deploy-off-date" )
[1] "2009-08-12 21:30:00 UTC"
Breaking News: tmap 3.x is retiring. Please test v4, e.g. with
remotes::install_github('r-tmap/tmap')
library (rnaturalearth)
library (osmdata)
Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
south_africa <- rnaturalearth:: ne_countries (scale = "medium" ,
returnclass = "sf" ) %>%
filter (admin == "South Africa" )
tm_shape (south_africa) +
tm_borders (col = "black" , lwd = 0.5 ) +
tm_fill (col = "white" ) +
tm_shape (elephants) +
tm_dots (col = "individual-local-identifier" ,
palette = 'viridis' ,
size = 0.1 ,
border.col = "black" ,
title = "Individual" ) +
tm_layout (main.title = "Elephant Observations" ,
title.position = c ("center" , "top" ), title.size = 1.2 ,
legend.show = FALSE )
Data: https://datarepository.movebank.org