R - gtrends: ISO language code "pt" or "en-US" do not work?

2

. Guys, I'm using gtrends and I'd like to get the related "pt_BR" in Portuguese, but the "hl" argument of the gtrends function is not returning to Portuguese. Without the argument, it returns related topics in English. Would anyone have any tips? The code I'm using is

gtrend1 <- gtrends("Futebol", 
      geo = "BR",
      hl = "pt-BR",
      time = "2018-04-28 2018-05-04")
    
asked by anonymous 13.05.2018 / 13:35

1 answer

2

It seems that some users are having problems and others (like me) are not. This answer should not solve the problem, just to show what 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 li gave it:

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 comment from @r_rabbit I tried without hl = "pt-BR" and some of the terms appear in English and others in Portuguese. It follows the code and contents of gtrend2$related_topics in dput format.

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")
    
14.05.2018 / 10:45