plot2Earth: plot2earth

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Plots tweets location and created time on Google Earth.

Usage

1
2
3
4
5
plot2earth(df, longitude, latitude, date.time, labels, size, colour,
  colour.scale = plotKML::SAGA_pal[[1]],
  shape = "http://maps.google.com/mapfiles/kml/pal2/icon18.png",
  open = TRUE, kmz = FALSE, file.name = "tweets2earth.kml",
  folder.name = getwd(), ...)

Arguments

df

Required. data.frame of tweets to plot.

longitude

Required. Column holding longitude.

latitude

Required. Column holding latitude.

date.time

Required. Column including creation time of tweets; POSIXct format

labels

Required. Column holding labels.

size

Required. Column holding desired size of points.

colour,

optional. Column name that determines colours of points.

colour.scale,

optional, defaults to plotKML::SAGA_pal[[1]]. can be pallettes from R_pal (data(R_pal)), SAGA_pal (see default), from RColorBrewer (see example) or a vector of colors (hex) i.e.(c("#EE6A50", "#E8F9FE", "#6495ED"))

shape,

optional. Shape to use for points. Defaults to http.../icon18.png

open,

optional. Whether to open file in Google Earth. Defaults to TRUE.

kmz

Whether to also save the file as .kmz, defaults to FALSE

file.name

Name of kml or kmz file, defaults to tweets2earth.kml

folder.name

Name of folder where to save the kml or kmz file, defaults to getwd

...

Arguments to pass to kml function. See kml

Details

Takes data.frame of tweets and plots coordinates on Google Earth, also includes time variable (date.time). Choose size, colour and labels of your liking.

Value

Writes kml file and, optionally, opens it in Google Earth (open = TRUE).

Author(s)

John Coene, jcoenep@gmail.com

See Also

\codestream2earth

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
library(twitteR)

# setup oauth 
setup_twitter_oauth(consumer_key, consumer_secret, access_token=your_token, 
                    access_secret=your_secret)

# search twitter
tweets <- searchTwitter("rstats", n = 2000, lang= "en",
                        geocode="34.052235,-118.243683,100mi")

# unlist
tw.df <- do.call("rbind", lapply(tweets, as.data.frame))

plot2earth(tw.df, "longitude", "latitude", "created", 
           "screenName", "retweetCount", "favorited", 
           colour.scale = colour.scale = RColorBrewer::brewer.pal(8, "BuPu"),
           file.name = "rstats.kml")

## End(Not run)

JohnCoene/tweets2earth documentation built on May 7, 2019, 11:59 a.m.