From 222dcec994ad3bad60b5d081f58643cd98d01a7e Mon Sep 17 00:00:00 2001 From: Luigi Ranghetti Date: Tue, 12 Nov 2019 15:07:03 +0100 Subject: [PATCH] Fix documentation example --- R/safelist-class.R | 2 +- docs/reference/safelist-class.html | 20 +++++++++++++++++++- man/safelist-class.Rd | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/R/safelist-class.R b/R/safelist-class.R index 1435e493..8d7a2d23 100644 --- a/R/safelist-class.R +++ b/R/safelist-class.R @@ -36,7 +36,7 @@ #' ## Convert to other classes #' (s2_char <- as.character(list_safe)) # convert to a simple named character #' (s2_df <- as.data.frame(list_safe)) # convert to a data.frame -#' (s2_dt <- as.data.table(list_safe)) # convert to a data.table +#' library(data.table); (s2_dt <- as.data.table(list_safe)) # convert to a data.table #' #' ## Convert from other classes #' as(s2_char, "safelist") # this causes the loss of hidden attributes diff --git a/docs/reference/safelist-class.html b/docs/reference/safelist-class.html index 55a63a70..e4fdd232 100644 --- a/docs/reference/safelist-class.html +++ b/docs/reference/safelist-class.html @@ -228,7 +228,25 @@

Examp #> clouds online #> 1 99.999908 NA #> 2 8.670091 NA -#> 3 6.359588 NA
(s2_dt <- as.data.table(list_safe)) # convert to a data.table
#> Error in as.data.table(list_safe): non trovo la funzione "as.data.table"
+#> 3 6.359588 NA
library(data.table); (s2_dt <- as.data.table(list_safe)) # convert to a data.table
#> +#> Attaching package: ‘data.table’
#> The following object is masked from ‘package:raster’: +#> +#> shift
#> name +#> 1: S2A_MSIL2A_20170507T102031_N0205_R065_T32TNR_20170507T102319.SAFE +#> 2: S2A_MSIL2A_20170517T102031_N0205_R065_T32TNR_20170517T102352.SAFE +#> 3: S2A_MSIL2A_20170527T102031_N0205_R065_T32TNR_20170527T102301.SAFE +#> url +#> 1: https://scihub.copernicus.eu/apihub/odata/v1/Products('a4a026c0-db7b-4ba8-9b09-53027ab0d7ab')/$value +#> 2: https://scihub.copernicus.eu/apihub/odata/v1/Products('6b7bb7bb-7598-45ac-9f2c-a3bd9cdc092f')/$value +#> 3: https://scihub.copernicus.eu/apihub/odata/v1/Products('868b5b3c-92ac-412a-8a04-167008a1f08f')/$value +#> mission level id_tile id_orbit sensing_datetime ingestion_datetime +#> 1: 2A 2Ap 32TNR 065 2017-05-07 10:20:31 2017-05-09 06:30:41 +#> 2: 2A 2Ap 32TNR 065 2017-05-17 10:20:31 2017-06-08 12:21:23 +#> 3: 2A 2Ap 32TNR 065 2017-05-27 10:20:31 2017-05-29 08:30:44 +#> clouds online +#> 1: 99.999908 NA +#> 2: 8.670091 NA +#> 3: 6.359588 NA
## Convert from other classes as(s2_char, "safelist") # this causes the loss of hidden attributes
#> A named vector with 3 SAFE archives. #> S2A_MSIL2A_20170507T102031_N0205_R065_T32TNR_20170507T102319.SAFE diff --git a/man/safelist-class.Rd b/man/safelist-class.Rd index 6669ecf7..a25f4683 100644 --- a/man/safelist-class.Rd +++ b/man/safelist-class.Rd @@ -42,7 +42,7 @@ attr(list_safe, "sensing_datetime") # extract an hidden attribute from a safelis ## Convert to other classes (s2_char <- as.character(list_safe)) # convert to a simple named character (s2_df <- as.data.frame(list_safe)) # convert to a data.frame -(s2_dt <- as.data.table(list_safe)) # convert to a data.table +library(data.table); (s2_dt <- as.data.table(list_safe)) # convert to a data.table ## Convert from other classes as(s2_char, "safelist") # this causes the loss of hidden attributes