Skip to contents

This function prints safeframe objects.

Usage

# S3 method for class 'safeframe'
print(x, ...)

Arguments

x

a safeframe object

...

further arguments to be passed to 'print'

Value

Invisibly returns the object.

Examples

## create safeframe
x <- make_safeframe(cars,
  speed = "Miles per hour",
  dist = "Distance in miles"
)

## print object - using only the first few entries
head(x)
#> 
#> // safeframe object
#>   speed dist
#> 1     4    2
#> 2     4   10
#> 3     7    4
#> 4     7   22
#> 5     8   16
#> 6     9   10
#> 
#> labelled variables:
#>  speed - Miles per hour
#>  dist - Distance in miles 

# version with a tibble
if (require(tibble) && require(magrittr)) {
  cars %>%
    tibble() %>%
    make_safeframe(
      speed = "Miles per hour",
      dist = "Distance in miles"
    )
}
#> Loading required package: tibble
#> 
#> // safeframe object
#> # A tibble: 50 × 2
#>    speed  dist
#>    <dbl> <dbl>
#>  1     4     2
#>  2     4    10
#>  3     7     4
#>  4     7    22
#>  5     8    16
#>  6     9    10
#>  7    10    18
#>  8    10    26
#>  9    10    34
#> 10    11    17
#> # ℹ 40 more rows
#> 
#> labelled variables:
#>  speed - Miles per hour
#>  dist - Distance in miles