I have multiple dataframes where I need to apply the same function (unique)
df1 = data.frame(Bird_ID = c(1:6,7,7,6,2,1))
df2 = data.frame(Bird_ID = c(1:10,7,7,6,2,1,10,9,3))
In each of the df I want to apply the following function to show me unique list of individuals:
individuals1 = data.frame(length(unique(df1[,1])))
individuals2 = data.frame(length(unique(df2[,1])))
Here we have 7 and 10 unique IDs. This is easy but the problem is that sometimes I have more than just 2 df. How can I apply the unique function to all dataframes and have 1 output dataframe that gives me the number of unique individuals per df like this:
output = data.frame(Index = c("Unique.ID"), df1 = c(7),df2=c(10))
#index df1 df2
#Unique.ID 7 10