R Tutorial2
R Tutorial2
Çağatay Ünal
2024-10-09
How to Handle Metadata
Step 1
Figure 7: Apply
Step 8
In the first stage, using CSV format seems very complicated. You
can basically edit your trivia issues in Excel or Google Docs. But
after using CSV format, every possible document format will be
easier for you.
Step 9 (Going R)
Open a new file. And in the right frame of the R, there is “Import
Dataset”. Click it. Use readr for CSV docs.
Figure 9: Import
Step 10
## Warning: One or more parsing issues, call ‘problems()‘ on your data frame for details,
## e.g.:
## dat <- vroom(...)
## problems(dat)
## Rows: 8 Columns: 24
## -- Column specification --------------------------------------------------------
## Delimiter: ","
## chr (19): Country Name, Country Code, Series Name, Series Code, 2004 [YR2004...
## dbl (5): 2012 [YR2012], 2013 [YR2013], 2014 [YR2014], 2015 [YR2015], 2016 [...
##
## i Use ‘spec()‘ to retrieve the full column specification for this data.
## i Specify the column types or set ‘show_col_types = FALSE‘ to quiet this message.
View(data)
# Remember that the first syntax before comma is for row, the second is for column.
# And we use "-" minus for removing.
View(data)
Step 12
View(data)
Step 13
library(dplyr)
##
## Attaching package: ’dplyr’
And lets convert all the columns into numeric. Because we can
only do MATH or PLOT with numeric data.
data <- data %>% mutate_all(as.numeric)
View(data)
is.numeric(data$`2004 [YR2004]`)
## [1] TRUE
Step 15
View(data_clean)
Step 16
We are very close to anaylsis. For the IDEAL DATA sake, DATA
GODS want to more clearity. Now our data needs one more touch.
Do you have any idea? What do we need to do here? Everything
seems very clear, what type of tiny little touch here we need?
Step 16 Cont.
View(transposed_data)
View(transposed_data)
Step 17
HAPPY ENDING
mean(transposed_data)
## [1] 78332.76
transposed_data
2
plot(transposed_data)
4
6
Index
8
10
12
End