Skip to content

Convenience functions for data manipulation

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

santiagohermo/data.tools

Repository files navigation

data.tools: Tools for data manipulation

Package that includes functions for data manipulation. It is suggested to use the package with data.table.

Installation

You can install the package using devtools:

devtools::install_github("santiagohermo/data.tools")

Usage

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.

About

Convenience functions for data manipulation

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages