Skip to content

Instantly share code, notes, and snippets.

@hilaryparker
Created August 25, 2014 18:23
Show Gist options
  • Save hilaryparker/3df60a34ecb13a6a18f6 to your computer and use it in GitHub Desktop.
Save hilaryparker/3df60a34ecb13a6a18f6 to your computer and use it in GitHub Desktop.
how I make results dataframes
results <- tbl_df(as.data.frame(matrix(nrow=length(users), ncol=2)))
# what I would love
create_tbl_df(nrow=length(users), ncol=2)
@gshotwell
Copy link

If you don't have a list of unique users then I would do it like this:

library(dplyr)
results<- DF %>%
  group_by(User) %>%
  summarise(col_name = NA)

Another option if you do have a unique user list is:

library(dplyr)
results<- data.frame(users) %>%
  mutate(col_name = NA)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment