ropensci / ReLTER

An Interface for the 'eLTER' Community
http://docs.ropensci.org/ReLTER
GNU General Public License v3.0
12 stars 6 forks source link

pkgdown build error #62

Open maelle opened 2 years ago

maelle commented 2 years ago
Reading 'vignettes/site_information.Rmd'
-- RMarkdown error -------------------------------------------------------------
--------------------------------------------------------------------------------
Error in render_rmarkdown(pkg, input = input, output = output_file, output_format = format,  : 
  Failed to render RMarkdown
Caused by error:
! error in callr subprocess
Caused by error:
! attempt to set 'colnames' on an object with less than two dimensions
maelle commented 2 years ago

Happy to help if needed!

maelle commented 2 years ago

@oggioniale

oggioniale commented 1 year ago

Dear Maëlle, apologise for my late replay! We working on re-structuring old functions and with a lot new functions.

In the next days we release the new version, also with the resolution of the error.

Thanks!!

maelle commented 1 year ago

Thank you!

maelle commented 1 year ago

Error I see in the vignette

siteGeneral <- ReLTER::get_site_info(
  deimsid = "https://deims.org/f30007c4-8a6e-4f11-ab87-569db54638fe",
  category = "General"
)
#> Warning: Unknown or uninitialised column: `generalInfo.keywords`.
#> Error in `colnames<-`(`*tmp*`, value = c("keywordsLabel", "keywordsURI")): attempt to set 'colnames' on an object with less than two dimensions

Created on 2022-10-11 with reprex v2.0.2

oggioniale commented 1 year ago

I have updated to the last version all packages and I can't reproduce the error.

> ReLTER::get_site_info(
+     deimsid = "https://deims.org/f30007c4-8a6e-4f11-ab87-569db54638fe",
+     category = "General"
+ )
# A tibble: 1 × 21
  title     uri   geoCo…¹ country geoEl…² geoEl…³ geoEl…⁴ geoEl…⁵ gener…⁶ gener…⁷ gener…⁸ gener…⁹ gener…˟ gener…˟ gener…˟ gener…˟ gener…˟ gener…˟ gener…˟ gener…˟ gener…˟
  <chr>     <chr> <chr>   <list>    <dbl>   <int>   <int> <chr>   <chr>   <chr>   <chr>     <int> <lgl>   <list>  <lgl>   <chr>   <chr>   <chr>   <lgl>   <lgl>   <list> 
1 Lago Mag… http… POINT … <chr>      194.     186    4633 msl     "Lake … Operat… https:…    1960 NA      <df>    NA      Lago M… IT08-0… Statio… NA      NA      <df>   
# … with abbreviated variable names ¹​geoCoord, ²​geoElev.avg, ³​geoElev.min, ⁴​geoElev.max, ⁵​geoElev.unit, ⁶​generalInfo.abstract, ⁷​generalInfo.status.label,
#   ⁸​generalInfo.status.uri, ⁹​generalInfo.yearEstablished, ˟​generalInfo.yearClosed, ˟​generalInfo.hierarchy.parent, ˟​generalInfo.hierarchy.children,
#   ˟​generalInfo.siteName, ˟​generalInfo.shortName, ˟​generalInfo.siteType, ˟​generalInfo.protectionLevel, ˟​generalInfo.landUse, ˟​generalInfo.images
maelle commented 1 year ago

I still get the error, I added session info in case it is relevant. Does this function need authentication?

siteGeneral <- ReLTER::get_site_info(
  deimsid = "https://deims.org/f30007c4-8a6e-4f11-ab87-569db54638fe",
  category = "General"
)
#> Warning: Unknown or uninitialised column: `generalInfo.keywords`.
#> Error in `colnames<-`(`*tmp*`, value = c("keywordsLabel", "keywordsURI")): attempt to set 'colnames' on an object with less than two dimensions

Created on 2022-10-20 with reprex v2.0.2

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.2.0 (2022-04-22) #> os Ubuntu 20.04.4 LTS #> system x86_64, linux-gnu #> ui X11 #> language en_US.utf8 #> collate en_US.utf8 #> ctype en_US.utf8 #> tz Europe/Paris #> date 2022-10-20 #> pandoc 2.18 @ /usr/lib/rstudio/bin/quarto/bin/tools/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> abind 1.4-5 2016-07-21 [1] RSPM #> ape 5.6-2 2022-03-02 [1] RSPM #> assertthat 0.2.1 2019-03-21 [1] RSPM (R 4.2.0) #> base64enc 0.1-3 2015-07-28 [1] RSPM (R 4.2.0) #> bold 1.2.0 2021-05-11 [1] RSPM #> class 7.3-20 2022-01-16 [2] CRAN (R 4.2.0) #> classInt 0.4-8 2022-09-29 [1] RSPM #> cli 3.4.1 2022-09-23 [1] RSPM #> codetools 0.2-18 2020-11-04 [2] CRAN (R 4.2.0) #> colorspace 2.0-3 2022-02-21 [1] RSPM (R 4.2.0) #> conditionz 0.1.0 2019-04-24 [1] RSPM #> crayon 1.5.2 2022-09-29 [1] RSPM #> crosstalk 1.2.0 2021-11-04 [1] RSPM #> crul 1.3 2022-09-03 [1] CRAN (R 4.2.0) #> curl 4.3.3 2022-10-06 [1] RSPM #> data.table 1.14.4 2022-10-17 [1] CRAN (R 4.2.0) #> DBI 1.1.3.9000 2022-06-20 [1] Github (r-dbi/DBI@5f632ae) #> dichromat 2.0-0.1 2022-05-02 [1] RSPM #> digest 0.6.30 2022-10-18 [1] RSPM #> dplyr 1.0.10 2022-09-01 [1] CRAN (R 4.2.0) #> dtplyr 1.2.2 2022-08-20 [1] RSPM #> e1071 1.7-11 2022-06-07 [1] RSPM #> evaluate 0.17 2022-10-07 [1] CRAN (R 4.2.0) #> extrafont 0.18 2022-04-12 [1] RSPM (R 4.2.0) #> extrafontdb 1.0 2012-06-11 [1] RSPM (R 4.2.0) #> fansi 1.0.3 2022-03-24 [1] RSPM (R 4.2.0) #> farver 2.1.1 2022-07-06 [1] CRAN (R 4.2.0) #> fastmap 1.1.0 2021-01-25 [1] RSPM (R 4.2.0) #> foreach 1.5.2 2022-02-02 [1] RSPM #> fs 1.5.2 2021-12-08 [1] RSPM (R 4.2.0) #> generics 0.1.3 2022-07-05 [1] RSPM #> ggforce 0.4.1 2022-10-04 [1] RSPM #> ggplot2 3.3.6 2022-05-03 [1] RSPM #> glue 1.6.2 2022-02-24 [1] RSPM (R 4.2.0) #> gridExtra 2.3 2017-09-09 [1] RSPM #> gtable 0.3.1 2022-09-01 [1] CRAN (R 4.2.0) #> highr 0.9 2021-04-16 [1] RSPM (R 4.2.0) #> htmltools 0.5.3.9000 2022-09-29 [1] Github (rstudio/htmltools@5fa01e7) #> htmlwidgets 1.5.4 2021-09-08 [1] RSPM (R 4.2.0) #> httpcode 0.3.0 2020-04-10 [1] RSPM (R 4.2.0) #> httr 1.4.4 2022-08-17 [1] RSPM #> iterators 1.0.14 2022-02-05 [1] RSPM #> jqr 1.2.3 2022-03-10 [1] RSPM #> jsonlite 1.8.2 2022-10-02 [1] CRAN (R 4.2.0) #> KernSmooth 2.23-20 2021-05-03 [2] CRAN (R 4.2.0) #> knitr 1.40 2022-08-24 [1] RSPM #> lattice 0.20-45 2021-09-22 [2] CRAN (R 4.2.0) #> lazyeval 0.2.2 2019-03-15 [1] RSPM (R 4.2.0) #> leafem 0.2.0 2022-04-16 [1] RSPM #> leaflet 2.1.1 2022-03-23 [1] RSPM #> leafsync 0.1.0 2019-03-05 [1] RSPM #> lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.2.0) #> lwgeom 0.2-9 2022-10-01 [1] CRAN (R 4.2.0) #> magrittr 2.0.3 2022-03-30 [1] RSPM (R 4.2.0) #> MASS 7.3-58.1 2022-08-03 [1] RSPM #> munsell 0.5.0 2018-06-12 [1] RSPM (R 4.2.0) #> nlme 3.1-160 2022-10-10 [1] CRAN (R 4.2.0) #> pillar 1.8.1 2022-08-19 [1] RSPM #> pkgconfig 2.0.3 2019-09-22 [1] RSPM (R 4.2.0) #> plyr 1.8.7 2022-03-24 [1] RSPM #> png 0.1-7 2013-12-03 [1] RSPM #> polyclip 1.10-0 2019-03-14 [1] RSPM #> proxy 0.4-27 2022-06-09 [1] RSPM #> purrr 0.3.5 2022-10-06 [1] CRAN (R 4.2.0) #> qrcode 0.1.4 2021-10-13 [1] RSPM #> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.2.0) #> R.methodsS3 1.8.2 2022-06-13 [1] RSPM #> R.oo 1.25.0 2022-06-12 [1] RSPM #> R.utils 2.12.0 2022-06-28 [1] RSPM #> R6 2.5.1 2021-08-19 [1] RSPM (R 4.2.0) #> raster 3.6-3 2022-09-18 [1] RSPM #> RColorBrewer 1.1-3 2022-04-03 [1] RSPM (R 4.2.0) #> Rcpp 1.0.9 2022-07-08 [1] RSPM (R 4.2.0) #> ReLTER 1.1.0 2022-10-20 [1] local #> reprex 2.0.2 2022-08-17 [1] RSPM #> reshape 0.8.9 2022-04-12 [1] RSPM #> rgeos 0.5-9 2021-12-15 [1] RSPM #> rlang 1.0.6 2022-09-24 [1] RSPM (R 4.2.0) #> rmarkdown 2.17 2022-10-07 [1] CRAN (R 4.2.0) #> rosm 0.2.6 2022-06-09 [1] RSPM #> rstudioapi 0.14 2022-08-22 [1] RSPM #> Rttf2pt1 1.3.11 2022-10-08 [1] CRAN (R 4.2.0) #> scales 1.2.1 2022-08-20 [1] RSPM #> sessioninfo 1.2.2 2021-12-06 [1] RSPM (R 4.2.0) #> sf 1.0-8 2022-07-14 [1] RSPM #> sp 1.5-0 2022-06-05 [1] RSPM #> stars 0.5-6 2022-07-21 [1] CRAN (R 4.2.0) #> stringi 1.7.8 2022-07-11 [1] RSPM (R 4.2.0) #> stringr 1.4.1 2022-08-20 [1] RSPM #> styler 1.7.0.9001 2022-05-31 [1] https://r-lib.r-universe.dev (R 4.2.0) #> taxize 0.9.100 2022-04-22 [1] RSPM #> terra 1.6-17 2022-09-10 [1] RSPM (R 4.2.0) #> tibble 3.1.8 2022-07-22 [1] CRAN (R 4.2.0) #> tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.2.0) #> tmap 3.3-3 2022-03-02 [1] RSPM #> tmaptools 3.1-1 2021-01-19 [1] RSPM #> tweenr 2.0.2 2022-09-06 [1] RSPM #> units 0.8-0 2022-02-05 [1] CRAN (R 4.2.0) #> utf8 1.2.2 2021-07-24 [1] RSPM (R 4.2.0) #> uuid 1.1-0 2022-04-19 [1] RSPM (R 4.2.0) #> vctrs 0.4.2 2022-09-29 [1] RSPM #> viridisLite 0.4.1 2022-08-22 [1] RSPM #> waffle 0.7.0 2017-01-07 [1] RSPM #> withr 2.5.0 2022-03-03 [1] RSPM (R 4.2.0) #> worrms 0.4.2 2020-07-08 [1] RSPM #> xfun 0.34 2022-10-18 [1] RSPM #> XML 3.99-0.11 2022-10-03 [1] RSPM #> xml2 1.3.3 2021-11-30 [1] RSPM (R 4.2.0) #> xslt 1.4.3 2021-05-05 [1] RSPM (R 4.2.0) #> yaml 2.3.6 2022-10-18 [1] RSPM #> zoo 1.8-11 2022-09-17 [1] RSPM #> #> [1] /home/maelle/R/x86_64-pc-linux-gnu-library/4.2 #> [2] /opt/R/4.2.0/lib/R/library #> #> ────────────────────────────────────────────────────────────────────────────── ```
maelle commented 1 year ago

You could pre-build the vignette https://ropensci.org/blog/2019/12/08/precompute-vignettes/ (and set a reminder for yourself in a release_bullets() function cf https://usethis.r-lib.org/reference/use_release_issue.html#ref-usage, example https://github.com/lucarraro/traudem/blob/2038f221d3197674b62dbb20da22fdb16991e15c/R/utils.R#L15)

But we should still find out why I can't run the code I suppose :sweat_smile:

oggioniale commented 1 year ago

thanks! Please let me know what is the content of the get_site_general() function? Because the past version of this function contains the "keywordsLabel", "keywordsURI" as some column names of the output. Currently is:

get_site_general <- function(deimsid) {
  qo <- queries_jq[[get_deims_API_version()]]$site_general
  jj <- get_id(deimsid, qo$path)
  if (is.na(attr(jj, "status"))) {
    invisible(
      utils::capture.output(
        general <- dplyr::as_tibble(do_Q(qo$query, jj))
      )
    )
  } else {
    message("\n----\nThe requested page could not be found.
Please check again the DEIMS ID\n----\n")
    general <- NULL
  }
  general
}

And please can execute also ReLTER::get_deims_API_version() and ReLTER::get_deims_base_url(). The output should be:

> ReLTER::get_deims_API_version()
[1] "1.1"
> ReLTER::get_deims_base_url()
[1] "https://deims.org/"
> 
maelle commented 1 year ago

Did you forget to push updates? These functions aren't exported (I'm using a clone of this repository)

oggioniale commented 1 year ago

I push all currently in the dev branch. May be is this the problem? Do you have clone main branch?

maelle commented 1 year ago

yes I was using the main branch, and that is what the pkgdown building infrastructure uses.

oggioniale commented 1 year ago

Ahhh ok the error is about the function because I don't already done the PR from dev to main.

I think to solve all the issue (e.g. ERROR: dependency ‘SPARQL’ is not available for package ReLTER) in the dev branch and after merge this in the main.

Isn't that right?

maelle commented 1 year ago

Now I also get the error about SPARQL. It has been archived on CRAN https://cran.r-project.org/web/packages/SPARQL/

However see https://discuss.ropensci.org/t/optional-suggests-dependency-that-has-been-archived-on-cran/3071

maelle commented 1 year ago

I think to solve all the issue (e.g. ERROR: dependency ‘SPARQL’ is not available for package ReLTER) in the dev branch and after merge this in the main.

yes it makes sense!

maelle commented 1 year ago

Regarding SPARQL you could also stop using it by making the API calls with httr2 or httr, example in https://github.com/lvaudor/glitter/blob/3fe7c9f90258a4ac9892f832a05da9e5b1d6e8e1/R/send_sparql.R#L34 (please tell me if you'd prefer me to make a PR, or have any question!)

oggioniale commented 1 year ago

do you have some suggestion about this error?

maelle commented 1 year ago

We're both too fast answering :joy:

So I think the best would be to remove the dependency on SPARQL by using httr2 or httr see https://github.com/ropensci/ReLTER/issues/62#issuecomment-1285715579

maelle commented 1 year ago

In that package I'm giving as an example we had removed the SPARQL dependency, reasoning in https://github.com/lvaudor/glitter/issues/19

maelle commented 1 year ago

(httr might be a better choice since ReLTER already imports it, unless you switch everything to httr2 :zany_face: )

oggioniale commented 1 year ago

Yes httr is already imported.

But before to remove SPARQL and use httr, can you tell me how to use httr in this case (get_sensor_observed_properties() function):

library(SPARQL)

ireaEndpoint <- "http://fuseki1.get-it.it/directory/query"
ireaQuery <- paste0(
  "PREFIX owl: <http://www.w3.org/2002/07/owl#>
       PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
       PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       PREFIX qudt: <http://qudt.org/schema/qudt/>
       SELECT ?c ?l ?code ?s
        WHERE {
          SERVICE <http://vocab.nerc.ac.uk/sparql/sparql> {
            ?c rdf:type skos:Concept .
            <http://vocab.nerc.ac.uk/collection/P06/current/> skos:member ?c .
            OPTIONAL {
              ?c skos:altLabel ?l .
              ?c owl:sameAs ?s .
            }
            FILTER(?l = 'degC')
            FILTER(REGEX(STR(?s), 'qudt'))
          }
          SERVICE <https://www.qudt.org/fuseki/qudt/query> {
            ?s qudt:udunitsCode ?code
          }
        }
      ORDER BY ASC(?l)
      LIMIT 1"
)
qudtUOM <- SPARQL::SPARQL(
  url = ireaEndpoint,
  query = ireaQuery,
  curl_args = list(.encoding = "UTF-8")
)
qudtUOM

I want understand because I am a fan of sparql queries. 🤪

maelle commented 1 year ago

Here's a reprex with both httr2 and httr solutions (I haven't checked the encoding, but it might help as a starting point)

ireaEndpoint <- "http://fuseki1.get-it.it/directory/query"
ireaQuery <- paste0(
  "PREFIX owl: <http://www.w3.org/2002/07/owl#>
       PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
       PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       PREFIX qudt: <http://qudt.org/schema/qudt/>
       SELECT ?c ?l ?code ?s
        WHERE {
          SERVICE <http://vocab.nerc.ac.uk/sparql/sparql> {
            ?c rdf:type skos:Concept .
            <http://vocab.nerc.ac.uk/collection/P06/current/> skos:member ?c .
            OPTIONAL {
              ?c skos:altLabel ?l .
              ?c owl:sameAs ?s .
            }
            FILTER(?l = 'degC')
            FILTER(REGEX(STR(?s), 'qudt'))
          }
          SERVICE <https://www.qudt.org/fuseki/qudt/query> {
            ?s qudt:udunitsCode ?code
          }
        }
      ORDER BY ASC(?l)
      LIMIT 1"
)

library("magrittr")
resp <- httr2::request(ireaEndpoint) %>%
    httr2::req_url_query(query = ireaQuery) %>%
    httr2::req_method("POST") %>%
    httr2::req_headers(Accept = "application/sparql-results+json") %>%
    httr2::req_user_agent("ReLTER dev") %>%
    httr2::req_retry(max_tries = 3, max_seconds = 120) %>%
    httr2::req_perform()
httr2::resp_check_status(resp)
httr2::resp_body_json(resp)
#> $head
#> $head$vars
#> $head$vars[[1]]
#> [1] "c"
#> 
#> $head$vars[[2]]
#> [1] "l"
#> 
#> $head$vars[[3]]
#> [1] "code"
#> 
#> $head$vars[[4]]
#> [1] "s"
#> 
#> 
#> 
#> $results
#> $results$bindings
#> $results$bindings[[1]]
#> $results$bindings[[1]]$c
#> $results$bindings[[1]]$c$type
#> [1] "uri"
#> 
#> $results$bindings[[1]]$c$value
#> [1] "http://vocab.nerc.ac.uk/collection/P06/current/UPAA/"
#> 
#> 
#> $results$bindings[[1]]$l
#> $results$bindings[[1]]$l$type
#> [1] "literal"
#> 
#> $results$bindings[[1]]$l$value
#> [1] "degC"
#> 
#> 
#> $results$bindings[[1]]$code
#> $results$bindings[[1]]$code$type
#> [1] "literal"
#> 
#> $results$bindings[[1]]$code$value
#> [1] "°C"
#> 
#> 
#> $results$bindings[[1]]$s
#> $results$bindings[[1]]$s$type
#> [1] "uri"
#> 
#> $results$bindings[[1]]$s$value
#> [1] "http://qudt.org/vocab/unit/DEG_C"

qudtUOM <- httr::GET(
  url = ireaEndpoint,
  query = list(query = ireaQuery)
)
httr::parsed_content(qudtUOM)
#> text_content() deprecated. Use content(x, as = 'parsed')
#> $head
#> $head$vars
#> $head$vars[[1]]
#> [1] "c"
#> 
#> $head$vars[[2]]
#> [1] "l"
#> 
#> $head$vars[[3]]
#> [1] "code"
#> 
#> $head$vars[[4]]
#> [1] "s"
#> 
#> 
#> 
#> $results
#> $results$bindings
#> $results$bindings[[1]]
#> $results$bindings[[1]]$c
#> $results$bindings[[1]]$c$type
#> [1] "uri"
#> 
#> $results$bindings[[1]]$c$value
#> [1] "http://vocab.nerc.ac.uk/collection/P06/current/UPAA/"
#> 
#> 
#> $results$bindings[[1]]$l
#> $results$bindings[[1]]$l$type
#> [1] "literal"
#> 
#> $results$bindings[[1]]$l$value
#> [1] "degC"
#> 
#> 
#> $results$bindings[[1]]$code
#> $results$bindings[[1]]$code$type
#> [1] "literal"
#> 
#> $results$bindings[[1]]$code$value
#> [1] "°C"
#> 
#> 
#> $results$bindings[[1]]$s
#> $results$bindings[[1]]$s$type
#> [1] "uri"
#> 
#> $results$bindings[[1]]$s$value
#> [1] "http://qudt.org/vocab/unit/DEG_C"

Created on 2022-10-20 with reprex v2.0.2

maelle commented 1 year ago

(as a side note you might be interested in https://github.com/lvaudor/glitter since you like SPARQL queries :wink:)

oggioniale commented 1 year ago

(as a side note you might be interested in https://github.com/lvaudor/glitter since you like SPARQL queries 😉)

(I had seen this package, but didn't have time to look at it. Better than httr or httr2?)

oggioniale commented 1 year ago

Here's a reprex with both httr2 and httr solutions (I haven't checked the encoding, but it might help as a starting point)

ireaEndpoint <- "http://fuseki1.get-it.it/directory/query"
ireaQuery <- paste0(
  "PREFIX owl: <http://www.w3.org/2002/07/owl#>
       PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
       PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       PREFIX qudt: <http://qudt.org/schema/qudt/>
       SELECT ?c ?l ?code ?s
        WHERE {
          SERVICE <http://vocab.nerc.ac.uk/sparql/sparql> {
            ?c rdf:type skos:Concept .
            <http://vocab.nerc.ac.uk/collection/P06/current/> skos:member ?c .
            OPTIONAL {
              ?c skos:altLabel ?l .
              ?c owl:sameAs ?s .
            }
            FILTER(?l = 'degC')
            FILTER(REGEX(STR(?s), 'qudt'))
          }
          SERVICE <https://www.qudt.org/fuseki/qudt/query> {
            ?s qudt:udunitsCode ?code
          }
        }
      ORDER BY ASC(?l)
      LIMIT 1"
)

library("magrittr")
resp <- httr2::request(ireaEndpoint) %>%
    httr2::req_url_query(query = ireaQuery) %>%
    httr2::req_method("POST") %>%
    httr2::req_headers(Accept = "application/sparql-results+json") %>%
    httr2::req_user_agent("ReLTER dev") %>%
    httr2::req_retry(max_tries = 3, max_seconds = 120) %>%
    httr2::req_perform()
httr2::resp_check_status(resp)
httr2::resp_body_json(resp)
#> $head
#> $head$vars
#> $head$vars[[1]]
#> [1] "c"
#> 
#> $head$vars[[2]]
#> [1] "l"
#> 
#> $head$vars[[3]]
#> [1] "code"
#> 
#> $head$vars[[4]]
#> [1] "s"
#> 
#> 
#> 
#> $results
#> $results$bindings
#> $results$bindings[[1]]
#> $results$bindings[[1]]$c
#> $results$bindings[[1]]$c$type
#> [1] "uri"
#> 
#> $results$bindings[[1]]$c$value
#> [1] "http://vocab.nerc.ac.uk/collection/P06/current/UPAA/"
#> 
#> 
#> $results$bindings[[1]]$l
#> $results$bindings[[1]]$l$type
#> [1] "literal"
#> 
#> $results$bindings[[1]]$l$value
#> [1] "degC"
#> 
#> 
#> $results$bindings[[1]]$code
#> $results$bindings[[1]]$code$type
#> [1] "literal"
#> 
#> $results$bindings[[1]]$code$value
#> [1] "°C"
#> 
#> 
#> $results$bindings[[1]]$s
#> $results$bindings[[1]]$s$type
#> [1] "uri"
#> 
#> $results$bindings[[1]]$s$value
#> [1] "http://qudt.org/vocab/unit/DEG_C"

qudtUOM <- httr::GET(
  url = ireaEndpoint,
  query = list(query = ireaQuery)
)
httr::parsed_content(qudtUOM)
#> text_content() deprecated. Use content(x, as = 'parsed')
#> $head
#> $head$vars
#> $head$vars[[1]]
#> [1] "c"
#> 
#> $head$vars[[2]]
#> [1] "l"
#> 
#> $head$vars[[3]]
#> [1] "code"
#> 
#> $head$vars[[4]]
#> [1] "s"
#> 
#> 
#> 
#> $results
#> $results$bindings
#> $results$bindings[[1]]
#> $results$bindings[[1]]$c
#> $results$bindings[[1]]$c$type
#> [1] "uri"
#> 
#> $results$bindings[[1]]$c$value
#> [1] "http://vocab.nerc.ac.uk/collection/P06/current/UPAA/"
#> 
#> 
#> $results$bindings[[1]]$l
#> $results$bindings[[1]]$l$type
#> [1] "literal"
#> 
#> $results$bindings[[1]]$l$value
#> [1] "degC"
#> 
#> 
#> $results$bindings[[1]]$code
#> $results$bindings[[1]]$code$type
#> [1] "literal"
#> 
#> $results$bindings[[1]]$code$value
#> [1] "°C"
#> 
#> 
#> $results$bindings[[1]]$s
#> $results$bindings[[1]]$s$type
#> [1] "uri"
#> 
#> $results$bindings[[1]]$s$value
#> [1] "http://qudt.org/vocab/unit/DEG_C"

Created on 2022-10-20 with reprex v2.0.2

sounds very good!!

... and could be possible also obtain a tibble as qudtUOM?

maelle commented 1 year ago

(I had seen this package, but didn't have time to look at it. Better than httr or httr2?)

It is not a replacement for them, it's a package (not stable yet) that should help write SPARQL queries (well in your case you already know, but that can also help people who read the code)

maelle commented 1 year ago

and could be possible also obtain a tibble as qudtUOM?

not via httr/httr2, at least I don't think so? which means, you'd need to add parsing code :thinking:

oggioniale commented 1 year ago

yes for sure I can parse the code ... just to know

oggioniale commented 1 year ago

I have changed the code using httr2 with this commit a72e1ee004749bfcb8730da51fd5670927f9be24

maelle commented 1 year ago

Cool!

Is the number of Imports becoming too high? CRAN has a limit, and you'd get a NOTE. Maybe the other httr code can be switched to httr2?

oggioniale commented 1 year ago

currently the imported packages are 45. Is it more the limit of CRAN?

The httr code has been wrote by my colleague and I would like to wait for changes or suggestions from him.

maelle commented 1 year ago

currently the imported packages are 45. Is it more the limit of CRAN?

oh yeah definitely, it's about 20 if I remember correctly.

maelle commented 1 year ago

the limit is for packages listed in Imports, not Suggests

maelle commented 1 year ago

source https://github.com/wch/r-source/blob/3f86cb4b1867deea8f7e236f533fbdc5fac2b82e/doc/manual/R-ints.texi#L4458

maelle commented 1 year ago

and https://github.com/wch/r-source/blob/16191bfcf873d55c3944678d9dfbd416317da83e/src/library/tools/R/check.R#L6664

oggioniale commented 1 year ago

the limit is for packages listed in Imports, not Suggests

45 are only in the Imports. Suggests packages are only 7.

How can I actually know whether a package is imported or suggested? Just from the fact that it is used in a function? In that case, do I have to import it and not suggests it?

maelle commented 1 year ago

imported = listed in Imports.

Now, a package has to be listed in Imports when you call it from your code.

I'd suggest reading https://r-pkgs.org/dependencies.html

To limit the number of dependencies, you might need to

micha-silver commented 1 year ago

Hi @oggioniale Here are some ideas of packages that we might be able to remove: leaflet (if we switch all map plots to tmap) rgeos (probably not necessary) lubridate (nice to have, but we might get by with base R) tidyr and dplyr and dtplyr and magrittr ? - these could be consolidated rworldmap and rnaturealearth. One should be enough qrcode - How important is the produce_site_qrcode function? What is the purpose? ggforce - Really required?

Best regards, Micha

oggioniale commented 1 year ago

Hi @micha-silver I think it is a very accurate analysis. Thank you!!!

We have to work in terms of consolidation. I would now like to arrive at a new and final version with the new functions and then think about consolidation and harmonisation in the use of packages.

Someone have idea about the rarer in the actions (https://github.com/ropensci/ReLTER/actions/runs/3378798361)? Because if we don't get past this step, I wouldn't dare make any more changes.

micha-silver commented 1 year ago

Hi @oggioniale I see the errors in the Ubuntu builds have to do with openssl. I think there have been some updates to that software lately. It might be that we are temporarily between versions. Maybe after a day or two, when the repositories get synchronized, those errors will go away.?? If I understand, we are working on the dev branch? Should I wait till the above errors are fixed before pushing any new changes?

maelle commented 1 year ago

:wave: @oggioniale @micha-silver is any help needed here?

oggioniale commented 1 year ago

Dear @micha-silver, yes we working on the dev branch and we have a lot of changes in the package. We still working to solve some issues at the moment.

maelle commented 1 year ago

wave @oggioniale @micha-silver Happy New Year! Is any help needed?

oggioniale commented 1 year ago

Hi @maelle, Happy New Year to you too.

Nothing at the moment. We will need your support when we will reduce the number of packages imported.

I thinking … soon

micha-silver commented 1 year ago

Hi @oggioniale One idea came to my mind this week: We have a minimal R version 3.5. And we need to import magrittr just for the '%>%' pipe operator. If we up the minimum R version to 4.1, then we can change to the new built in '|>' operator, and drop the magrittr dependency. But let's wait till after the workshop ;-)

micha-silver commented 1 year ago

@maelle Happy holiday to you as well

maelle commented 1 year ago

Hello @oggioniale @micha-silver, any update? :smile_cat:

maelle commented 1 year ago

:wave: @oggioniale @micha-silver

maelle commented 1 year ago

wave @oggioniale @micha-silver

maelle commented 7 months ago

:wave: @oggioniale @micha-silver -- what's the current status? Any help needed?