phenmn_class | R Documentation |
Phenomenon Classification. Semi-automatic classification of strings by expressions.
phenmn_class(
data,
colname,
pat_exp,
cl_to,
user_class = F,
trim = F,
develop = T
)
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. |
returns the dataframe with an additional column containing the classes.
Andreas Schönberg
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.