Hi guys i am new to R,
While i have attached screenshot of the df i am working with (https://i.stack.imgur.com/CUz4l.png), here is a short description
I have a data frame with a total of 7 columns, one of which is a month column, rest of the 6 columns are (integer) values and these also have empty rows
Need to summarise by count of all the 6 columns and group them by month
tried the following code: group_by(Month) %>% summarise(count=n(),na.omit())
get the following error:
Error: Problem with summarise()
input ..2
.
x argument "object" is missing, with no default
i Input ..2
is na.omit()
.
i The error occurred in group 1: Month = "1".
Run rlang::last_error()
to see where the error occurred.
Can someone please assist?
[head of data][1] (https://i.stack.imgur.com/stfoG.png)
> dput(head(Dropoff))
structure(list(Start.Date = c("01-11-2019 06:07", "01-11-2019 06:07",
"01-11-2019 06:08", "01-11-2019 06:08", "02-11-2019 06:08", "02-11-2019 06:07"
), End.Date = c("01-11-2019 06:12", "01-11-2019 09:28", "01-11-2019 10:02",
"01-11-2019 13:05", "02-11-2019 06:13", "02-11-2019 06:16"),
Month = structure(c(3L, 3L, 3L, 3L, 3L, 3L), .Label = c("1",
"2", "11"), class = "factor"), nps = c(9L, 10L, 9L, 8L, 9L,
9L), effort = c(9L, 10L, 9L, 9L, 9L, 8L), knowledge = c(NA,
NA, 5L, NA, NA, 5L), confidence = c(5L, 5L, NA, NA, 5L, NA
), listening = c(NA, NA, NA, 5L, NA, NA), fcr = c(1L, 1L,
1L, 1L, 1L, 1L), fixing.issues = c(NA, NA, NA, NA, NA, NA
)), row.names = c(NA, 6L), class = "data.frame")
id like the output to look something like this
Month | count of nps | count of effort |
---|---|---|
1 | xxx | xxx |
2 | xxx | xxx |
11 | 6 | 6 |
....so on (count)for all the variables
the following
df%>% group_by(Month) %>% summarise(count=n())
provides this output [1]: https://i.stack.imgur.com/u3nxv.png this is not what i am hoping for