https://github.com/santiagohermo/data.tools
Convenience functions for data manipulation
https://github.com/santiagohermo/data.tools
data-analysis data-cleaning data-science data-wrangling
Last synced: 8 months ago
JSON representation
Convenience functions for data manipulation
- Host: GitHub
- URL: https://github.com/santiagohermo/data.tools
- Owner: santiagohermo
- License: other
- Created: 2023-06-06T02:55:55.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2025-06-18T17:16:21.000Z (about 1 year ago)
- Last Synced: 2025-06-18T18:25:12.195Z (about 1 year ago)
- Topics: data-analysis, data-cleaning, data-science, data-wrangling
- Language: R
- Homepage:
- Size: 24.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
title: "data.tools: Tools for data manipulation"
output: github_document
---
Package that includes functions for data manipulation.
It is suggested to use the package with [data.table](https://github.com/Rdatatable/data.table).
## Installation
You can install the package using devtools:
```{r, eval = F}
devtools::install_github("santiagohermo/data.tools")
```
## Usage
```{r, eval = F}
library(data.tools)
# Simulate panel data
dt <- data.table::data.table(unit = c("A", "A", "B", "B", "C", "C", "D", "D", "E", "E"),
time = rep(c(1, 2), 5))
dt[, y := rnorm(.N)]
# Create equal-sized groups
dt[, terciles_y := cut_in_n(y, n=3)]
dt[, terciles_y_within := cut_in_n(y, n=3), by=time]
# Save the data set to a csv file with a log file
save_data(dt, key = c("unit", "time"),
outfile = "data.csv")
# Save the data set to a feather without a log file
save_data(dt, key = c("unit", "time"),
outfile = "data.feather",
logfile = FALSE)
```
## Available functions
- `cut_in_n`: Bin a numeric vector into n equal-sized groups.
- `save_data`: Save data set to a file with a log file, several formats are available.
- `weighted_sd` and `weighted_var`: Compute weighted standard deviation and variance.