forked from quanteda/quanteda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocnames.Rd
48 lines (41 loc) · 1.28 KB
/
docnames.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/docnames.R
\name{docnames}
\alias{docnames}
\alias{docnames<-}
\title{Get or set document names}
\usage{
docnames(x)
docnames(x) <- value
}
\arguments{
\item{x}{the object with docnames}
\item{value}{a character vector of the same length as \code{x}}
}
\value{
\code{docnames} returns a character vector of the document names
\code{docnames <-} assigns new values to the document names of an object.
docnames can only be character, so any non-character value assigned to be a
docname will be coerced to mode `character`.
}
\description{
Get or set the document names of a \link{corpus}, \link{tokens}, or \link{dfm} object.
}
\examples{
# get and set doument names to a corpus
corp <- data_corpus_inaugural
docnames(corp) <- char_tolower(docnames(corp))
# get and set doument names to a tokens
toks <- tokens(data_corpus_inaugural)
docnames(toks) <- char_tolower(docnames(toks))
# get and set doument names to a dfm
dfmat <- dfm(data_corpus_inaugural[1:5])
docnames(dfmat) <- char_tolower(docnames(dfmat))
# reassign the document names of the inaugural speech corpus
docnames(data_corpus_inaugural) <- paste("Speech", 1:ndoc(data_corpus_inaugural), sep="")
}
\seealso{
\code{\link{featnames}}
}
\keyword{corpus}
\keyword{dfm}