assigncl | R Documentation |
Assigns class of each observation in a dataframe
assigncl(
data = data,
variable = variable,
num.class = 4,
breaks = NULL,
mincl = NULL,
wclass = NULL
)
data |
a dataframe having the validation-variable for each observation. |
variable |
a character giving the column name of the variable to be used for definning the limits of each validation class. |
num.class |
the number of classes to be build. The default is set to 4. Regardless, the percentiles are used for defining the limits of each class. |
breaks |
is a vector having the numbers to be used
as breakpoints, by default is set to |
mincl |
the number of the minimum class to be
used. By default is set to |
wclass |
the number to be used for defining the
width or amplitud of the classes. By default is
set to |
The function assign a class or category to be used for validation purposes based upon a variable defined by the user.
The main output is the data including a new column having
a composited name merging the character provided in variable
and
".class". See the examples.
Christian Salas-Eljatib and Marcos Marivil.
Salas C. 2002. Ajuste y validación de ecuaciones de volumen para un relicto del bosque de roble-laurel-lingue. Bosque 23(2):81–92. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.4067/S0717-92002002000200009")}.
# The data
library(datana)
maple
# Example 1
graphics::boxplot(maple$dbh)
df<-assigncl(data=maple,variable="dbh")
head(df)
table(df$dbh.class)
# Example 2, changing the number of classes
df<-assigncl(data=maple,variable="dbh",num.class=5)
table(df$dbh.class)
tapply(df$dbh,df$dbh.class,range)
# Example 3, fixing the breakpoints
df<-assigncl(data=maple,variable="dbh",
breaks = c(25.60,36.44,40.12,42.3))
table(df$dbh.class)
tapply(df$dbh,df$dbh.class,range)
# Example 4, giving the minimum and amplitude
# of the classes
df<-assigncl(data=llancahue,variable="dbh",mincl=5,
wclass = 5)
table(df$dbh.class)
tapply(df$dbh,df$dbh.class,range)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.