본문 바로가기
Programming/Google Data Analytics Certificate

R

by 그렉그의 2023. 4. 5.

install.packages("ggplot2") install.packages("palmerpenguins") library(ggplot2) library(palmerpenguins) data(penguins) View(penguins) ggplot(data= penguins) + geom_point(mapping = aes(x=flipper_length_mm, y =body_mass_g)) ggplot(data = penguins) + geom_point(mapping = aes(x= bill_length_mm, y=bill_depth_mm, color = species)) + facet_wrap(~species) hotel_bookings <-read.csv("hotel_bookings.csv") head(hotel_bookings) ggplot(data=hotel_bookings) + geom_point(mapping=aes(x = lead_time, y = children))+ facet_wrap(~species) ggplot(data = hotel_bookings) + geom_bar(mapping = aes(x=distribution_channel)) ggplot(data = hotel_bookings) + geom_bar(mapping = aes(x=distribution_channel, fill = deposit_type)) ggplot(data = hotel_bookings) + geom_bar(mapping = aes(x=distribution_channel, fill = market_segment)) ggplot(data = hotel_bookings) + geom_bar(mapping = aes(x=distribution_channel))+ facet_wrap(~deposit_type) ggplot(data = hotel_bookings) + geom_bar(mapping = aes(x=distribution_channel))+ facet_wrap(~deposit_type) + theme(axis.text.x = element_text(angle = 45)) ggplot(data = hotel_bookings) + geom_bar(mapping = aes(x=distribution_channel))+ facet_wrap(~market_segment) + theme(axis.text.x = element_text(angle = 45)) ggplot(data = hotel_bookings) + geom_bar(mapping = aes(x=distribution_channel))+ facet_wrap(~deposit_type) + theme(axis.text.x = element_text(angle = 45)) ggplot(data = hotel_bookings) + geom_bar(mapping = aes(x=distribution_channel))+ facet_grid(~deposit_type) + theme(axis.text.x = element_text(angle = 45)) ggplot(data = hotel_bookings) + geom_bar(mapping = aes(x=distribution_channel))+ facet_grid(~deposit_type~market_segment) + theme(axis.text.x = element_text(angle = 45)) ggplot(data = hotel_bookings) + geom_point(mapping = aes(x=lead_time, y = children, fill = market_segment)) ggplot(data= hotel_bookings) + geom_bar(mapping = aes(x=hotel)) + facet_wrap(~market_segment) onlineta_city_hotels <- filter(hotel_bookings,(hotel == 'City Hotel' & hotel_bookings$market_segment == 'Online TA')) View(onlineta_city_hotels)