class_center: Classify a given variable and get center of class

View source: R/class_center.R

class_centerR Documentation

Classify a given variable and get center of class

Description

This function can be used to divide the data into classes, based on minimum value and class interval of a given variable, and create a column with the center of each class.

Usage

class_center(df, y, ci = 3, ymin = 5)

Arguments

df

A data frame.

y

Quoted name of a variable, or a vector to be classified.

ci

Numeric value for the class interval used to classify the data. Default: 3.

ymin

Numeric value for minimum value value to be considered in the classifications. dbh values smaller than this will be dismissed from the classification. Default: 5.

Value

if df is supplied, a data frame containing the supplied data with a new column for the center of classes; if df is missing, a vetor with the center of class.

Author(s)

Sollano Rabelo Braga sollanorb@gmail.com

Examples

library(forestmangr)
library(dplyr)
data("exfm20")
head(exfm20)

# n
# Number of individuals per ha per diameter class
class_center(df = exfm20, y = "dbh", ci = 10, ymin = 10) 

exfm20 %>% 
mutate(CC = class_center(y = dbh, ci = 10, ymin = 10))


forestmangr documentation built on Sept. 15, 2024, 1:06 a.m.