View source: R/read_and_format_files.R
read_fb_mobility_files | R Documentation |
This function reads all the .csv
files in a particular folder.
These files consistently contain identical columns,
with variations only in location, day, and time.
As a result,
we can uniformly apply specific formatting to columns across these files.
read_fb_mobility_files(path_to_csvs, colnames, coltypes, keep_format = NULL)
path_to_csvs |
Path to the folder where the |
colnames |
Columns to include in the results (as character).
For more information go to |
coltypes |
Column specifications (as strings). See vignette("readr", package = "readr") for more details. documentation. |
keep_format |
Vector of column names,
besides |
A data.frame with the information of all the files read.
format_fb_data
read_csv
files <- read_fb_mobility_files(
path_to_csvs = paste0(system.file("extdata",
package = "quadkeyr"
), "/"),
colnames = c( # The columns not listed here will be omitted
"lat",
"lon",
"quadkey",
"date_time",
"n_crisis",
"percent_change",
"day",
"hour"
),
coltypes = list(
lat = "d",
lon = "d",
quadkey = "c",
date_time = "T",
n_crisis = "c",
percent_change = "c",
day = "D",
hour = "i"
)
)
head(files)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.