It seems that some users are having problems and others (like me) do not.
This answer should not solve the problem, it only serves to show which output I get.
library(gtrendsR)
gtrend1 <- gtrends("Futebol",
geo = "BR",
hl = "pt-BR",
time = "2018-04-28 2018-05-04")
gtrend1
#$`interest_over_time`
# date hits keyword geo gprop category
#1 2018-04-28 01:00:00 65 Futebol BR web 0
#2 2018-04-29 01:00:00 100 Futebol BR web 0
#3 2018-04-30 01:00:00 43 Futebol BR web 0
#4 2018-05-01 01:00:00 55 Futebol BR web 0
#5 2018-05-02 01:00:00 58 Futebol BR web 0
#6 2018-05-03 01:00:00 48 Futebol BR web 0
#7 2018-05-04 01:00:00 43 Futebol BR web 0
#
#$interest_by_country
#NULL
#
#$interest_by_region
#NULL
#
#$interest_by_dma
#NULL
#
#$interest_by_city
#NULL
#
#$related_topics
#NULL
#
#$related_queries
#NULL
#
#attr(,"class")
#[1] "gtrends" "list"
When I downloaded the file "multiTimeline.csv"
and the li gave this:
fute <- read.csv("multiTimeline.csv", skip = 2)
str(fute)
#'data.frame': 52 obs. of 2 variables:
# $ Semana : Factor w/ 52 levels "2017-05-14","2017-05-21",..: 1 2 3 4 5 6 7 8 9 10 ...
# $ futebol...Brasil.: int 53 55 51 61 64 63 58 61 69 68 ...
head(fute)
# Semana futebol...Brasil.
#1 2017-05-14 53
#2 2017-05-21 55
#3 2017-05-28 51
#4 2017-06-04 61
#5 2017-06-11 64
#6 2017-06-18 63
Editing.
Following the @r_rabbit comment I tried without hl = "pt-BR"
and some of the terms appear in English and others in Portuguese. It follows the code and the content of gtrend2$related_topics
format dput
.
gtrend2 <- gtrends("Futebol",
geo = "BR",
time = "2018-04-28 2018-05-04")
gtrend2$related_topics <-
structure(list(subject = c("100", "24", "7", "7", "6", "6", "4",
"3", "3", "2", "2", "2", "2", "2", "1", "1", "1", "1", "1", "1",
"1", "+150%", "+70%", "+40%"), related_topics = c("top", "top",
"top", "top", "top", "top", "top", "top", "top", "top", "top",
"top", "top", "top", "top", "top", "top", "top", "top", "top",
"top", "rising", "rising", "rising"), value = c("Soccer", "Vivo",
"Santos FC", "São Paulo FC", "Player", "Footballer", "Futebol Interior",
"Ball", "Association", "Botafogo de Futebol e Regatas", "Ball",
"American football", "Team", "Football in Brazil", "Stadium",
"Northeast Region, Brazil", "Santa Cruz Futebol Clube", "Campeonato Baiano",
"Campeonato Paulista", "Brazil national football team", "FIFA",
"FIFA", "Stadium", "Campeonato Baiano"), geo = c("BR", "BR",
"BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR",
"BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR"
), keyword = c("Futebol", "Futebol", "Futebol", "Futebol", "Futebol",
"Futebol", "Futebol", "Futebol", "Futebol", "Futebol", "Futebol",
"Futebol", "Futebol", "Futebol", "Futebol", "Futebol", "Futebol",
"Futebol", "Futebol", "Futebol", "Futebol", "Futebol", "Futebol",
"Futebol"), category = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L)), row.names = c(NA,
-24L), reshapeLong = list(varying = structure(list(value = "top"), v.names = "value", times = "top"),
v.names = "value", idvar = "id", timevar = "related_topics"), class = "data.frame")
You’ve only tried
"pt"
without theBR
?– Willian Vieira
tried yes. It also didn’t work. Returns as "NULL"
– r_rabbit
Is not
pt_BR
? With_
, nay-
.– Rui Barradas
Rui, grateful for the suggestion, but it’s not, no. Error: "hl %in% language_codes$code is not TRUE". I’m thinking maybe it’s some configuration of my computer.
– r_rabbit
With me it works, there is no error. Already tried to close the R and restart?
– Rui Barradas
That’s funny. The argument
hl = "pt-BR"
doesn’t work for me either. In fact, the onlyhl
that works for me ishl = "en"
, but then it returns the results only in English.– Marcus Nunes
I confirm the problem with hl = "en-br". If I go on Trends, i see the result in English. But when I download the csv file, I get the same result as gtrendsR.
– Marcos Banik