Last chance! 50% off unlimited learning
Sale ends in
docvars(x, field = NULL)## S3 method for class 'corpus':
docvars(x, field = NULL)
docvars(x, field = NULL) <- value
## S3 method for class 'corpus':
docvars(x, field = NULL) <- value
## S3 method for class 'corpusSource':
docvars(x, field = NULL)
docvars
returns a data.frame of the document-level variablesdocvars<-
assigns value
to the named field
head(docvars(inaugCorpus))
docvars(inaugCorpus, "President") <- paste("prez", 1:ndoc(inaugCorpus), sep="")
head(docvars(inaugCorpus))
# alternative using indexing
head(inaugCorpus[, "Year"])
inaugCorpus[["President2"]] <- paste("prezTwo", 1:ndoc(inaugCorpus), sep="")
head(docvars(inaugCorpus))
Run the code above in your browser using DataLab