Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

class_center

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")
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

Forest Mensuration and Management

v0.9.3
MIT + file LICENSE
Authors
Sollano Rabelo Braga [aut, cre, cph], Marcio Leles Romarco de Oliveira [aut], Eric Bastos Gorgens [aut]
Initial release
2021-01-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.