Converting data frames to Tibbles

If you prefer tibbles to data frames for their additional features they can also be converted from existing data frames with the as_tibble() function.

For example, the Davis data frame from the carData package can be converted to a tibble like so:

Input
as_tibble(Davis)
Output
# A tibble: 200 x 5
   sex   weight height repwt repht
   <fct>  <int>  <int> <int> <int>
 1 M         77    182    77   180
 2 F         58    161    51   159
 3 F         53    161    54   158
 4 M         68    177    70   175
 5 F         59    157    59   155
 6 M         76    170    76   165
 7 M         76    167    77   165
 8 M         69    186    73   180
 9 M         71    178    71   175
10 M         65    171    64   170
# … with 190 more rows
Create and convert tibbles