phenmn_class: phenmn_class

View source: R/phenmn_class.R

phenmn_classR Documentation

phenmn_class

Description

Phenomenon Classification. Semi-automatic classification of strings by expressions.

Usage

phenmn_class(
  data,
  colname,
  pat_exp,
  cl_to,
  user_class = F,
  trim = F,
  develop = T
)

Arguments

data

data.frame or SpatialPointData.frame.

colname

charater - name of column containing the strings

pat_exp

character - expressions which will be used for pattern matching

cl_to

character - classnames. Must be of same lenght as 'pat_exp'

user_class

boolean - if True the user can choose to classifie lines with multiple matches by hand.

trim

boolean - if TRUE will trim rows which have none applied class (0).

develop

boolean - if TRUE will NOT delete columns which are used to identify multiple matches. This is used to check the function.

Value

returns the dataframe with an additional column containing the classes.

Author(s)

Andreas Schönberg

Examples

# load data
csv <- read.csv(system.file("extdata","hunde.csv",package = "LinguGeo"))
# take a look
head(csv)
# reclassifie
new_class <- phenmn_class(data=csv,colname = "hunde",
                          pat_exp = c("nd|nt","ng|n.g","nn|n$")
                          ,cl_to = c("nd"   ,"ng"    ,"nn"))
# using user classification for multiple matches (user_class=TRUE)

new_class <- phenmn_class(data=csv,colname = "hunde",
                          pat_exp = c("nd|nt","ng|n.g","nn|n$")
                          ,cl_to = c("nd"   ,"ng"    ,"nn"),
                          user_class=TRUE)
# trim all rows with no class (0)
 new_class <- phenmn_class(data=csv,colname = "hunde",
                         pat_exp = c("nd|nt","ng|n.g","nn|n$")
                         ,cl_to = c("nd"   ,"ng"    ,"nn"),
                         user_class=TRUE,trim=T)

SchoenbergA/LinguGeo documentation built on March 27, 2023, 2:47 a.m.