-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
63 lines (63 loc) · 2.56 KB
/
.Rhistory
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
51
52
53
54
55
56
57
58
59
60
61
62
63
if(!require(readxl)) install.packages("readxl")
library(readxl)
file_path <- "change_in_population.xlsx"
data <- read_excel(file_path)
file_path <- "C:\Users\bugra\OneDrive\Masaüstü\veri dataset\change_in_population.xlsx"
file_path <- "C:/Users/bugra/OneDrive/Masaüstü/veri dataset/change_in_population.xlsx"
data <- read_excel(file_path)
file_path <- "C:\Users\bugra\Downloads\change_in_population.xlsx"
file_path <- "C:\Users\bugra\Downloads\change_in_population.xlsx"
file_path <- "C:/Users/bugra/Downloads/change_in_population.xlsx"
file_path <- "C:/Users/bugra/Downloads/change_in_population.xlsx"
data <- read.xlsx(file_path)
install.packages("openxlsx")
library(openxlsx)
if (!require(readxl)) install.packages("readxl")
library(readxl)
file_path <- "C:/Users/bugra/Downloads/change_in_population.xlsx"
data <- read_excel(file_path)
print(head(data))
if (!require(tidyverse)) install.packages("tidyverse")
if (!require(readxl)) install.packages("readxl")
library(tidyverse)
library(readxl)
# Gerekli sütunları seç
data_clean <- data %>%
select(Year, Turkey, `More Developed Region`, `Less Developed Region`, `Least Developed Region`) %>%
drop_na()
# Sütun isimlerini yeniden adlandır
data <- data %>%
rename(
Year = `Year Column Name`,
Turkey = `Turkey Population`,
More_Developed = `More Developed Region`,
Less_Developed = `Less Developed Region`,
Least_Developed = `Least Developed Region`
)
data_clean <- data %>%
select(Year, Turkey, `More Developed Region`, `Less Developed Region`, `Least Developed Region`) %>%
drop_na()
data_long <- data_clean %>%
pivot_longer(cols = -Year, names_to = "Region", values_to = "Population")
# Çizgi grafiği oluştur
ggplot(data_long, aes(x = Year, y = Population, color = Region)) +
geom_line(size = 1) +
labs(title = "Türkiye ve Bölgelerin Yıllara Göre Nüfus Karşılaştırması",
x = "Yıl",
y = "Nüfus",
color = "Bölge") +
data_clean <- data_clean %>%
mutate(Turkey_vs_Developed = Turkey - `More Developed Region`,
Turkey_vs_LessDeveloped = Turkey - `Less Developed Region`,
Turkey_vs_LeastDeveloped = Turkey - `Least Developed Region`)
colnames(data)
[1] "Year" "Turkey Population" "More Developed Region" "Less Developed Region" "Least Developed Region"
data_clean <- data %>%
select(Year, `Turkey Population`, `More Developed Region`, `Less Developed Region`, `Least Developed Region`) %>%
drop_na()
data_clean <- data %>%
select(Year, `Türkiye`, `More Developed Region`, `Less Developed Region`, `Least Developed Region`) %>%
drop_na()
file_path <- "C:/Users/bugra/Downloads/change_in_population.xlsx"
data <- read_excel(file_path)
print(head(data))