diff --git a/DESCRIPTION b/DESCRIPTION index 2222cfe..b9082b9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -19,7 +19,6 @@ Roxygen: list(markdown = TRUE) RoxygenNote: 7.2.3 Language: en_GB Suggests: - covr, testthat (>= 3.0.0), knitr, rmarkdown, diff --git a/R/calculate_diversity.R b/R/calculate_diversity.R index 7f646fe..6fc6f60 100644 --- a/R/calculate_diversity.R +++ b/R/calculate_diversity.R @@ -48,10 +48,11 @@ calculate_diversity <- function(viewshed, p <- land_class$proportion sdi <- sd_index(p) if (proportion) { - return(list(SDI=sdi, - Proportion=t(subset(land_class, - select = c(.data$type, - proportion))))) + # sub_land_class <- subset(land_class, + # select = c(type, proportion)) + sub_land_class <- land_class %>% + dplyr::select(.data$type, proportion) + return(list(SDI=sdi,Proportion=t(sub_land_class))) } else { return(sdi) } diff --git a/vignettes/viewscape.Rmd b/vignettes/viewscape.Rmd index c56bdbc..0d5507a 100644 --- a/vignettes/viewscape.Rmd +++ b/vignettes/viewscape.Rmd @@ -144,44 +144,3 @@ test_canopy_proportion <- viewscape::calculate_feature(viewshed = output[[1]], exclude_value=0) test_canopy_proportion ``` - -## 3. Get LiDAR data - -### 3.1 Get LiDAR data information via API - -```{r eval = FALSE} -# search for lidar data information using bbox -search_result <- viewscape::lidar_search(bbox = c(-83.742282, - 42.273389, - -83.733442, - 42.278724), - preview = FALSE) -search_result -``` - -### 3.2 Download LiDAR data with a given point and searching distance - -```{r eval = FALSE, include = FALSE} -# try coordinates -83.741289,42.270146 (in south Michigan, USA) -# radius is 1000ft -las <- viewscape::get_lidar(x = -83.741289, - y = 42.270146, - r = 1000, - epsg = 2253, - folder = '/Users/yangxiaohao/Downloads/testfunction', - plot = FALSE) -``` - -```{r eval = FALSE, include = FALSE} -# Create DTM -dtm_ <- lidR::rasterize_terrain(las, res = 5, lidR::tin()) -terra::plot(dtm_) -``` - -```{r eval = FALSE, include = FALSE} -# Create DSM -dsm_ <- lidR::rasterize_canopy(las, res = 5, lidR::dsmtin()) -raster::plot(dsm_) -``` - -For more usages of lidR please refer: https://github.com/r-lidar/lidR/tree/master and https://rpubs.com/jesseast/lidR4smarties