| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/reshape.R |
| 3 |
\name{partition} |
| 4 |
\alias{partition} |
| 5 |
\alias{bind} |
| 6 |
\alias{yank} |
| 7 |
\title{Separate a big \code{skim_df} into smaller data frames, by type.} |
| 8 |
\usage{ |
| 9 |
partition(data) |
| 10 |
|
| 11 |
bind(data) |
| 12 |
|
| 13 |
yank(data, skim_type) |
| 14 |
} |
| 15 |
\arguments{ |
| 16 |
\item{data}{A \code{skim_df}.} |
| 17 |
|
| 18 |
\item{skim_type}{A character scalar. The subtable to extract from a |
| 19 |
\code{skim_df}.} |
| 20 |
} |
| 21 |
\value{ |
| 22 |
A \code{skim_list} of \code{skim_df}'s, by type. |
| 23 |
} |
| 24 |
\description{ |
| 25 |
The data frames produced by \code{\link[=skim]{skim()}} are wide and sparse, filled with |
| 26 |
columns that are mostly \code{NA}. For that reason, it can be convenient to |
| 27 |
work with "by type" subsets of the original data frame. These smaller |
| 28 |
subsets have their \code{NA} columns removed. |
| 29 |
} |
| 30 |
\details{ |
| 31 |
\code{partition()} creates a list of smaller \code{skim_df} data frames. Each entry |
| 32 |
in the list is a data type from the original \code{skim_df}. The inverse of |
| 33 |
\code{partition()} is \code{bind()}, which takes the list and produces the original |
| 34 |
\code{skim_df}. While \code{partition()} keeps all of the subtables as list entries, |
| 35 |
\code{yank()} gives you a single subtable for a data type. |
| 36 |
} |
| 37 |
\section{Functions}{ |
| 38 |
\itemize{ |
| 39 |
\item \code{bind()}: The inverse of a \code{partition()}. Rebuild the original |
| 40 |
\code{skim_df}. |
| 41 |
|
| 42 |
\item \code{yank()}: Extract a subtable from a \code{skim_df} with a particular |
| 43 |
type. |
| 44 |
|
| 45 |
}} |
| 46 |
\examples{ |
| 47 |
# Create a wide skimmed data frame (a skim_df) |
| 48 |
skimmed <- skim(iris) |
| 49 |
|
| 50 |
# Separate into a list of subtables by type |
| 51 |
separate <- partition(skimmed) |
| 52 |
|
| 53 |
# Put back together |
| 54 |
identical(bind(separate), skimmed) |
| 55 |
# > TRUE |
| 56 |
|
| 57 |
# Alternatively, get the subtable of a particular type |
| 58 |
yank(skimmed, "factor") |
| 59 |
} |