Closed flavio-carvalho closed 7 years ago
**termos <- obtem_vetor(arquivo)
termos[25] [1] "arthouse" (table(termos))[25] and 20 (data.frame(termos)) termos 1 films 2 adapted 3 from 4 comic 5 books 6 have 7 had 8 plenty 9 of 10 success 11 whether 12 they're 13 about 14 superheroes 15 batman 16 superman 17 spawn 18 or 19 geared 20 toward 21 kids 22 casper 23 or 24 the 25 arthouse** termos [1] "films" "adapted" "from" [4] "comic" "books" "have" [7] "had" "plenty" "of" [10] "success" "whether" "they're" [13] "about" "superheroes" "batman" [16] "superman" "spawn" "or" [19] "geared" "toward" "kids" [22] "casper" "or" "the" [25] "arthouse" "crowd" "ghost" typeof(termos) [1] "character" typeof(table(termos)) [1] "integer" typeof(data.frame(termos)) [1] "list"
termos[25] [1] "arthouse" (table(termos))[25] and 20
(data.frame(termos)) termos 1 films 2 adapted 3 from 4 comic 5 books 6 have 7 had 8 plenty 9 of 10 success 11 whether 12 they're 13 about 14 superheroes 15 batman 16 superman 17 spawn 18 or 19 geared 20 toward 21 kids 22 casper 23 or 24 the 25 arthouse**
termos [1] "films" "adapted" "from" [4] "comic" "books" "have" [7] "had" "plenty" "of" [10] "success" "whether" "they're" [13] "about" "superheroes" "batman" [16] "superman" "spawn" "or" [19] "geared" "toward" "kids" [22] "casper" "or" "the" [25] "arthouse" "crowd" "ghost"
typeof(termos) [1] "character" typeof(table(termos)) [1] "integer" typeof(data.frame(termos)) [1] "list"
**Da função abaixo: obtem_vetor <- function(f,lower=FALSE,min_len=2) { vetor <- scan(f, sep="", what=character(),quote="")
if(lower) { vetor <- tolower(vetor) } return(vetor[nchar(vetor)>=min_len]) }
Ok, adiante...
**termos <- obtem_vetor(arquivo)
**Da função abaixo: obtem_vetor <- function(f,lower=FALSE,min_len=2) { vetor <- scan(f, sep="", what=character(),quote="")
if(lower) { vetor <- tolower(vetor) } return(vetor[nchar(vetor)>=min_len]) }