fs2cs: Convert fs data to cs data

View source: R/cna_aux.r

fs2csR Documentation

Convert fs data to cs data

Description

Convert fuzzy-set (fs) data to crisp-set (cs) data. Works for both a data.frame and a configTable input.

Usage

fs2cs(x, cutoff = 0.5, border = "up", verbose = FALSE)

Arguments

x

A data frame or configTable of type fs.

cutoff

Threshold for recoding: membership scores equal to or greater than cutoff are converted to 1, scores below to 0. Value in the unit interval [0,1]. The default cutoff is 0.5.

border

Character string specifying whether factors with membership scores equal to cutoff are rounded up ("up") or rounded down ("down").

verbose

Logical; if verbose=TRUE and a factor becomes constant, this is reported in a console message.

Details

If the input is a data frame, the output will be, too; and correspondingly for a configTable input. Case frequencies in an input configTable are accounted for.

Value

data.frame or configTable of type cs, depending on input.

See Also

configTable

Examples


csJob <- configTable(d.jobsecurity)
fs2cs(csJob)

fs2cs(d.jobsecurity) # data.frame

dJob1 <- d.jobsecurity[1, ]
fs2cs(dJob1)         # L=0.57 --> L=1
fs2cs(dJob1, cutoff = 0.6) #  --> L=0
fs2cs(dJob1, cutoff = 0.57) #  --> L=1 (since border="up" by default)
fs2cs(dJob1, cutoff = 0.57, 
      border = "down")     #  --> L=0 

cna documentation built on Oct. 28, 2026, 9:07 a.m.