Transposing in dplyr

I think you want tidyr rather than dplyr: Using this, you can specify your groupings – and you can add on select(-group) to remove them later.

How can I change the name of a data frame

The truth is that objects in R don’t have names per-se. There exists different kinds of environments, including a global one for every process. These environments have lists of names, that point to various objects. Two different names can point to the same object. This is best explained to my knowledge in the environments chapter … Read more

Get dplyr count of distinct in a readable way

How about this option: Use filter to filter out any rows where aa has NAs, then group the data by column bb and then summarise by counting the number of unique elements of column aa by group of bb. As you can see I’m making use of the pipe operator %>% which you can use to “pipe” or “chain” commands together when using dplyr. This helps … Read more

dplyr mutate with conditional values

Try this: giving: or this: giving: Note Suggest you get a better name for your data frame. myfile makes it seem as if it holds a file name. Above used this input: Update 1 Since originally posted dplyr has changed %.% to %>% so have modified answer accordingly. Update 2 dplyr now has case_when which provides another solution: