For achieving that in R programming, there are two ways. Either you can use the dplyr package:
df %>%
group_by(Clientid) %>%
summarise(Number_of_sessions = n())
# Clientid Number_of_sessions
# <int> <int>
# 1 1 2
# 2 2 3
Or you can use aggregate() in the R base:
aggregate(Sessionid ~ Clientid, df, length)
The data frame is:
structure(list(Sessionid = 1:5, Clientid = c(1L, 1L, 2L, 2L,
2L)), class = "data.frame", row.names = c(NA, -5L)) -> df