r - ggplot within function can't find dataframe passed to function -
I have the following functions that I want to use in datasets to generate density histogram of various features: However, it works with qplot <('state', 'some_column_of_values') errors in excal (expro, envir, enclose): object 'hist_data' not found "State", "Fraud"), (hist_data & lt; - dataframe [, c (stat_col, fraud_col)] coln hist_data $ stat & lt; - winsor1 (hist_data $ stat) qplot (data = hist_data, x = stat, geom = "histogram", fill = as as ames (hist_data) & lt; -c ('stat', 'cheat') .factor (fraud), binwidth = 10, position = 'detection'}} Any thoughts that I can remember here? You should not have to specify the name.frame name in your fraudsplitHist & lt; - Function (dataframe, stat_col, sign_col = 'fraud') {hist_data & lt; - Data Frame [, C (stat_col, sign_col)] colnames (hist_data) & lt; - c ('stat', 'fraud') hist_data $ stat & lt; - winsor1 (hist_data $ stat) # Remove outliers ggplot (hist_data, AES (hist_data $ stat, fill = as.factor (hist_data $ fraud)) + geom_histogram (alpha = 0.5, AES (Y = .. density ..), This error always gives me this error by running
fraudSplitHist (dataframe = data, stat_col = '' = 'id =' detection ', binwidth = 1)}
AES () settings. You should use column names only from data. For example, this should work
simplest
Comments
Post a Comment