This part was hands-on practice with R.
We tried out simple calculations and using libraries.
For example, let’s say we have the following Python code.
def add(a, b):
return a + b
x = 1
y = 2
sum(x, y)If we convert this to R, it looks like this.
add <- function(a, b){
return a + b
}
x <- 1
y <- 2
sum(x, y)And the basic data types are as follows.
Data type | Example | Description |
|---|---|---|
Numeric |
| double by default |
Character |
| Strings use quotation marks |
Logical |
| TRUE / FALSE |
Vector |
| Basic data structure in R |
List |
| Can contain different types |
Data frame |
| Table-like form |
Instead of lists, you use the vector type, and you can perform operations on all of its values at once.
x <- c(1,2,3)
x + 1 # [1] 2 3 4
x * 2 # [1] 2 4 6
x == 2 # [1] FALSE TRUE FALSEAt one point we loaded csv and sav files, and I was surprised that the function names were very similar to those in pandas.
That made me wonder if it wouldn’t be fine to just analyze everything with Python instead of using R, but according to ChatGPT it’s still good to learn R.

I feel like once I do one proper data analysis project, I’ll get the hang of it.
댓글을 불러오는 중...