words_to_numbers: words_to_numbers

Description Usage Arguments Value Examples

View source: R/words_to_numbers.R

Description

words_to_numbers takes a character string and replaces numbers written in words with numerics.

Usage

1

Arguments

string

a character string

Value

Returns a string with any detected numbers written as words replaced by numbers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
library(wordstonumbers)
words_to_numbers("ninety-nine red balloons")

words_to_numbers("twelve")

words_to_numbers("Forty-three thousand")

words_to_numbers("There were one thousand, two hundred and thirty. Twelve.")

example <-
"The PRQ is a twelve-item, four-point Likert scale
(from one = Never to four = Very Often) with three sub-scores
bullying (PRQ-Bully), being victimized (PRQgroup-Victim),
and pro-social behavior (PRQ-Prosocial). A translated,
backtranslated final Arabic version of the scale was found
to be accurate showing good internal consistency in this
sample [PRQ-Victim (alpha = .seventy four)
and PRQ-Bullies (alpha = seventy-four)]."

words_to_numbers(example)

fsingletonthorn/words_to_numbers documentation built on Nov. 19, 2020, 10:01 a.m.