plt_timeserie: Plot time series data for a variable from the Entrance Data...

Description Usage Arguments Examples

View source: R/plt_timeserie.R

Description

Plot time series data for a variable from the Entrance Data set. The observations for different regional units are displayed in different colors. The plot can be saved as png and printed in the R Studio plot window.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
plt_timeserie(
  VarName,
  data = EntrancesData,
  years = "all",
  nuts_ids = "all",
  print_plot = TRUE,
  save_png = TRUE,
  legend_labels = "default",
  folder_for_png = "Plots",
  NUTS_level = "all"
)

Arguments

VarName

character string o with the name of the variable which shall be plotted.

data

data_frame containing the data you want to use. It must contain a column called year containing the years of the observation, a column called value containing the variable values and a column called NUTS_ID with regional IDs. Default is the EntrancesData dataset.

years

integer vector containing all years for which the data should be plotted. Default is all years contained in the dataset

nuts_ids,

sting vector with NUTS IDs which should be plotted. Default is "all", selecting all NUTS IDs in the dataset for plotting.

print_plot

logical, if TRUE, the plot is displayed in the Plot window

save_png

logical, if TRUE, a png of the plot is saved.

legend_labels,

vector with legend labels, if set to "default", NUTS_IDs are used. Default is "default", If you have more than 11 legend labels, you must use default. Must have the same number of elements as nuts_ids.

folder_for_png

string, name of the folder in the working directory where a picture of the plots should be saved. folder="wd" saves plots directly in the working directory. Default is the folder Plots in the working directory. If the folder doesn't exist, the function creates a new folder in the working directory.

NUTS_level

string, plots data only for a specific NUTS level. default is "all", so all data is plotted. Other possible inputs: "NUTS3", "NUTS2","NUTS1","NUTS country"

Examples

1
plt_timeserie(VarName="pop", data=EntrancesData, years=c(2000:2020), nuts_ids=c("IT", "PL", "RO"), print_plot=TRUE, save_png=FALSE, legend_labels=c("Italy","Poland","Romania"), folder_for_png="Plots", NUTS_level="all")

THartl1/EntrancesDataPackage documentation built on Dec. 18, 2021, 4:01 p.m.