This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gsub("rt", "", x) # remove Retweet | |
| gsub("@\\w+", "", x) # remove at(@) | |
| gsub("[[:punct:]]", "", x) # remove punctuation | |
| gsub("[[:digit:]]", "", x) # remove numbers/Digits | |
| gsub("http\\w+", "", x) # remove links http | |
| gsub("[ |\t]{2,}", "", x) # remove tabs | |
| gsub("^ ", "", x) # remove blank spaces at the beginning | |
| gsub(" $", "", x) # remove blank spaces at the end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tm) | |
| # File name | |
| filename = "./data/ICHE6.PDF" | |
| # Read the PDF file | |
| doc <- readPDF(control = list(text = "-layout"))(elem = list(uri = filename),language = "en",id = "id1") | |
| # Here's how it works | |
| ## ReadPDF returns a function | |
| fun <- readPDF(control = list(text= "-layout")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Feigenbaum.R | |
| library(compiler) ## requires R >= 2.13.0 | |
| logistic.map <- function(r, x, N, M){ | |
| ## r: bifurcation parameter, x: initial value | |
| ## N: number of iterations, M: iterations to be returned | |
| z <- 1:N | |
| z[1] <- x | |
| for(i in c(1:(N-1))){ | |
| z[i+1] <- r *z[i] * (1 - z[i]) | |
| } |