Skip to content

Instantly share code, notes, and snippets.

@verajosemanuel
Last active November 14, 2017 08:36
Show Gist options
  • Save verajosemanuel/3050e2df5fdc3d0a930102eaa750ffff to your computer and use it in GitHub Desktop.
Save verajosemanuel/3050e2df5fdc3d0a930102eaa750ffff to your computer and use it in GitHub Desktop.
get a numerical ID from Data Frame in order to insert into Database as autoincrement #R #tibble #wrangling
require(tibble)
# if nrow is numerical
df <- rownames_to_column(df, var = "id")
# if nrow is not numerical
df$id <- seq.int(nrow(df))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment