diff --git a/DESCRIPTION b/DESCRIPTION index e1df199..c83aabb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -15,4 +15,7 @@ Config/testthat/edition: 3 URL: https://kubdatalab.github.io/KBAPI/ Imports: httr2, - rlang + magrittr, + rlang, + tibble, + xml2 diff --git a/NAMESPACE b/NAMESPACE index c89ad8b..d21e156 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,8 +1,10 @@ # Generated by roxygen2: do not edit by hand +export("%>%") export(get_aerial) importFrom(httr2,req_perform) importFrom(httr2,req_url_query) importFrom(httr2,request) +importFrom(magrittr,"%>%") importFrom(rlang,abort) importFrom(rlang,warn) diff --git a/R/get_aerial.R b/R/get_aerial.R index e023d37..49a7503 100644 --- a/R/get_aerial.R +++ b/R/get_aerial.R @@ -52,14 +52,14 @@ get_aerial <- function(lat=56.007514636317666, lon=12.228840190005485, format = httr2::req_perform() # Her bør der nok være noget tjek af om ting gik godt. response <- response %>% - resp_body_xml() - tibble(navn =response %>% - xml_child(1) %>% - xml_children() %>% - xml_name(), + httr2::resp_body_xml() + tibble::tibble(navn =response %>% + xml2::xml_child(1) %>% + xml2::xml_children() %>% + xml2::xml_name(), indhold = response %>% - xml_child() %>% - xml_children() %>% + xml2::xml_child() %>% + xml2::xml_children() %>% lapply(function(x) x)) } diff --git a/R/utils-pipe.R b/R/utils-pipe.R new file mode 100644 index 0000000..fd0b1d1 --- /dev/null +++ b/R/utils-pipe.R @@ -0,0 +1,14 @@ +#' Pipe operator +#' +#' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. +#' +#' @name %>% +#' @rdname pipe +#' @keywords internal +#' @export +#' @importFrom magrittr %>% +#' @usage lhs \%>\% rhs +#' @param lhs A value or the magrittr placeholder. +#' @param rhs A function call using the magrittr semantics. +#' @return The result of calling `rhs(lhs)`. +NULL diff --git a/man/pipe.Rd b/man/pipe.Rd new file mode 100644 index 0000000..a648c29 --- /dev/null +++ b/man/pipe.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils-pipe.R +\name{\%>\%} +\alias{\%>\%} +\title{Pipe operator} +\usage{ +lhs \%>\% rhs +} +\arguments{ +\item{lhs}{A value or the magrittr placeholder.} + +\item{rhs}{A function call using the magrittr semantics.} +} +\value{ +The result of calling \code{rhs(lhs)}. +} +\description{ +See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. +} +\keyword{internal}