But I have not heard of RPubs before. I wonder what kinds of things people post to Rpubs?
I am a developmental psychologist at UNSW. My picture is refusing to load.
Challenge 1:
Emi has challenged us to find this data
http://www.statsci.org/data/oz/soap.txt
And correct the last entry from 6 to 4
I imported the data using datapasta.
library(datapasta)
soapdata <- data.frame(stringsAsFactors=FALSE,
Date = c("30Aug99", "31Aug99", "3Sept99", "4Sept99", "5Sept99",
"6Sept99", "7Sept99", "8Sept99", "10Sept99", "11Sept99",
"16Sept99", "18Sept99", "19Sept99", "20Sept99", "21Sept99"),
Day = c(0L, 1L, 4L, 5L, 6L, 7L, 8L, 9L, 11L, 12L, 17L, 19L, 20L, 21L,
22L),
Weight = c(124L, 121L, 103L, 96L, 90L, 84L, 78L, 71L, 58L, 50L, 27L, 16L,
12L, 8L, 6L)
)
soapdata %>%
ggplot(aes(x= Day, y=Weight)) +
geom_point()
I managed to get a graph, but how to correct a single value. Im not sure.
ggplot(iris) +
aes(Sepal.Length, Sepal.Width) +
geom_point() +
labs(x = "Sepal Length") +
labs(y = "Sepal width") +
labs(title = "famous iris data") +
labs(subtitle = "Data collected by anderson Edgar (1935") +
aes(color= Species) +
theme_bw(base_size=16)
ggplotly()
library(plotly)
plot_ly(iris,
x=~Sepal.Length,
y=~Sepal.Width,
color=~Species)
## No trace type specified:
## Based on info supplied, a 'scatter' trace seems appropriate.
## Read more about this trace type -> https://plot.ly/r/reference/#scatter
## No scatter mode specifed:
## Setting the mode to markers
## Read more about this attribute -> https://plot.ly/r/reference/#scatter-mode
Load the diamonds data and call it shiny
shiny <- diamonds
Plot price by carat only for small diamonds (less than 1 carat)
shiny %>%
filter(carat < 1) %>%
ggplot(aes(x= carat, y= price, colour = color)) +
geom_point()
Add ggplotly
shiny %>%
filter(carat < 1) %>%
ggplot(aes(x= carat, y= price, colour = color)) +
geom_point()
ggplotly()