Open aurelberra opened 3 years ago
We'd need to see your complete code and output to know what is happening here, including your package version numbers. Can you add those please?
Of course. I am using the latest versions. Here is a minimal example.
The text is the Iliad, and the keyword is Achilles' name.
library(quanteda, quanteda.textplots)
test <-
read_lines("data/homer/homer_perseus_lem/iliad_perseus_lem_books.txt")
test <- corpus(test)
test <- tokens(test)
kwic(test, pattern = "ἀχιλλεύς") |>
textplot_xray()
The environment is the following:
R.version.string
[1] "R version 4.1.1 (2021-08-10)"
RStudio.Version()$version
[1] ‘1.4.1717’
Sys.info()
sysname "Darwin" release "20.6.0" version "Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64"
pacman::p_loaded() %>%
sort() %>%
map(~ paste0(., " v", pacman::p_version(.))) %>%
str_match_all("quanteda.*") %>%
unlist()
[1] "quanteda v3.1.0" "quanteda.textplots v0.94"
The output is a normal graph in RStudio's "Plots" pane and this warning in the console:
Warning message: Use of
x$ntokens
is discouraged. Usentokens
instead.
Can you supply a link to iliad_perseus_lem_books.txt
so I can try to reproduce this warning?
I could, but I thought an even simpler example would be an easier way for you to test. I have the same warning with the following code:
library(tidyverse)
library(quanteda)
library(quanteda.textplots)
test <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit."
test <- corpus(test)
test <- tokens(test)
kwic(test, pattern = "ipsum") |>
textplot_xray()
I get this in the console:
Warning message: Use of
x$ntokens
is discouraged. Usentokens
instead.
Thanks, got it. I'll track it down and stop the warning shortly.
To use an older script I am learning about the 3.0 version of
quanteda
and its companion packages.I see that
textplot_xray.R
raises the following warning:Leaving an issue here, although I am sure you will at some point update your code.