= 1
x x
1
My first assignment has three parts.
Python and R has syntax difference.
assignment operator in Python:
assignment operator in R:
x <- 1
x
2.writing function or a loop in R
```{r}
for (i in 1:10) {
print(i)
}
```
writing function or a loop in Python `
::: {.cell execution_count=2}
``` {.python .cell-code}
for i in range(1,11):
print(i)
```
::: {.cell-output .cell-output-stdout}
```
1
2
3
4
5
6
7
8
9
10
```
:::
:::
if structure in R
```{r}
if (5 < 3){
print("Right")
}else if (3 == 5){
print("Right")
}else {
print("Right")}
```
library(dslabs)
data(na_example)
number_of_na <- sum(is.na(na_example))
print(number_of_na) cat("Toplam NA sayısı", number_of_na)