Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

## Homework #1 Basic commands of R and dataset management install.packages(\"nyc

ID: 3597113 • Letter: #

Question

## Homework #1 Basic commands of R and dataset management

install.packages("nycflights13") #Install first

#then add this line
#library(nycflights13)


### Problem 5
The dataset AllCountries includes information on the percent of people in each country with access to internet, energy consumption and more.

a) Upload the dataset AllCountries from the textbook's website. Analyze the content of the dataset by using the command head and print the size (number of countries included) of the dataset.

```{r}

```

b) Find the developed country with the largest percent access to Internet

```{r}

```

c) Determine the countries with the largest and smallest land areas

```{r}

```

Explanation / Answer

datafile=read.csv("C://Users/CHANDRA/Desktop/AllCountries.csv", TRUE, sep = ",") #Reading data

print ("Total number countries: ")
print ( nrow(datafile))

#Changing NA values to zeros
datafile$Developed[which(is.na(datafile$Developed))] <- 0
datafile$Internet[which(is.na(datafile$Internet))] <- 0


#print Max developed country with largest internet access
print(datafile[ datafile$Developed == max(datafile$Developed, na.rm=TRUE) & datafile$Internet == max(datafile$Internet, na.rm=TRUE) ,])

print(" ")

#Printing countries with maximum and minimum land area
print(datafile[ datafile$LandArea == max(datafile$LandArea, na.rm=TRUE),])
print(datafile[ datafile$LandArea == min(datafile$LandArea, na.rm=TRUE),])