library(datawizard)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
mtcars<-mtcars
#extract data match the criteria
matching_rows<-mtcars%>%data_match(data.frame(vs=0, am=1))
matching_rows
## [1] "Mazda RX4"      "Mazda RX4 Wag"  "Porsche 914-2"  "Ford Pantera L"
## [5] "Ferrari Dino"   "Maserati Bora"
mtcars[matching_rows,]
#change column header name
head(data_addprefix(iris, "New_"))
#merge
x <- data.frame(a = 1:3, b = c("a", "b", "c"), c = 5:7, id = 1:3)
y <- data.frame(c = 6:8, d = c("f", "g", "h"), e = 100:102, id = 2:4)

data_merge(x,y, join="full")
#only keep row from x data when matching with y data for the key variable
data_merge(x, y, join = "semi", by = "c")
#only keep row from x data when NOT matching with y data for the key variable
data_merge(x, y, join = "anti", by = "c")

Reshape

wide_data <- data.frame(replicate(5, rnorm(10)))
wide_data
head(data_to_long(wide_data))

long to wide

long_data <- data_to_long(wide_data, rows_to = "Row_ID") # Save row number
long_data
data_to_wide(long_data,
  colnames_from = "Name",
  values_from = "Value",
  rows_from = "Row_ID"
)
data(iris)
describe_distribution(iris)

reference: https://easystats.github.io/datawizard/ https://easystats.github.io/datawizard/reference/index.html