| hits | R Documentation | 
Get hits for queries, optionally with s-attribute values.
hits(.Object, ...)
## S4 method for signature 'corpus'
hits(
  .Object,
  query,
  cqp = FALSE,
  check = TRUE,
  s_attribute,
  p_attribute = "word",
  size = FALSE,
  freq = FALSE,
  decode = TRUE,
  fill = FALSE,
  mc = 1L,
  verbose = TRUE,
  progress = FALSE,
  ...
)
## S4 method for signature 'character'
hits(
  .Object,
  query,
  cqp = FALSE,
  check = TRUE,
  s_attribute,
  p_attribute = "word",
  size = FALSE,
  freq = FALSE,
  decode = TRUE,
  mc = FALSE,
  verbose = TRUE,
  progress = FALSE,
  ...
)
## S4 method for signature 'subcorpus'
hits(
  .Object,
  query,
  cqp = FALSE,
  check = TRUE,
  s_attribute,
  p_attribute = "word",
  size = FALSE,
  freq = FALSE,
  fill = FALSE,
  decode = TRUE,
  mc = FALSE,
  progress = FALSE,
  verbose = TRUE,
  ...
)
## S4 method for signature 'partition'
hits(
  .Object,
  query,
  cqp = FALSE,
  check = TRUE,
  s_attribute,
  p_attribute = "word",
  size = FALSE,
  freq = FALSE,
  fill = FALSE,
  decode = TRUE,
  mc = FALSE,
  progress = FALSE,
  verbose = TRUE
)
## S4 method for signature 'partition_bundle'
hits(
  .Object,
  query,
  cqp = FALSE,
  check = TRUE,
  p_attribute = getOption("polmineR.p_attribute"),
  s_attribute,
  size = TRUE,
  freq = FALSE,
  mc = getOption("polmineR.mc"),
  progress = FALSE,
  verbose = TRUE,
  ...
)
## S4 method for signature 'context'
hits(.Object, s_attribute = NULL, verbose = TRUE, ...)
## S4 method for signature 'remote_corpus'
hits(.Object, ...)
## S4 method for signature 'remote_subcorpus'
hits(.Object, ...)
.Object | 
 A length-one   | 
... | 
 Further arguments (used for backwards compatibility).  | 
query | 
 A   | 
cqp | 
 Either a   | 
check | 
 A   | 
s_attribute | 
 A   | 
p_attribute | 
 A   | 
size | 
 A   | 
freq | 
 A   | 
decode | 
 A   | 
fill | 
 A   | 
mc | 
 A   | 
verbose | 
 A   | 
progress | 
 A   | 
If the character vector provided by query is named, these names will be
reported in the data.table that is returned rather than the queries.
If freq is TRUE, the data.table returned in the DT-slot will
deliberately include the subsets of the partition/corpus with no hits
(query is NA, count is 0).
A hits class object.
See the documentation of the hits class
(hits-class) for details.
use(pkg = "RcppCWB", corpus = "REUTERS")
# get hits for corpus object
y <- corpus("REUTERS") %>% hits(query = "oil")
y <- corpus("REUTERS") %>% hits(query = c("oil", "barrel"))
y <- corpus("REUTERS") %>% hits(query = "oil", s_attribute = "places", freq = TRUE)
# specify corpus by corpus ID
y <- hits("REUTERS", query = "oil")
y <- hits("REUTERS", query = "oil", s_attribute = "places", freq = TRUE)
# get hits for partition
p <- partition("REUTERS", places = "saudi-arabia", regex = TRUE)
y <- hits(p, query = "oil", s_attribute = "id")
# get hits for subcorpus
y <- corpus("REUTERS") %>%
  subset(grep("saudi-arabia", places)) %>%
  hits(query = "oil")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.