zoukankan      html  css  js  c++  java
  • R(week 15)

    library(tidyverse)
    install.packages("nycflights13")
    library(nycflights13)
    library(lubridate)
    
    dailyFlight <- flights %>%
      mutate(date = make_date(year, month, day)) %>%
      group_by(date) %>%
      summarise(n = n())
    
    dailyFlight2 <- dailyFlight %>%
      mutate(weekDay = wday(date, label = TRUE, locale = "English"))
    
    View(dailyFlight2)
    
    ggplot (dailyFlight2, aes(weekDay, n)) + geom_boxplot()
    
    dailyFlight2$weekDay <- as.factor(dailyFlight2$weekDay)
    ggplot(dailyFlight2, aes(x = date, y = n, col = weekDay)) + 
      geom_point() +
      geom_line() +
      scale_x_date(NULL, date_breaks = "1 month", 
                   date_labels = "%b")
    
    delayFlights <- flights %>%
      group_by(origin, dest) %>%
      summarise(count = n(), dist = mean(distance, na.rm = TRUE), 
                delay = mean(arr_delay, na.rm = TRUE)) %>%
      filter(count > 20)
    
    ggplot(data = delayFlights) + geom_point(mapping = aes(x = dist, y = delay)) +
      geom_smooth(mapping = aes(x = dist , y = delay))
    

      

  • 相关阅读:
    js把日期字符串转换成时间戳
    JS array 数组
    for循环中的if嵌套
    第三章:图像增强
    直方图均衡化
    第二章:数字图像处理基础
    马赫带效应
    图片格式
    4邻接,8邻接和m邻接
    第一章:绪论
  • 原文地址:https://www.cnblogs.com/sineagle/p/14859932.html
Copyright © 2011-2022 走看看