Sto usando il pacchetto tm per calcolare la matrice del documento-termine per un set di dati, ora devo scrivere il termine-documento-matrice in un file ma quando uso le funzioni di scrittura in R sto ricevendo un errore.Scrivere una semplice matrice di terzine in un file?
Ecco il codice che sto usando e l'errore sto ottenendo:
data("crude")
tdm <- TermDocumentMatrix(crude, control = list(weighting = weightTfIdf, stopwords = TRUE))
dtm <- DocumentTermMatrix(crude, control = list(weighting = weightTfIdf, stopwords = TRUE))
e questo è l'errore, mentre io uso il comando write.table su questi dati:
Error in cat(list(...), file, sep, fill, labels, append) : argument 1 (type 'list') cannot be handled by 'cat'
Capisco che tbm è un oggetto di tipo Simple Triplet Matrix, ma come posso scriverlo in un semplice file di testo.
Grazie Tony e Shane! La soluzione mi ha aiutato alla grande! –
Non penso che funzioni più, 'non posso costringere classe ... a data.frame' – wordsforthewise
@wordsforthewise Funziona per me con Windows 7, R versione 3.4.3 e tm_0.7-3 –