deunitted: Extract data from a unitted object

Description Usage Arguments Details Value See Also Examples

Description

Unitted objects consist of data, units, and unitted class information. The function deunitted() and its alias v() remove the units and class information or, equivalently, extract the data from the unitted object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
v(object, ...)

deunitted(object, ...)

## S4 method for signature 'unitted'
deunitted(object, ...)

## S4 method for signature 'unitted_factor'
deunitted(object, ...)

## S4 method for signature 'unitted_NULL'
deunitted(object, ...)

## S4 method for signature 'unitted_data.frame'
deunitted(object, partial = FALSE, ...)

## S4 method for signature 'unitted_tbl_df'
deunitted(object, partial = FALSE, ...)

## S4 method for signature 'unitted_list'
deunitted(object, partial = FALSE, ...)

## S4 method for signature 'data.frame'
deunitted(object, ...)

## S4 method for signature 'tbl_df'
deunitted(object, ...)

## S4 method for signature 'list'
deunitted(object, ...)

## S4 method for signature 'ANY'
deunitted(object, ...)

Arguments

object

A unitted object

...

Other arguments passed to deunitted

partial

logical. Should the data.frame or list be fully deunitted, such that no elements will be left with units, or partially deunitted, such that the object that is returned is not itself unitted but may have unitted elements?

Details

In general, deunitted() and v() simply extract the data part of the unitted object.

With unitted data.frames and lists, you have a choice between partial and complete deunitting (specified by the partial argument). Complete deunitting removes units and unitted class attributes both from the container (the data.frame or list) and its elements (the columns or list elements). Partial deunitting only removes the container units and unitted class attributes.

Non-unitted data.frames, tbl_dfs, and lists may also be deunitted: This operation always removes units from the data.frame columns or list elements.

If object is neither a list nor a data.frame and is not unitted, it will be returned intact.

Value

A non-unitted data object

See Also

u() and unitted() for the construction of unitted objects; unitted for the definition of the unitted class

Examples

1
2
3
4
5
x <- u(data.frame(x = u(1:500,"A"), y = u(runif(500),"B"), z = u(500:1,"C")))
v(x)
x <- tibble::as_tibble(u(data.frame(x = u(1:500,"A"), y = u(runif(500),"B"), z = u(500:1,"C"))))
str(v(x))
str(v(x, partial=TRUE))

appling/unitted documentation built on May 10, 2019, 12:44 p.m.