I know the title isn't great, but it's hard to put into words what I am trying to do. What I'd like it s function that does something like this:
stats = function(twtdata) {
react = twtdata %>% select(favoriteCount, retweetCount)
X1 = mean(react$favoriteCount)
X2 = mean(react$retweetCount)
X3 = nrow(react)
}
twtdata is a string. I want X1 to be twtdataFavoriteCount, X2 to be twtdataRetweetCount and X3 to be twtdataTweets, where twtdata is the string being passed into the function, kind of like INNERJOIN in excel, or string concatenation.
If you are passing dataframe name as string try using
get
: