checking {SAFD} | R Documentation |
Checking correct data format
Description
The function checks if the input data is of the correct form of a polygonal fuzzy number, i.e. a dataframe with the columns "x" and "alpha" fulfilling the following conditions: (1) alpha-values have to be in [0,1] with the minimum alpha-level being 0 and maximum being 1, (2) the x-values have to be non-missing and non-decreasing, (3) the alpha-levels have to increase from 0 to 1 and afterwards decrease from 1 to 0 in the same way (i.e. the alpha-column consists of an increasing vector from 0 to 1 plus the same vector in decreasing order). As a consequence the dataframe always has an even number of rows, see examples. The function is used internally in almost all the other functions to do a preliminary checking if the input data is of the correct form.
Usage
checking(X, com = 1)
Arguments
X |
...can be any data frame. |
com |
...numeric, if |
Details
See examples
Value
The function returns the value 1 if the input fulfills all conditions, if not, 0 is returned.
Note
In case you find (almost surely existing) bugs or have recommendations for improving the functions comments are welcome to the above mentioned mail addresses.
Author(s)
Wolfgang Trutschnig <wolfgang@trutschnig.net>, Asun Lubiano <lubiano@uniovi.es>
See Also
See Also as checking2
, translator
Examples
#Example 1:
data(XX)
a<-checking(XX[[1]],1)
a
#Example 2:
X<-data.frame(y=c(-2,-0.75,-0.25,0.5,1),alpha=c(0,0.6,0.9,0.9,0))
a<-checking(X)
a
#Example 3:
X<-data.frame(x=c(-2,-0.75,-0.25,0.5,1),alpha=c(0,0.6,0.9,0.9,0))
a<-checking(X)
a
#Example 4:
X<-data.frame(x=c(-2,-0.75,-0.25,-0.5,1),alpha=c(0,0.6,1,1,0))
a<-checking(X)
a
#Example 5:
X<-data.frame(x=c(-2,-0.75,-0.25,0.5,1),alpha=c(0.3,0,1,0,0.3))
a<-checking(X)
a
#Example 6:
Y<-data.frame(x=c(-2,-0.75,-0.25,0.5,1),alpha=c(0,0.3,1,0,0.3))
a<-checking(Y)
a
#Example 7:
Z<-data.frame(x=c(-2,-0.75,-0.25,0.5,1),alpha=c(0,0.6,1,1,0))
a<-checking(Z)
a
#Example 8:
U<-data.frame(x=c(-1,0,1),alpha=c(0,1,0))
a<-checking(U,)
a