I am trying to create a histogram for the wage variable
My code is
library(tidyverse)
library(broom)
library(dplyr)
df=read.csv("/Users/takonyabadza/Desktop/Assign6data.csv")
select(df, wage)
W<-data.frame(df)
ggplot(W, aes(x = wage)) + geom_histogram()
logW<-log(df$wage)
ggplot(logW, aes(x= logW)) + geom_histogram()
As there is an error message on the last line that says-
Error: data
must be a data frame, or other object coercible by fortify()
, not a numeric vector Run rlang::last_error()
to see where the error occurred.
How do i fix this?
Try this. Last line: I think it was typo: changed logW with W.
select(df, wage)
W<-data.frame(df)
ggplot(W, aes(x = wage)) + geom_histogram()
logW<-log(df$wage)
ggplot(W, aes(x= logW)) + geom_histogram()