R won't recognize a column referenced within a function when I use %>% after my last function.
I am trying to create a new dataframe named "class_" from my "Financial_Security_Survey" where I use the count() and then group_by() functions connected by %>%.
It recognizes the first column, but not the second. (I have tried switching the two functions, having group_by and then count(), and it is always the column in the second function.)
Additionally, before having this problem, R was saying it didn't know what the %>% function was, even though I had dpylr loaded, but it somehow recognized it after I reloaded the project.
This exact code worked for me yesterday, I even have the photo of the graph I made with this dataframe saved on my computer, so I'm in a pickle.
library(dplyr)
library(ggplot2)
Financial_Security_Survey <- read.csv("Financial Security Survey.csv")
names(Financial_Security_Survey)<-c("time","class","parents","insec","debt","more","worried","job","hours","absent","job_abs","sympathy","job_disadv","finance_stress","parent_adv","parent_how","something","other")
class_<-Financial_Security_Survey %>% count(parents) %>% group_by(class)