Description Usage Arguments Value Author(s) Examples
This function helps check if there are missing values in the modeling data sets. It prints out general statistics for missing values and their specific locations in the data matrix. It returns TRUE/FALSE to indicate whether the data file passes the missing check.
1 2 |
file |
a string to specify the full filename of the data file, only supports files in *.txt or *.csv. |
row.names |
a logical value to specify if the data file contains row names or not. Default value is FALSE. |
col.names |
a logical value to specify if the data file contains column names or not. Default value is FALSE. |
missing.flag |
a string to specify the missing flag used in the data file. Default value is "NA". |
type |
a string to specify the type of data file. Default value is ".txt". |
Return a logical value to indicate whether the data file contains missing value(s).
Xiuquan Wang <xiuquan.wang@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | ## Load rSCA package
library(rSCA)
## Case 1: without column name and row name, using NA as missing flag
data <- c("5 7 9 10\r",
"12 3 4 5\r",
"1 NA NA 3\r",
"2 NA 13 23\r",
"0 12 1 8\r",
"NA 9 0 1\r")
datafile <- tempfile()
writeLines(data, datafile)
bPass = rSCA.missing(file = datafile)
## Remove temporary data files
unlink(datafile)
## Case 2: with column name and row name, using -99 as missing flag
data <- c("Year V1 V2 V3 V4\r",
"2010 5 7 9 10\r",
"2012 12 3 4 5\r",
"2013 1 -99 -99 3\r",
"2014 2 -99 13 23\r",
"2015 0 12 1 8\r",
"2016 -99 9 0 1\r")
datafile <- tempfile()
writeLines(data, datafile)
bPass = rSCA.missing(file = datafile, col.names = TRUE,
row.names = TRUE, missing.flag = "-99")
## Remove temporary data files
unlink(datafile)
## Case 3: with column name and row name, using NA as missing flag,
## stored in comma-separated value (CSV) format.
data <- c("Year,V1,V2,V3,V4\r",
"2010,5,7,9,10\r",
"2012,12,3,4,5\r",
"2013,1,NA,NA,3\r",
"2014,2,NA,13,23\r",
"2015,0,12,1,8\r",
"2016,NA,9,0,1\r")
datafile <- tempfile()
writeLines(data, datafile)
bPass = rSCA.missing(file = datafile, col.names = TRUE,
row.names = TRUE, missing.flag = "NA", type = ".csv")
## Remove temporary data files
unlink(datafile)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.