Closed briatte closed 11 years ago
Really appreciate your contributions here!
ggram(c("USSR", "Russia"),
year_start = 1900,
corpus = "eng_gb_2012",
geom = "area",
geom_options = list(position = "stack"),
ignore.case = TRUE)
This behaves OK now, albeit with lower case labels.
Just add labels = phrases
to the scale_colour_continuous
and scale_fill_continuous
parameters at lines 54-55 of ggram, and the uppercase will be back :)
Thanks...adapted this a bit so it works with aggregate=FALSE
.
Note: I have changed from ignore.case
to ignore_case
.
May I ask why that last change? ignore.case
shares similarity with the same argument in grepl
, so I would favour that name.
Good question! I used to use . a lot (a lot of older R functions use it to, grepl
being an example). More recently I have switched to Hadley Wickham's style and use _ instead. I don't think there is a single best answer and it is a controversial subject.
Okay. I was curious to know if there was any technical reason. I like the convention anarchy in R, so it's fine with me, but perhaps you could avoid users making mistakes by simply adding ignore.case = ignore_case
, which would then allow both argument names?
P.S. I'd like to add arguments to pass Ngram syntax to ngram
. Are you fine with this?
These would allow, for instance, to automatically consider all keywords as adjectives, as in blue_ADJ red_ADJ
.
I'll draft some code and submit it now if it works for you.
Good idea.
Latest push allows either ignore_case
or ignore.case
.
The discrete scale needs labels to be manually set to preserve upper case in the keywords. Here's an example: