| 1 |
\name{tibbles} |
| 2 |
\alias{as_tibble.data.set} |
| 3 |
\alias{as.item,labelled-method} |
| 4 |
\alias{as.item,haven_labelled-method} |
| 5 |
\alias{as.item,haven_labelled_spss-method} |
| 6 |
\alias{as_haven} |
| 7 |
\alias{as_haven,data.set-method} |
| 8 |
\alias{as_haven,item.vector-method} |
| 9 |
\alias{as.data.set,tbl_df-method} |
| 10 |
\title{Interface to Packages 'tibble' and 'haven'} |
| 11 |
\description{ |
| 12 |
A \code{as_tibble} method (\code{as_table.data.set}) allows to transform \code{"data.set"} objects |
| 13 |
into objects of class \code{"tbl_df"} as defined by the package |
| 14 |
"tibble". |
| 15 |
|
| 16 |
\code{as.item} methods for objects of classes \code{"haven_labelled"} |
| 17 |
and \code{"have_labelled_spss"} allow to transform a "tibble" imported |
| 18 |
using \code{read_dta}, \code{read_spss}, etc. from the package "haven" |
| 19 |
into an object of class \code{"data.set"}. |
| 20 |
|
| 21 |
\code{as_haven} can be used to transform \code{"data.set"} objects |
| 22 |
into objects of class \code{"tbl_df"} with that additional information |
| 23 |
that objects imported using the "haven" package usually have, i.e. |
| 24 |
variable labels and value labels (as the \code{"label"} and |
| 25 |
\code{"labels"} attributes of the columns). |
| 26 |
} |
| 27 |
\usage{ |
| 28 |
as_tibble.data.set(x,\dots) |
| 29 |
\S4method{as.item}{haven_labelled}(x,\dots) |
| 30 |
\S4method{as.item}{haven_labelled_spss}(x,\dots) |
| 31 |
as_haven(x,\dots) |
| 32 |
\S4method{as_haven}{data.set}(x,user_na=FALSE,\dots) |
| 33 |
\S4method{as_haven}{item.vector}(x,user_na=FALSE,\dots) |
| 34 |
\S4method{as.data.set}{tbl_df}(x,row.names=NULL,\dots) |
| 35 |
} |
| 36 |
\arguments{ |
| 37 |
\item{x}{for \code{as_tibble.data.set} and \code{as_haven}, an object |
| 38 |
of class \code{"data.set"}; for \code{as.item}, an object of class |
| 39 |
\code{"haven_labelled"} or \code{"haven_labelled_spss"}; |
| 40 |
an object of class \code{"tbl_df"} for \code{as.data.set}. |
| 41 |
} |
| 42 |
\item{user_na}{logical; if \code{TRUE} then the resulting vectors |
| 43 |
have an \code{"na_values"} and/or \code{"na_range"} attribute.} |
| 44 |
\item{row.names}{\code{NULL} or an optional character vector of row names.} |
| 45 |
\item{\dots}{further arguments, passed through to other the the |
| 46 |
\code{as_tibble} method for lists, or ignored.} |
| 47 |
} |
| 48 |
\value{ |
| 49 |
\code{as_tibble.data.set} and the \code{"data.set"}-method of |
| 50 |
\code{as_haven} return a "tibble". The \code{"item.vector"}-method |
| 51 |
(which is for internal use only) returns a vector with S3 class either |
| 52 |
\code{"haven_labelled"} or \code{"haven_labelled_spss"}. |
| 53 |
} |