I have code below like this:
act[,-c(1,2)]%>%
mutate(Cluster = km$cluster) %>%
group_by(Cluster) %>%
summarise_all("mean")
and here is the results.
# A tibble: 3 x 12
Cluster sleep_PersonalActivity PaidWorking Studying Transport UnpaidWorking Socializing
<int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 1 10.0 3.84 0 1.19 3.23 0.931
2 2 11.1 2.07 1.62 1.12 1.43 0.918
3 3 11.1 0.639 0 0.917 3.43 1.00
# ... with 5 more variables: CivicReligious <dbl>, Sport <dbl>, ActiveLeisure <dbl>,
# PassiveLeisure <dbl>, Others <dbl>
The data frame has 9 variables:
sleep_PersonalActivity, PaidWorking, Studying, Transport, UnpaidWorking, Socializing, CivicReligious, Sport, ActiveLeisure,PassiveLeisure, Others.
How can I let R shows all variable in result? Do I need adjust tibble size? if so, how should I do? Thanks for all help.
It is because of the print
settings for tibble
. We can specify the width
to Inf
print(out, width = Inf)
where
out <- act[,-c(1,2)]%>%
mutate(Cluster = km$cluster) %>%
group_by(Cluster) %>%
summarise_all("mean")
There won't be any issue in View(out)
ing the output or if we convert to data.frame
with as.data.frame