I would like to run this script multiple times(and do a few other things after that). The data is in a text file (named test.txt
) in the following form:
A B C D E
1 2 2 1 9
3 5 1 3 0
2 NA 4 13 2
and is imported using
test <- read.table("test.txt",header=TRUE)
The data can be converted to a different format and it can be used without headers.
I know I should use an apply
function, and I Googled a lot about using both apply
functions and for loops, but I wasn't able to implement them successfully.
For example, I get an error message after running the following code:
for(i in names(table)){
message("Name of the data set:", i)
outlierKD(table, i)}
Error in eval(expr, envir, enclos) : object 'i' not found`.
I found a discussion here about the loop's index and also discovered that exists(i)
returns false while the message appears properly.
I would like to execute the outlier
function that checks for outliers in all columns of the data either using apply
functions or loops.