View source: R/FacialExpression.R
| 1 | 
| 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 | ##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.
## The function is currently defined as
function () 
{
    Dat <- read.table("a_affirmative_datapoints.txt", header = FALSE, 
        nrows = 1, stringsAsFactors = FALSE)
    file_a <- list.files(pattern = "a_[a-zA-Z|_]*_datapoints+")
    for (i in 1:length(file_a)) {
        temp <- as.data.frame(fread(file_a[i], header = FALSE, 
            sep = " "))
        Dat <- rbind(Dat, temp[-1, ])
        cat("\r", "I'm reading the facial expressions >>>>>>>>>>>>>", 
            paste(round(i/length(file_a) * 100, digits = 2), 
                "%"), ">>>>>>>>>>>>>>>>>>")
    }
    cat("\n")
    Dat_name <- as.character(Dat[1, -1])
    Dat_a <- Dat[-1, -1]
    names(Dat_a) <- Dat_name
    file_a_target <- list.files(pattern = "a_[a-zA-Z|_]*_target+")
    Target <- c(10)
    for (i in 1:length(file_a_target)) {
        Target <- rbind(Target, as.vector(read.table(file_a_target[i], 
            header = FALSE)))
        cat("\r", "I'm reading the targeting vector >>>>>>>>>>>>>", 
            paste(round(i/length(file_a_target) * 100, digits = 2), 
                "%"), ">>>>>>>>>>>>>>>>>>")
    }
    cat("\n")
    Target <- as.vector(Target[-1, 1])
    names(Target) <- "Target"
    return(cbind(Target, Dat_a))
  }
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.