Hello everyone,
I'm writing a little script in Python which intends to sort a table of
word frequency in a text, using R functions from rpy package. I've got
my word list; when I use the R table function I obtain a list which
contains que frequencies, but *not* the word names:
#!/usr/bin/python
from rpy import *
...
file = open("input.txt")
filecontent = file.read()
filecontent = r.tolower(filecontent)
words = r.strsplit(filecontent, " ")
wordsvector = r.unlist(words)
table = r.table(wordsvector)
...
print table
print r.names(table)
[1. 1. 1. 2. 3.]
None
When I do something similar in R console, calling 'names(table)' returns
the name of the word for each frequency value. Why is this not going
that way in Python using rpy?
Thanks in advance,
--
Albert Meroño Peñuela
Institut de Dret i Tecnologia UAB
UAB Institute of Law and Technology
Political Science and Public Law Department
Campus UAB. Edifici B. Facultat de Dret
08193 Bellaterra. Barcelona. Spain.
Tel: +34 93 581 22 35
Fax: +34 93 581 29 88
http://idt.uab.es/
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
_______________________________________________
rpy-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list