findwords <- function(tf) { # read in the words from the file, into a vector of mode character txt <- scan(tf,"") words <- split(1:length(txt),txt) return(words) } ## MM's "style": findwords <- function(tf) { # read in the words from the file, into a vector of mode character txt <- scan(tf, what="") ## 1:length(.) is nice to read but "dangerous" for programming split(seq_along(txt), txt) }