A step-by-step approach to perform the analysis related to the income_dist.csv file can be easily carried out as shown in the next program.
- Load the dataset income_dist.csv using the read.csv function and use the functions nrow, str, length, unique, and so on to get the following results:
id <- read.csv("income_dist.csv",header=TRUE) nrow(id) str(names(id)) length(names(id)) ncol(id) # equivalent of previous line unique(id$Country) levels(id$Country) # alternatively min(id$Year) max(id$Year) id_us <- id[id$Country=="United States",]
The data is first stored in the R object ID. We see that there are 2180 observations/rows in the dataset. The dataset has 354 variables and a few are seen with the use of two functions, str ...