Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pivot_wide #16

Open
temospena opened this issue Jun 9, 2020 · 2 comments
Open

add pivot_wide #16

temospena opened this issue Jun 9, 2020 · 2 comments

Comments

@temospena
Copy link
Owner

dar o exemplo dos modos de transporte por município

TRIPSmodemunicipio = TRIPSmode %>% pivot_wider(id_cols = c(1,2), names_from = modo, values_from = viagens)
#cols 1 e 2= origem e destino
TRIPSmodemunicipio[is.na(TRIPSmodemunicipio)] = 0
@temospena
Copy link
Owner Author

e também pivot_longer, para por exemplo transformar matrizes em long_format

@temospena
Copy link
Owner Author

e em matrix de viagens, com o stplarn

TRIPSfreglx_matrix <- stplanr::od_to_odmatrix(TRIPSfreglxtodas_long[3:5]) #O, D, count
TRIPSfreglx_matrix[is.na(TRIPSfreglx_matrix)] = 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant