I want to convert the data from the table into a data frame using R, and I also want to recreate the figure below using R.
Table with data and the figure
This is the code I have so far. I have created the data frame but I can't figure out how to recreate the graph.
Householders <- c("Householders under 25","Householders 25 to 44", "Householders 45 to 64","Householders 65+") MedianHouseholdIncome<-c(21835,38317,40424,23763) MarginOfError <- c(3695,1609,2327,1592) df<- data.frame(Householders,MedianHouseholdIncome,MarginOfError) df$Householders <- as.factor(df$Householders) names(df)[2] <- "Median Household Income($)" names(df)[3] <- "Margin of Error($)" View(df)
https://stackoverflow.com/questions/66847800/convert-the-data-from-the-table-below-into-a-data-frame-in-r-and-also-recreate March 29, 2021 at 09:42AM
没有评论:
发表评论