Skip to contents

Convert a long data frame to a wide matrix, with time along the row dimension and locations along the column dimension. Values in the matrix could be e.g. the observed counts or the population.

Usage

df_to_matrix(df, time_col = 1, location_col = 2, value_col = 3)

Arguments

df

A data frame with at least 3 columns.

time_col

Integer or string that specifies the time column.

location_col

Integer or string that specifies the location column.

value_col

Integer or string that specifies the value column.

Value

A matrix with time on rows and locations on columns.