Skip to content

Commit

Permalink
Closes #1294. Added patterns.Rd
Browse files Browse the repository at this point in the history
  • Loading branch information
arunsrinivasan committed Sep 17, 2015
1 parent 4b138b9 commit ae1a557
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
11. `melt.data.table`
* can now melt into multiple columns by providing a list of columns to `measure.vars` argument. Closes [#828](https://github.com/Rdatatable/data.table/issues/828). Thanks to Ananda Mahto for the extended email discussions and ideas on generating the `variable` column.
* also retains attributes wherever possible. Closes [#702](https://github.com/Rdatatable/data.table/issues/702) and [#993](https://github.com/Rdatatable/data.table/issues/993). Thanks to @richierocks for the report.
* Added `patterns.Rd`. Closes [#1294](https://github.com/Rdatatable/data.table/issues/1294). Thanks to @MichaelChirico.

12. `.SDcols`
* understands `!` now, i.e., `DT[, .SD, .SDcols=!"a"]` now works, and is equivalent to `DT[, .SD, .SDcols = -c("a")]`. Closes [#1066](https://github.com/Rdatatable/data.table/issues/1066).
Expand Down
24 changes: 24 additions & 0 deletions man/patterns.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
\name{patterns}
\alias{patterns}
\title{Regex patterns to extract columns from data.table}
\description{
From \code{v1.9.6}, \code{\link{melt.data.table}} has a new enhanced functionality in which \code{measure.vars} argument can accept a \emph{list of column names} and melt them into separate columns. See the \code{Efficient reshaping using data.tables} vignette linked below to learn more.

\code{patterns} is designed purely for convenience, to be used only within the \code{measure.vars} argument of \code{melt.data.table}. Column names corresponding to each pattern from the \code{data.table} is melted into a separate column.
}
\usage{
patterns(...)
}
\arguments{
\item{...}{ A set of patterns. See example. }
}
\seealso{
\code{\link{melt}}, \url{https://github.com/Rdatatable/data.table/wiki/Getting-started}
}
\examples{
# makes sense only in the context of melt at the moment
dt = data.table(x1 = 1:5, x2 = 6:10, y1 = letters[1:5], y2 = letters[6:10])
# melt all columns that begin with 'x' & 'y', respectively, into separate columns
melt(dt, measure.vars = patterns("^x", "^y"))
}
\keyword{ data }

0 comments on commit ae1a557

Please sign in to comment.