Reputation: 379
I would like to convert some numbers to words (so 5 becomes "five" etc). I am using english
library to create a vector of integers that have been transformed into words. However, when I try to access some elements of my vector (elements after 100), I receive the following error:
Error in UK && (d <- makeNumber(dvec)) > 0 : invalid 'x' type in 'x && y'
Here is my code:
library(english)
words <- as.english(c(1:1000))
words[999]
The aim is to access any element of a vector words
.
Upvotes: 3
Views: 60
Reputation: 887118
The english
class can be converted to character
as.character(words)[999]
#[1] "nine hundred ninety-nine"
The issue starts with 3 digit number onwards
words[100]
Error in UK && (d <- makeNumber(dvec)) > 0 : invalid 'x' type in 'x && y'
Checked for methods with [
grep('english', methods(`[`), value = TRUE)
#[1] "[.english"
So, there is an existing method to subset, but may be it is a bug
Upvotes: 3