createProfile: createProfile

Usage Arguments Examples

View source: R/createProfile.R

Usage

1
createProfile(response)

Arguments

response

Examples

 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
##---- 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 (response) 
{
    cat("Which candidate's data do you want to load:", "\n")
    response <- readline(prompt = "Candidates Name:")
    profile <- list(profname = response, filename = NULL, text = NULL, 
        emot = NULL)
    for (name in response) {
        pattern <- as.character(name)
        profile$filename <- list.files(pattern = pattern)
        for (i in 1:length(profile$filename)) {
            temp <- read.csv(profile$filename[i], header = TRUE)
            profile$text[i] <- paste0(temp$Text, collapse = ".")
            centex <- centerText_2(paste0("I'm reading ", profile$profname, 
                "'s speech >>>>>>>>>>>>  ", round(i/length(profile$filename) * 
                  100, 2), "%", "  >>>>>>>>>>>>>>>>>"))
            cat("\r", centex$ws, centex$mid, sep = "")
            Sys.sleep(0.2)
        }
    }
    cat("\n")
    invisible(return(profile))
  }

pingqingsheng/Robot0001 documentation built on May 5, 2019, 5:53 p.m.