df=data.frame(Name=c("leonard","andrey","richard","john"), #initial data
Func=c("FUNC1","FUNC2","FUNC3","FUNC1"))
df=split(df,df$Func) # split by Func column
sapply(df,function(x){length(df$x)}) # error here attempt 1
sapply(df,function(x){nrow(df$x)}) # error attempt 2 give NULL result
I would like to know the number of observations that exist in each data.frame in this list
Expected output:
> data.frame(FUNC1=2,FUNC2=1,FUNC3=1)
func1 func2 func3
2 1 1