Skip to content

Commit 0b166d9

Browse files
committed
remove orphaned udunits2 package
1 parent ccf9bfe commit 0b166d9

6 files changed

+9
-56
lines changed

DESCRIPTION

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Imports:
1515
LinkingTo:
1616
Rcpp (>= 0.12.10)
1717
Suggests:
18-
udunits2,
1918
NISTunits,
2019
measurements,
2120
xml2,

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ derives from this manuscript and is kept up to date with the package development
2727
- Blog posts: [first](https://www.r-spatial.org/r/2016/06/10/units.html),
2828
[second](https://www.r-spatial.org/r/2016/08/16/units2.html),
2929
[third](https://www.r-spatial.org/r/2016/09/29/plot_units.html).
30-
- The [udunits2 R package](https://github.com/pacificclimate/Rudunits2) GitHub page.
3130
- The UNIDATA [udunits2](https://github.com/Unidata/UDUNITS-2) library at GitHub.
3231

3332
### What it does

demo/cf.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ cf_units = tb[[3]][2][[1]]
77
u = lapply(cf_units, as_units, force_single_symbol=TRUE, check_is_valid=FALSE)
88
names(u) = substr(tb[[3]][1][[1]], 1, 50)
99
# does udunits2 understand them?
10-
all(sapply(u, udunits2::ud.is.parseable))
10+
all(sapply(u, units::ud_is_parseable))

vignettes/measurement_units_in_R.Rmd

+6-42
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ This vignette is identical to @rj, except for two changes:
2929
## Abstract
3030
We briefly review SI units, and discuss R packages that deal
3131
with measurement units, their compatibility and conversion.
32-
Built upon [udunits2](https://cran.r-project.org/package=udunits2)
33-
and the UNIDATA udunits library, we introduce the package
32+
Built upon the UNIDATA udunits library, we introduce the package
3433
[units](https://cran.r-project.org/package=units) that provides a
3534
class for maintaining unit metadata. When used in expression, it
3635
automatically converts units, and simplifies units of results when
@@ -180,7 +179,7 @@ NISTwattPerSqrMeterTOwattPerSqrInch(1:5)
180179
Both [measurements](https://cran.r-project.org/package=measurements) and [NISTunits](https://cran.r-project.org/package=NISTunits) are written entirely
181180
in R.
182181

183-
## UNIDATA's udunits library and the `udunits2` R package
182+
## UNIDATA's udunits library
184183

185184
Udunits, developed by UCAR/UNIDATA, advertises itself on [its web
186185
page](https://www.unidata.ucar.edu/software/udunits/)
@@ -190,50 +189,16 @@ of units and for conversion of numeric values between compatible
190189
units. The package contains an extensive unit database, which is
191190
in XML format and user-extendable._"
192191

193-
The R package [udunits2](https://cran.r-project.org/package=udunits2)
194-
[@udunits2] provides a low-level R interface to the most important
195-
functions in the udunits2 C library.
196-
197-
The functions provided by [udunits2](https://cran.r-project.org/package=udunits2) are
198-
```{r, eval=requireNamespace("udunits2", quietly=TRUE)}
199-
library(udunits2)
200-
ls(2)
201-
```
202-
Dropping the `ud` prefix,
203-
`is.parseable` verifies whether a unit is parseable
204-
```{r, eval=requireNamespace("udunits2", quietly=TRUE)}
205-
ud.is.parseable("m/s")
206-
ud.is.parseable("q")
207-
```
208-
`are.convertible` specifies whether two units are convertible
209-
```{r, eval=requireNamespace("udunits2", quietly=TRUE)}
210-
ud.are.convertible("m/s", "km/h")
211-
ud.are.convertible("m/s", "s")
212-
```
213-
`convert` converts units that are convertible, and throws an error otherwise
214-
```{r, eval=requireNamespace("udunits2", quietly=TRUE)}
215-
ud.convert(1:3, "m/s", "km/h")
216-
```
217-
and `get.name`, `get.symbol` and `set.encoding` get name, get symbol
218-
or modify encoding of the character unit arguments.
219-
```{r, eval=requireNamespace("udunits2", quietly=TRUE)}
220-
ud.get.name("kg")
221-
ud.get.symbol("kilogram")
222-
ud.set.encoding("utf8")
223-
```
224-
225192
Unlike the
226193
[measurements](https://cran.r-project.org/package=measurements)
227194
and [NISTunits](https://cran.r-project.org/package=NISTunits),
228-
[udunits2](https://cran.r-project.org/package=udunits2) parses
195+
the underlying udunits2 C library parses
229196
units as expressions, and bases its logic upon the convertibility
230197
of expressions, rather than the comparison of fixed strings:
231-
```{r, eval=requireNamespace("udunits2", quietly=TRUE)}
198+
```{r}
232199
m100_a = paste(rep("m", 100), collapse = "*")
233200
dm100_b = "dm^100"
234-
ud.is.parseable(m100_a)
235-
ud.is.parseable(dm100_b)
236-
ud.are.convertible(m100_a, dm100_b)
201+
units::ud_are_convertible(m100_a, dm100_b)
237202
```
238203
This has the advantage that through complex computations,
239204
intermediate objects can have units that are arbitrarily complex,
@@ -425,8 +390,7 @@ two set the class attribute of a vector or matrix.
425390

426391
Despite all standardization efforts, units may still be ambiguous,
427392
or subject to interpretation. For instance for the duration of one
428-
year [NISTunits](https://cran.r-project.org/package=NISTunits)
429-
or [udunits2](https://cran.r-project.org/package=udunits2) give
393+
year [NISTunits](https://cran.r-project.org/package=NISTunits) gives
430394
us an answer that depends on whether we want a common, leap,
431395
Gregorian, Julian, tropical or siderial year (@lang, see
432396
also `demo(year)`). This illustrates that those who apply

vignettes/measurement_units_in_R.bib

-7
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,6 @@ @Manual{NISTunits
9090
url = {https://CRAN.R-project.org/package=NISTunits}
9191
}
9292

93-
@Manual{udunits2,
94-
title = {udunits2: Udunits-2 Bindings for R},
95-
author = {James Hiebert},
96-
year = {2015},
97-
note = {R package version 0.9}
98-
}
99-
10093
@article{lubridate,
10194
author = {Garrett Grolemund and Hadley Wickham},
10295
title = {Dates and Times Made Easy with lubridate},

vignettes/units.Rmd

+2-4
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ We see here that the `units` method is used to retrieve and modify the
3636
unit of time differences.
3737

3838
The `units` package generalizes this idea to other physical units, building upon the
39-
[udunits2](https://cran.r-project.org/package=udunits2)
40-
R package, which in turn is build upon the
4139
[udunits2](https://www.unidata.ucar.edu/software/udunits/) C library.
4240
The `udunits2` library provides the following operations:
4341

@@ -47,8 +45,8 @@ The `udunits2` library provides the following operations:
4745
* providing names and symbols for specific units
4846
* handle different character encodings (utf8, ascii, iso-8859-1 and latin1)
4947

50-
The `units` R package uses R package
51-
[`udunits2`](https://cran.r-project.org/package=udunits2) to extend
48+
The `units` R package uses the
49+
[udunits2](https://www.unidata.ucar.edu/software/udunits/) C library to extend
5250
R with functionality for manipulating numeric vectors that have
5351
physical measurement units associated with them, in a similar way as
5452
`difftime` objects behave.

0 commit comments

Comments
 (0)