--- /dev/null
+cat("\n","Enter textfile name","\n") # prompt
+y<-readLines(n=1)
+x <- paste("lord-hobo-cambridge.txt",sep="")
+d <- read.csv(x)[,c(1,2,3)]
+
+colnames(d) <- c("rating", "day.of.week", "day.in.review")
+d$day.in.review <- d$day.in.review == "True"
+
+d$day.of.week <- as.character(d$day.of.week)
+d$day.of.week[d$day.of.week == "0"] <- "Sunday"
+d$day.of.week[d$day.of.week == "1"] <- "Monday"
+d$day.of.week[d$day.of.week == "2"] <- "Tuesday"
+d$day.of.week[d$day.of.week == "3"] <- "Wednesday"
+d$day.of.week[d$day.of.week == "4"] <- "Thursday"
+d$day.of.week[d$day.of.week == "5"] <- "Friday"
+d$day.of.week[d$day.of.week == "6"] <- "Saturday"
+d$day.of.week <- factor(d$day.of.week, levels = c("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"))
+
+d$day.of.week <- as.factor(d$day.of.week)
+
+t <- table(d$day.of.week, as.factor(d$rating))
+t2 <- prop.table(t,2)
+chisq.test(d$day.of.week, as.factor(d$rating))
+
+# draw a graph
+library(ggplot2)
+v <- paste(y,"-baaaarplot.png",sep="")
+png(v, width=8, height=6, unit="in", res=200)
+p <- qplot(day.of.week, data=d, fill=as.factor(rating), main=y)
+#p <- qplot(levels(d$day.of.week),as.factor(names(d$rating)), t, data=data.frame(t,levels(d$day.of.week)))
+p <- p + scale_x_discrete("Day of Week") + scale_y_continuous("yelp # star review") + scale_fill_discrete("")
+print(p)
+dev.off()
+
+
+