eeshanC
Re:Homogenization of scientific computing – Python is eating other lan...
on Friday January 10, 2014 @02:40AM (#7035567)
True that. But there is also another side to this story, where such nested calls translates naturally to what we are thinking, i.e.
length(unique(text)) comes from the thought "How many(length()) unique (unique()) words are there in this text(text)?"
Re:Homogenization of scientific computing – Python is eating other lan...
on Friday January 10, 2014 @02:17AM (#7035496)
Very clean. 1 small change to make it count of frequencies-
table(scan('test.txt',character(),sep=" "))
Re:Homogenization of scientific computing – Python is eating other lan...
on Friday January 10, 2014 @02:12AM (#7035484)
I'd like to jump in with a little R here- it not all that difficult in "that" either!
open(con <- file('text.txt'))
text = readLines(con, n= -1L) # n is number of lines to read, -1L means read all of it
words = strsplit(text,split = " ")
counts = table(unlist(words))
I put this in because the good thing about R is that it provides functions for many such mathematical operations. And along with this, I'll say something any self-respecting pythoner will know- Less is better than more.