Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 183 additions & 0 deletions Data_manipulation_dplyr.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Data_manipulation_dplyr.ipynb",
"provenance": [],
"authorship_tag": "ABX9TyMyWCKn/wUyB8R7rUv8tLeV",
"include_colab_link": true
},
"kernelspec": {
"name": "ir",
"display_name": "R"
},
"language_info": {
"name": "R"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/Prasannas544/PepBoard/blob/master/Data_manipulation_dplyr.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "SNaOiM05OYAV"
},
"outputs": [],
"source": [
"install.packages('tidyverse') \n",
"install.packages('nycflights13')\n",
"library(tidyverse) # This will include the \"dplyr\" package\n",
"library(nycflights13) #Contains the datasets that we are going to work on\n"
]
},
{
"cell_type": "code",
"source": [
"flights=flights\n",
"airlines<-airlines"
],
"metadata": {
"id": "cZjMD0agOqSj"
},
"execution_count": 4,
"outputs": []
},
{
"cell_type": "code",
"source": [
"flights %>%\n",
"dplyr::filter(month==1|month==2,day==1)"
],
"metadata": {
"id": "MWpyF6FRS6LA"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"\n",
"flightsFiltered <- flights %>% \n",
"dplyr::filter(month %in% c(11,12)) %>%\n",
"dplyr::filter(dep_time >= 700) %>%\n",
"dplyr::filter(carrier!=\"UA\")\n",
"flightsFiltered"
],
"metadata": {
"id": "dxh9CwimTHdP"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"flightsArranged <- flightsFiltered %>% \n",
"arrange(year,month,day,desc(dep_delay))\n",
"flightsArranged"
],
"metadata": {
"id": "K0AOgO8YY4LU"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"flightsSelected <- flightsArranged %>%\n",
"dplyr::select(-(hour:time_hour)) %>%\n",
"dplyr::select(-(sched_dep_time),-(sched_arr_time),-(tailnum)) %>%\n",
"dplyr::rename(\"airtime\"=\"air_time\",\"destination\"=\"dest\")\n",
"flightsSelected"
],
"metadata": {
"id": "M9QEpXSFclLQ"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"flightsMutated <- flightsSelected %>% \n",
"mutate(gain=dep_delay-arr_delay,\n",
" hours =airtime/60,\n",
" gain_per_hour=gain/hours)\n",
" flightsMutated"
],
"metadata": {
"id": "VUWKE49GeQrn"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"meanDelays <- flightsMutated %>%\n",
"group_by(carrier) %>% \n",
"dplyr::summarize(meanDelay=mean(dep_delay,na.rm=TRUE)) %>%\n",
"arrange(desc(meanDelay))\n",
"meanDelays"
],
"metadata": {
"id": "8zCktUuvhGkk"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"carrierCounts <- flightsMutated %>% \n",
"group_by(carrier) %>%\n",
" dplyr::summarize(count=n()) %>%\n",
" arrange(desc(count))\n",
" carrierCounts"
],
"metadata": {
"id": "8JypihCWjBNh"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"airlinesNames <- meanDelays %>%\n",
"left_join(airlines,by=c(\"carrier\"=\"carrier\")) %>%\n",
"dplyr::select(name,carrier,meanDelay)\n",
"airlinesNames"
],
"metadata": {
"id": "Pre-XxZTjnr5"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
""
],
"metadata": {
"id": "ICl_zx82l_Bm"
},
"execution_count": null,
"outputs": []
}
]
}
2 changes: 2 additions & 0 deletions dewqdwqd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fewfef
czcaca
44 changes: 0 additions & 44 deletions express.js

This file was deleted.

1 change: 1 addition & 0 deletions f1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.sadfasf
1 change: 1 addition & 0 deletions f2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sdasd
Empty file added f4.txt
Empty file.
25 changes: 0 additions & 25 deletions package.json

This file was deleted.

1 change: 1 addition & 0 deletions reset.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
reset fil hu me
2 changes: 2 additions & 0 deletions ye wala new hai
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
blah blah
meh meh