# Syntax Data 1 - Data Frame
university_ranking <- data.frame(
  world_rank = c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50), 
  institution = c("Harvard University","Massachusetts Institute of Technology","Stanford University","University of Cambridge","California Institute of Technology","Princeton University","University of Oxford","Yale University","Columbia University","University of California, Berkeley","University of Chicago","Cornell University","University of Pennsylvania","University of Tokyo","Johns Hopkins University","Swiss Federal Institute of Technology in Zurich","Kyoto University","Weizmann Institute of Science","University of California, Los Angeles","University of California, San Diego","Rockefeller University","Hebrew University of Jerusalem","New York University","University of California, San Francisco","University of Wisconsin–Madison","University of Illinois at Urbana–Champaign","Duke University","Imperial College London","University of Texas Southwestern Medical Center","University of Texas at Austin","University College London","Osaka University","Northwestern University","University of Michigan, Ann Arbor","University of Toronto","University of North Carolina at Chapel Hill","Washington University in St. Louis","University of Utah","University of Washington - Seattle","University of California, Santa Barbara","McGill University","Purdue University, West Lafayette","Carnegie Mellon University","University of Southern California","University of California, Davis","University of Colorado Boulder","University of California, Irvine","University of Paris-Sud","University of Minnesota, Twin Cities","University of Arizona"),
  country = c("USA","USA","USA","United Kingdom","USA","USA","United Kingdom","USA","USA","USA","USA","USA","USA","Japan","USA","Switzerland","Japan","Israel","USA","USA","USA","Israel","USA","USA","USA","USA","USA","United Kingdom","USA","USA","United Kingdom","Japan","USA","USA","Canada","USA","USA","USA","USA","USA","Canada","USA","USA","USA","USA","USA","USA","France","USA","USA"),
  national_rank = c(1,2,3,1,4,5,2,6,7,8,9,10,11,1,12,1,2,1,13,14,15,2,16,17,18,19,20,3,21,22,4,3,23,24,1,25,26,27,28,29,2,30,31,32,33,34,35,1,36,37),
  quality_of_education = c(7,9,17,10,2,8,13,14,23,16,15,21,31,32,34,26,42,4,62,61,1,24,89,101,64,82,65,84,19,101,35,77,101,68,101,101,74,92,101,101,70,95,30,101,79,83,101,48,101,101),
  alumni_employment = c(9,17,11,24,29,14,28,31,21,52,26,42,16,19,77,66,38,101,59,101,101,93,75,101,63,101,43,73,101,78,101,101,32,60,101,86,62,101,101,101,91,70,81,101,101,88,101,101,101,101),
  quality_of_faculty = c(1,3,5,4,7,2,9,12,10,6,8,14,24,31,20,11,19,22,23,15,16,13,17,21,33,18,55,35,32,27,45,44,101,101,34,56,101,41,40,28,54,49,26,63,92,48,38,25,85,88),
  publications = c(1,12,4,16,37,53,15,14,13,6,34,22,9,8,11,40,25,101,3,10,101,101,42,19,17,35,20,26,101,41,27,39,24,2,7,31,32,74,5,68,33,61,101,46,23,71,59,73,18,45),
  influence = c(1,4,2,16,22,33,13,6,12,5,20,21,10,19,9,51,36,67,11,8,28,91,24,3,30,71,15,26,43,47,23,44,25,17,14,29,18,52,7,72,39,101,101,48,40,54,57,96,31,42),
  citations = c(1,4,2,11,22,26,19,15,14,3,28,16,8,23,9,44,43,101,6,10,96,101,34,13,21,39,12,29,84,40,33,51,20,7,18,31,30,67,5,36,47,58,61,32,25,56,52,101,17,45),
  broad_impact = c(5,1,15,50,18,101,26,66,5,16,101,10,9,3,7,34,23,29,13,22,101,28,62,33,21,44,20,41,101,57,86,11,35,8,101,29,14,12,101,101,101,19,101,23,32,101,65,101,84,27),
  score = c(100,91.67,89.5,86.17,85.21,82.5,82.34,79.14,78.86,78.55,73.82,73.69,73.64,69.49,66.94,66.69,65.76,65.09,64.05,63.11,61.74,60.76,60.55,59.7,59.66,59,58.37,57.53,56.43,56.18,55.21,54.43,54.4,53.72,53.43,53.09,52.9,52.64,52.25,52.15,51.72,51.66,51.6,51.38,51.06,50.68,50.64,50.44,50.3,50.29),
  year = c(2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012,2012)
)

print(university_ranking)
##    world_rank                                     institution        country
## 1           1                              Harvard University            USA
## 2           2           Massachusetts Institute of Technology            USA
## 3           3                             Stanford University            USA
## 4           4                         University of Cambridge United Kingdom
## 5           5              California Institute of Technology            USA
## 6           6                            Princeton University            USA
## 7           7                            University of Oxford United Kingdom
## 8           8                                 Yale University            USA
## 9           9                             Columbia University            USA
## 10         10              University of California, Berkeley            USA
## 11         11                           University of Chicago            USA
## 12         12                              Cornell University            USA
## 13         13                      University of Pennsylvania            USA
## 14         14                             University of Tokyo          Japan
## 15         15                        Johns Hopkins University            USA
## 16         16 Swiss Federal Institute of Technology in Zurich    Switzerland
## 17         17                                Kyoto University          Japan
## 18         18                   Weizmann Institute of Science         Israel
## 19         19           University of California, Los Angeles            USA
## 20         20             University of California, San Diego            USA
## 21         21                          Rockefeller University            USA
## 22         22                  Hebrew University of Jerusalem         Israel
## 23         23                             New York University            USA
## 24         24         University of California, San Francisco            USA
## 25         25                 University of Wisconsin–Madison            USA
## 26         26      University of Illinois at Urbana–Champaign            USA
## 27         27                                 Duke University            USA
## 28         28                         Imperial College London United Kingdom
## 29         29 University of Texas Southwestern Medical Center            USA
## 30         30                   University of Texas at Austin            USA
## 31         31                       University College London United Kingdom
## 32         32                                Osaka University          Japan
## 33         33                         Northwestern University            USA
## 34         34               University of Michigan, Ann Arbor            USA
## 35         35                           University of Toronto         Canada
## 36         36     University of North Carolina at Chapel Hill            USA
## 37         37              Washington University in St. Louis            USA
## 38         38                              University of Utah            USA
## 39         39              University of Washington - Seattle            USA
## 40         40         University of California, Santa Barbara            USA
## 41         41                               McGill University         Canada
## 42         42               Purdue University, West Lafayette            USA
## 43         43                      Carnegie Mellon University            USA
## 44         44               University of Southern California            USA
## 45         45                 University of California, Davis            USA
## 46         46                  University of Colorado Boulder            USA
## 47         47                University of California, Irvine            USA
## 48         48                         University of Paris-Sud         France
## 49         49            University of Minnesota, Twin Cities            USA
## 50         50                           University of Arizona            USA
##    national_rank quality_of_education alumni_employment quality_of_faculty
## 1              1                    7                 9                  1
## 2              2                    9                17                  3
## 3              3                   17                11                  5
## 4              1                   10                24                  4
## 5              4                    2                29                  7
## 6              5                    8                14                  2
## 7              2                   13                28                  9
## 8              6                   14                31                 12
## 9              7                   23                21                 10
## 10             8                   16                52                  6
## 11             9                   15                26                  8
## 12            10                   21                42                 14
## 13            11                   31                16                 24
## 14             1                   32                19                 31
## 15            12                   34                77                 20
## 16             1                   26                66                 11
## 17             2                   42                38                 19
## 18             1                    4               101                 22
## 19            13                   62                59                 23
## 20            14                   61               101                 15
## 21            15                    1               101                 16
## 22             2                   24                93                 13
## 23            16                   89                75                 17
## 24            17                  101               101                 21
## 25            18                   64                63                 33
## 26            19                   82               101                 18
## 27            20                   65                43                 55
## 28             3                   84                73                 35
## 29            21                   19               101                 32
## 30            22                  101                78                 27
## 31             4                   35               101                 45
## 32             3                   77               101                 44
## 33            23                  101                32                101
## 34            24                   68                60                101
## 35             1                  101               101                 34
## 36            25                  101                86                 56
## 37            26                   74                62                101
## 38            27                   92               101                 41
## 39            28                  101               101                 40
## 40            29                  101               101                 28
## 41             2                   70                91                 54
## 42            30                   95                70                 49
## 43            31                   30                81                 26
## 44            32                  101               101                 63
## 45            33                   79               101                 92
## 46            34                   83                88                 48
## 47            35                  101               101                 38
## 48             1                   48               101                 25
## 49            36                  101               101                 85
## 50            37                  101               101                 88
##    publications influence citations broad_impact  score year
## 1             1         1         1            5 100.00 2012
## 2            12         4         4            1  91.67 2012
## 3             4         2         2           15  89.50 2012
## 4            16        16        11           50  86.17 2012
## 5            37        22        22           18  85.21 2012
## 6            53        33        26          101  82.50 2012
## 7            15        13        19           26  82.34 2012
## 8            14         6        15           66  79.14 2012
## 9            13        12        14            5  78.86 2012
## 10            6         5         3           16  78.55 2012
## 11           34        20        28          101  73.82 2012
## 12           22        21        16           10  73.69 2012
## 13            9        10         8            9  73.64 2012
## 14            8        19        23            3  69.49 2012
## 15           11         9         9            7  66.94 2012
## 16           40        51        44           34  66.69 2012
## 17           25        36        43           23  65.76 2012
## 18          101        67       101           29  65.09 2012
## 19            3        11         6           13  64.05 2012
## 20           10         8        10           22  63.11 2012
## 21          101        28        96          101  61.74 2012
## 22          101        91       101           28  60.76 2012
## 23           42        24        34           62  60.55 2012
## 24           19         3        13           33  59.70 2012
## 25           17        30        21           21  59.66 2012
## 26           35        71        39           44  59.00 2012
## 27           20        15        12           20  58.37 2012
## 28           26        26        29           41  57.53 2012
## 29          101        43        84          101  56.43 2012
## 30           41        47        40           57  56.18 2012
## 31           27        23        33           86  55.21 2012
## 32           39        44        51           11  54.43 2012
## 33           24        25        20           35  54.40 2012
## 34            2        17         7            8  53.72 2012
## 35            7        14        18          101  53.43 2012
## 36           31        29        31           29  53.09 2012
## 37           32        18        30           14  52.90 2012
## 38           74        52        67           12  52.64 2012
## 39            5         7         5          101  52.25 2012
## 40           68        72        36          101  52.15 2012
## 41           33        39        47          101  51.72 2012
## 42           61       101        58           19  51.66 2012
## 43          101       101        61          101  51.60 2012
## 44           46        48        32           23  51.38 2012
## 45           23        40        25           32  51.06 2012
## 46           71        54        56          101  50.68 2012
## 47           59        57        52           65  50.64 2012
## 48           73        96       101          101  50.44 2012
## 49           18        31        17           84  50.30 2012
## 50           45        42        45           27  50.29 2012
#Jumlah Universias di setiap negara yang masuk top 50 university  rangking (Dimas Prasetyo_556271)
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.5.3
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
university_ranking %>%
  group_by(country) %>%
  summarise(Jumlah = n())
## # A tibble: 7 × 2
##   country        Jumlah
##   <chr>           <int>
## 1 Canada              2
## 2 France              1
## 3 Israel              2
## 4 Japan               3
## 5 Switzerland         1
## 6 USA                37
## 7 United Kingdom      4
#Mengitung skor rata-rata Universitas suatu negara dalam peringkat top 50 universitas (Dimas Prasetyo_556271)
university_ranking %>%
  group_by(country) %>%
  summarise(across(score, mean))
## # A tibble: 7 × 2
##   country        score
##   <chr>          <dbl>
## 1 Canada          52.6
## 2 France          50.4
## 3 Israel          62.9
## 4 Japan           63.2
## 5 Switzerland     66.7
## 6 USA             63.5
## 7 United Kingdom  70.3
"\n\n"
## [1] "\n\n"
#Syntax Data 2, Data Frame
order_details <- data.frame(
order_id = c("AG-2011-2040", "IN-2011-47883", "HU-2011-1220", "IT-2011-3647632",
"IN-2011-47883", "IN-2011-47883", "CA-2011-1510", "IN-2011-79397", "ID-2011-80230",
"IZ-2011-4680", "IN-2011-65159", "IN-2011-65159", "ES-2011-4869686", "IN-2011-33652",
"ID-2011-80230", "MX-2011-160234", "IR-2011-770", "ID-2011-80230", "ID-2011-80230",
"ID-2011-12596", "IN-2011-79397", "IR-2011-7690", "IR-2011-770", "TZ-2011-7370",
"IZ-2011-4680", "IN-2011-65159", "IR-2011-770", "MX-2011-111255", "MX-2011-140641",
"MX-2011-158771", "ES-2011-4939443", "MX-2011-111255", "MX-2011-140641",
"US-2011-136007", "MX-2011-159373", "MX-2011-159373", "MX-2011-159373",
"IT-2011-2942451", "CA-2011-103800", "IN-2011-33036", "IT-2011-2942451", "SU-2011-5190",
"SU-2011-5190", "MX-2011-109267", "ES-2011-3848439", "ES-2011-3848439", "CA-2011-112326",
"IN-2011-27681", "CA-2011-112326"),
order_date = as.Date(c("1/1/2011", "1/1/2011", "1/1/2011", "1/1/2011", "1/1/2011", "1/1/2011",
"2/1/2011", "3/1/2011", "3/1/2011", "3/1/2011", "3/1/2011", "3/1/2011", "3/1/2011", "3/1/2011",
"3/1/2011", "3/1/2011", "3/1/2011", "3/1/2011", "3/1/2011", "3/1/2011", "3/1/2011", "3/1/2011",
"3/1/2011", "3/1/2011", "3/1/2011", "3/1/2011", "3/1/2011", "4/1/2011", "4/1/2011", "4/1/2011",
"4/1/2011", "4/1/2011", "4/1/2011", "4/1/2011", "4/1/2011", "4/1/2011", "4/1/2011", "4/1/2011",
"4/1/2011", "4/1/2011", "4/1/2011", "4/1/2011", "4/1/2011", "5/1/2011", "5/1/2011", "5/1/2011",
"5/1/2011", "5/1/2011", "5/1/2011"), format = "%m/%d/%Y"),
ship_date = as.Date(c("6/1/2011", "8/1/2011", "5/1/2011", "5/1/2011", "8/1/2011", "8/1/2011",
"6/1/2011", "3/1/2011", "9/1/2011", "7/1/2011", "7/1/2011", "7/1/2011", "7/1/2011", "9/1/2011",
"9/1/2011", "7/1/2011", "7/1/2011", "9/1/2011", "9/1/2011", "8/1/2011", "3/1/2011", "8/1/2011",
"7/1/2011", "8/1/2011", "7/1/2011", "7/1/2011", "7/1/2011", "9/1/2011", "9/1/2011", "11/1/2011",
"8/1/2011", "9/1/2011", "9/1/2011", "11/1/2011", "8/1/2011", "8/1/2011", "8/1/2011", "9/1/2011",
"8/1/2011", "8/1/2011", "9/1/2011", "8/1/2011", "8/1/2011", "9/1/2011", "7/1/2011", "7/1/2011",
"9/1/2011", "11/1/2011", "9/1/2011"), format = "%m/%d/%Y"),
ship_mode = c("Standard Class", "Standard Class", "Second Class", "Second Class", "Standard
Class", "Standard Class", "Standard Class", "Same Day", "Standard Class", "Standard Class",
"Second Class", "Second Class", "Standard Class", "Standard Class", "Standard Class", "Standard
Class", "Standard Class", "Standard Class", "Standard Class", "Standard Class", "Same Day",
"Second Class", "Standard Class", "Standard Class", "Standard Class", "Second Class", "Standard
Class", "Second Class", "Standard Class", "Standard Class", "Standard Class", "Second Class",
"Standard Class", "Standard Class", "Standard Class", "Standard Class", "Standard Class",
"Standard Class", "Standard Class", "Standard Class", "Standard Class", "Standard Class",
"Standard Class", "Standard Class", "First Class", "First Class", "Standard Class", "Standard
Class", "Standard Class"),
customer_name = c("Toby Braunhardt", "Joseph Holt", "Annie Thurman", "Eugene Moren",
"Joseph Holt", "Joseph Holt", "Magdelene Morse", "Kean Nguyen", "Ken Lonsdale", "Lindsay
Williams", "Larry Blacks", "Larry Blacks", "Dorothy Dickinson", "Dennis Pardue", "Ken Lonsdale",
"Stewart Visinsky", "Jas O'Carroll", "Ken Lonsdale", "Ken Lonsdale", "Chris McAfee", "Kean
Nguyen", "Nat Gilpin", "Jas O'Carroll", "Jack Garza", "Lindsay Williams", "Larry Blacks", "Jas
O'Carroll", "Russell Applegate", "Maya Herman", "Beth Thompson", "Arthur Prichep", "Russell
Applegate", "Maya Herman", "Beth Thompson", "Arthur Wiediger", "Arthur Wiediger", "Arthur
Wiediger", "Grant Thornton", "Darren Powers", "Bradley Drucker", "Grant Thornton", "Jasper
Cacioppo", "Jasper Cacioppo", "Jennifer Halladay", "Michael Granlund", "Michael Granlund",
"Phillina Ober", "Shaun Weien", "Phillina Ober"),
segment = c("Consumer", "Consumer", "Consumer", "Home Office", "Consumer", "Consumer",
"Consumer", "Corporate", "Consumer", "Corporate", "Consumer", "Consumer", "Consumer", "Home
Office", "Consumer", "Consumer", "Consumer", "Consumer", "Consumer", "Consumer",
"Corporate", "Corporate", "Consumer", "Consumer", "Corporate", "Consumer", "Consumer",
"Consumer", "Corporate", "Home Office", "Consumer", "Consumer", "Corporate", "Home Office",

"Home Office", "Home Office", "Home Office", "Corporate", "Consumer", "Consumer", "Corporate",
"Consumer", "Consumer", "Consumer", "Home Office", "Home Office", "Home Office", "Consumer",
"Home Office"),
country = c("Algeria", "Australia", "Hungary", "Sweden", "Australia", "Australia", "Canada",
"Australia", "New Zealand", "Iraq", "Philippines", "Philippines", "United Kingdom", "Malaysia", "New
Zealand", "Guatemala", "Iran", "New Zealand", "New Zealand", "Thailand", "Australia", "Iran", "Iran",
"Tanzania", "Iraq", "Philippines", "Iran", "Brazil", "Mexico", "Cuba", "France", "Brazil", "Mexico",
"Brazil", "Cuba", "Cuba", "Cuba", "United Kingdom", "United States", "Japan", "United Kingdom",
"Sudan", "Sudan", "Mexico", "France", "France", "United States", "Taiwan", "United States"),
product_name = c("Tenex Lockers, Blue", "Acme Trimmer, High Speed", "Tenex Box, Single
Width", "Enermax Note Cards, Premium", "Eldon Light Bulb, Duo Pack", "Eaton Computer Printout
Paper, 8.5 x 11", "Okidata Inkjet, Wireless", "Hoover Microwave, White", "Hewlett Wireless Fax,
Laser", "Novimex Swivel Stool, Set of Two", "Tenex Lockers, Industrial", "Chromcraft Round Table,
Adjustable Height", "Dania Corner Shelving, Traditional", "Hewlett Fax and Copier, Laser", "Hon
Rocking Chair, Set of Two", "Nokia Headset, VoIP", "Breville Coffee Grinder, Black", "Belkin
Numeric Keypad, Bluetooth", "SAFCO Chairmat, Black", "Smead File Cart, Blue", "Avery Color
Coded Labels, Laser Printer Compatible", "BIC Sketch Pad, Water Color", "Rogers Folders,
Industrial", "Stiletto Scissors, Serrated", "Cameo Interoffice Envelope, Set of 50", "Stockwell
Staples, Metal", "Advantus Rubber Bands, Metal", "Dania Classic Bookcase, Pine", "Enermax
Keyboard, Bluetooth", "Jiffy Interoffice Envelope, Set of 50", "Binney & Smith Sketch Pad,
Easy-Erase", "Fiskars Letter Opener, Easy Grip", "Sharp Ink, Laser", "Jiffy Interoffice Envelope, Set
of 50", "SAFCO Chairmat, Black", "Memorex Mouse, USB", "Kraft Peel and Seal, Recycled",
"Boston Markers, Easy-Erase", "Message Book, Wirebound, Four 5 1/2\" X 4\" Forms/Pg., 200
Dupl. Sets/Book", "Harbour Creations File Folder Labels, 5000 Label Set", "Eldon Folders, Single
Width", "Boston Pens, Fluorescent", "Avery Hole Reinforcements, Durable", "Hoover Stove, Black",
"Sanford Canvas, Fluorescent", "Binney & Smith Pencil Sharpener, Water Color", "SAFCO Boltless
Steel Shelving", "Rubbermaid Photo Frame, Durable", "Avery 508"),
sales = c(408, 120, 66, 45, 114, 55, 314, 276, 912, 667, 338, 211, 854, 193, 159, 195, 123, 69, 69,
135, 36, 52, 62, 81, 47, 6, 17, 1648, 223, 186, 140, 149, 166, 74, 38, 38, 39, 27, 16, 27, 17, 15, 6,
3029, 207, 90, 273, 49, 12),
quantity = c(2, 3, 4, 3, 5, 2, 1, 1, 4, 4, 3, 1, 7, 1, 2, 4, 2, 2, 2, 2, 3, 1, 2, 4, 1, 1, 1, 6, 4, 6, 3, 8, 2, 6,
1, 2, 3, 2, 2, 3, 2, 1, 1, 8, 4, 3, 3, 1, 3),
discount = c(0, 0.1, 0, 0.5, 0.1, 0.1, 0, 0.1, 0.4, 0, 0.45, 0.55, 0, 0, 0.4, 0, 0, 0.4, 0.4, 0.47, 0.1, 0,
0, 0, 0, 0.45, 0, 0, 0, 0, 0, 0, 0.002, 0.6, 0, 0, 0, 0.5, 0.2, 0, 0.5, 0, 0, 0, 0, 0, 0.2, 0, 0.2),
profit = c(106.14, 36.036, 29.64, -26.055, 37.77, 15.342, 3.12, 110.412, -319.464, 253.32,
-122.8005, -70.3995, 290.43, 50.13, -95.676, 44.88, 42.9, 3.42, -26.412, -45.9018, 4.743, 7.77, 8.7,
26.76, 17.07, 0.546, 4.17, 609.84, 13.28, 3.6, 20.88, 28.16, 49.42824, -107.856, 6.88, 2.24, 7.68,
-21.9, 5.5512, 13.68, -1.05, 2.61, 2.1, 999.36, 76.56, 20.52, -64.7748, 22.92, 4.2717),
shipping_cost = c(35.46, 9.72, 8.17, 4.82, 4.7, 1.8, 24.1, 125.32, 107.1, 81.26, 33.75, 21.32,
12.56, 10.4, 10.07, 8.43, 8.41, 8.34, 8.17, 7.74, 7.46, 5.91, 5.16, 5.11, 3.57, 0.8, 0.54, 109.13,
42.28, 16.39, 10.78, 10.38, 9.54, 7.04, 4.25, 3.94, 3.51, 2.11, 1.82, 1.54, 0.9, 0.82, 0.51, 191.2,
20.64, 15.27, 13.59, 5.82, 0.99)
)
print(order_details)
##           order_id order_date  ship_date       ship_mode      customer_name
## 1     AG-2011-2040 2011-01-01 2011-06-01  Standard Class    Toby Braunhardt
## 2    IN-2011-47883 2011-01-01 2011-08-01  Standard Class        Joseph Holt
## 3     HU-2011-1220 2011-01-01 2011-05-01    Second Class      Annie Thurman
## 4  IT-2011-3647632 2011-01-01 2011-05-01    Second Class       Eugene Moren
## 5    IN-2011-47883 2011-01-01 2011-08-01 Standard\nClass        Joseph Holt
## 6    IN-2011-47883 2011-01-01 2011-08-01  Standard Class        Joseph Holt
## 7     CA-2011-1510 2011-02-01 2011-06-01  Standard Class    Magdelene Morse
## 8    IN-2011-79397 2011-03-01 2011-03-01        Same Day        Kean Nguyen
## 9    ID-2011-80230 2011-03-01 2011-09-01  Standard Class       Ken Lonsdale
## 10    IZ-2011-4680 2011-03-01 2011-07-01  Standard Class  Lindsay\nWilliams
## 11   IN-2011-65159 2011-03-01 2011-07-01    Second Class       Larry Blacks
## 12   IN-2011-65159 2011-03-01 2011-07-01    Second Class       Larry Blacks
## 13 ES-2011-4869686 2011-03-01 2011-07-01  Standard Class  Dorothy Dickinson
## 14   IN-2011-33652 2011-03-01 2011-09-01  Standard Class      Dennis Pardue
## 15   ID-2011-80230 2011-03-01 2011-09-01  Standard Class       Ken Lonsdale
## 16  MX-2011-160234 2011-03-01 2011-07-01 Standard\nClass   Stewart Visinsky
## 17     IR-2011-770 2011-03-01 2011-07-01  Standard Class      Jas O'Carroll
## 18   ID-2011-80230 2011-03-01 2011-09-01  Standard Class       Ken Lonsdale
## 19   ID-2011-80230 2011-03-01 2011-09-01  Standard Class       Ken Lonsdale
## 20   ID-2011-12596 2011-03-01 2011-08-01  Standard Class       Chris McAfee
## 21   IN-2011-79397 2011-03-01 2011-03-01        Same Day       Kean\nNguyen
## 22    IR-2011-7690 2011-03-01 2011-08-01    Second Class         Nat Gilpin
## 23     IR-2011-770 2011-03-01 2011-07-01  Standard Class      Jas O'Carroll
## 24    TZ-2011-7370 2011-03-01 2011-08-01  Standard Class         Jack Garza
## 25    IZ-2011-4680 2011-03-01 2011-07-01  Standard Class   Lindsay Williams
## 26   IN-2011-65159 2011-03-01 2011-07-01    Second Class       Larry Blacks
## 27     IR-2011-770 2011-03-01 2011-07-01 Standard\nClass     Jas\nO'Carroll
## 28  MX-2011-111255 2011-04-01 2011-09-01    Second Class  Russell Applegate
## 29  MX-2011-140641 2011-04-01 2011-09-01  Standard Class        Maya Herman
## 30  MX-2011-158771 2011-04-01 2011-11-01  Standard Class      Beth Thompson
## 31 ES-2011-4939443 2011-04-01 2011-08-01  Standard Class     Arthur Prichep
## 32  MX-2011-111255 2011-04-01 2011-09-01    Second Class Russell\nApplegate
## 33  MX-2011-140641 2011-04-01 2011-09-01  Standard Class        Maya Herman
## 34  US-2011-136007 2011-04-01 2011-11-01  Standard Class      Beth Thompson
## 35  MX-2011-159373 2011-04-01 2011-08-01  Standard Class    Arthur Wiediger
## 36  MX-2011-159373 2011-04-01 2011-08-01  Standard Class    Arthur Wiediger
## 37  MX-2011-159373 2011-04-01 2011-08-01  Standard Class   Arthur\nWiediger
## 38 IT-2011-2942451 2011-04-01 2011-09-01  Standard Class     Grant Thornton
## 39  CA-2011-103800 2011-04-01 2011-08-01  Standard Class      Darren Powers
## 40   IN-2011-33036 2011-04-01 2011-08-01  Standard Class    Bradley Drucker
## 41 IT-2011-2942451 2011-04-01 2011-09-01  Standard Class     Grant Thornton
## 42    SU-2011-5190 2011-04-01 2011-08-01  Standard Class   Jasper\nCacioppo
## 43    SU-2011-5190 2011-04-01 2011-08-01  Standard Class    Jasper Cacioppo
## 44  MX-2011-109267 2011-05-01 2011-09-01  Standard Class  Jennifer Halladay
## 45 ES-2011-3848439 2011-05-01 2011-07-01     First Class   Michael Granlund
## 46 ES-2011-3848439 2011-05-01 2011-07-01     First Class   Michael Granlund
## 47  CA-2011-112326 2011-05-01 2011-09-01  Standard Class      Phillina Ober
## 48   IN-2011-27681 2011-05-01 2011-11-01 Standard\nClass        Shaun Weien
## 49  CA-2011-112326 2011-05-01 2011-09-01  Standard Class      Phillina Ober
##         segment        country
## 1      Consumer        Algeria
## 2      Consumer      Australia
## 3      Consumer        Hungary
## 4   Home Office         Sweden
## 5      Consumer      Australia
## 6      Consumer      Australia
## 7      Consumer         Canada
## 8     Corporate      Australia
## 9      Consumer    New Zealand
## 10    Corporate           Iraq
## 11     Consumer    Philippines
## 12     Consumer    Philippines
## 13     Consumer United Kingdom
## 14 Home\nOffice       Malaysia
## 15     Consumer   New\nZealand
## 16     Consumer      Guatemala
## 17     Consumer           Iran
## 18     Consumer    New Zealand
## 19     Consumer    New Zealand
## 20     Consumer       Thailand
## 21    Corporate      Australia
## 22    Corporate           Iran
## 23     Consumer           Iran
## 24     Consumer       Tanzania
## 25    Corporate           Iraq
## 26     Consumer    Philippines
## 27     Consumer           Iran
## 28     Consumer         Brazil
## 29    Corporate         Mexico
## 30  Home Office           Cuba
## 31     Consumer         France
## 32     Consumer         Brazil
## 33    Corporate         Mexico
## 34  Home Office         Brazil
## 35  Home Office           Cuba
## 36  Home Office           Cuba
## 37  Home Office           Cuba
## 38    Corporate United Kingdom
## 39     Consumer  United States
## 40     Consumer          Japan
## 41    Corporate United Kingdom
## 42     Consumer          Sudan
## 43     Consumer          Sudan
## 44     Consumer         Mexico
## 45  Home Office         France
## 46  Home Office         France
## 47  Home Office  United States
## 48     Consumer         Taiwan
## 49  Home Office  United States
##                                                                 product_name
## 1                                                        Tenex Lockers, Blue
## 2                                                   Acme Trimmer, High Speed
## 3                                                   Tenex Box, Single\nWidth
## 4                                                Enermax Note Cards, Premium
## 5                                                 Eldon Light Bulb, Duo Pack
## 6                                   Eaton Computer Printout\nPaper, 8.5 x 11
## 7                                                   Okidata Inkjet, Wireless
## 8                                                    Hoover Microwave, White
## 9                                               Hewlett Wireless Fax,\nLaser
## 10                                          Novimex Swivel Stool, Set of Two
## 11                                                 Tenex Lockers, Industrial
## 12                                Chromcraft Round Table,\nAdjustable Height
## 13                                        Dania Corner Shelving, Traditional
## 14                                             Hewlett Fax and Copier, Laser
## 15                                            Hon\nRocking Chair, Set of Two
## 16                                                       Nokia Headset, VoIP
## 17                                            Breville Coffee Grinder, Black
## 18                                         Belkin\nNumeric Keypad, Bluetooth
## 19                                                     SAFCO Chairmat, Black
## 20                                                     Smead File Cart, Blue
## 21                       Avery Color\nCoded Labels, Laser Printer Compatible
## 22                                               BIC Sketch Pad, Water Color
## 23                                               Rogers Folders,\nIndustrial
## 24                                               Stiletto Scissors, Serrated
## 25                                     Cameo Interoffice Envelope, Set of 50
## 26                                                 Stockwell\nStaples, Metal
## 27                                              Advantus Rubber Bands, Metal
## 28                                              Dania Classic Bookcase, Pine
## 29                                              Enermax\nKeyboard, Bluetooth
## 30                                     Jiffy Interoffice Envelope, Set of 50
## 31                                    Binney & Smith Sketch Pad,\nEasy-Erase
## 32                                          Fiskars Letter Opener, Easy Grip
## 33                                                          Sharp Ink, Laser
## 34                                    Jiffy Interoffice Envelope, Set\nof 50
## 35                                                     SAFCO Chairmat, Black
## 36                                                        Memorex Mouse, USB
## 37                                             Kraft Peel and Seal, Recycled
## 38                                                Boston Markers, Easy-Erase
## 39 Message Book, Wirebound, Four 5 1/2" X 4" Forms/Pg., 200\nDupl. Sets/Book
## 40                      Harbour Creations File Folder Labels, 5000 Label Set
## 41                                              Eldon Folders, Single\nWidth
## 42                                                  Boston Pens, Fluorescent
## 43                                        Avery Hole Reinforcements, Durable
## 44                                                       Hoover Stove, Black
## 45                                               Sanford Canvas, Fluorescent
## 46                              Binney & Smith Pencil Sharpener, Water Color
## 47                                            SAFCO Boltless\nSteel Shelving
## 48                                           Rubbermaid Photo Frame, Durable
## 49                                                                 Avery 508
##    sales quantity discount     profit shipping_cost
## 1    408        2    0.000  106.14000         35.46
## 2    120        3    0.100   36.03600          9.72
## 3     66        4    0.000   29.64000          8.17
## 4     45        3    0.500  -26.05500          4.82
## 5    114        5    0.100   37.77000          4.70
## 6     55        2    0.100   15.34200          1.80
## 7    314        1    0.000    3.12000         24.10
## 8    276        1    0.100  110.41200        125.32
## 9    912        4    0.400 -319.46400        107.10
## 10   667        4    0.000  253.32000         81.26
## 11   338        3    0.450 -122.80050         33.75
## 12   211        1    0.550  -70.39950         21.32
## 13   854        7    0.000  290.43000         12.56
## 14   193        1    0.000   50.13000         10.40
## 15   159        2    0.400  -95.67600         10.07
## 16   195        4    0.000   44.88000          8.43
## 17   123        2    0.000   42.90000          8.41
## 18    69        2    0.400    3.42000          8.34
## 19    69        2    0.400  -26.41200          8.17
## 20   135        2    0.470  -45.90180          7.74
## 21    36        3    0.100    4.74300          7.46
## 22    52        1    0.000    7.77000          5.91
## 23    62        2    0.000    8.70000          5.16
## 24    81        4    0.000   26.76000          5.11
## 25    47        1    0.000   17.07000          3.57
## 26     6        1    0.450    0.54600          0.80
## 27    17        1    0.000    4.17000          0.54
## 28  1648        6    0.000  609.84000        109.13
## 29   223        4    0.000   13.28000         42.28
## 30   186        6    0.000    3.60000         16.39
## 31   140        3    0.000   20.88000         10.78
## 32   149        8    0.000   28.16000         10.38
## 33   166        2    0.002   49.42824          9.54
## 34    74        6    0.600 -107.85600          7.04
## 35    38        1    0.000    6.88000          4.25
## 36    38        2    0.000    2.24000          3.94
## 37    39        3    0.000    7.68000          3.51
## 38    27        2    0.500  -21.90000          2.11
## 39    16        2    0.200    5.55120          1.82
## 40    27        3    0.000   13.68000          1.54
## 41    17        2    0.500   -1.05000          0.90
## 42    15        1    0.000    2.61000          0.82
## 43     6        1    0.000    2.10000          0.51
## 44  3029        8    0.000  999.36000        191.20
## 45   207        4    0.000   76.56000         20.64
## 46    90        3    0.000   20.52000         15.27
## 47   273        3    0.200  -64.77480         13.59
## 48    49        1    0.000   22.92000          5.82
## 49    12        3    0.200    4.27170          0.99
#Menghitung segmen terbanyak dalam data order tersebut (Dimas Prasetyo_556271)
library(dplyr)
order_details %>%
  group_by(segment) %>%
  summarise(Jumlah = n())
## # A tibble: 4 × 2
##   segment        Jumlah
##   <chr>           <int>
## 1 "Consumer"         29
## 2 "Corporate"         9
## 3 "Home\nOffice"      1
## 4 "Home Office"      10
#Melihat rata-rata penjualan dan kuantitas di setiap segmen (Dimas Prasetyo_556271)
order_details %>%
  group_by(segment) %>%
  summarise(across(sales:quantity, mean))
## # A tibble: 4 × 3
##   segment        sales quantity
##   <chr>          <dbl>    <dbl>
## 1 "Consumer"      324.     3   
## 2 "Corporate"     168.     2.22
## 3 "Home\nOffice"  193      1   
## 4 "Home Office"   100.     3.4

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.