Posts

Showing posts with the label create

7.3.5 Visualization for Law and Order - Video 3 A Line Plot

In this video, we'll create a basic line plot to visualize crime trends. Let's start by reading in our data. We'll call it mvt for motor vehicle thefts, and use the read.csv function to read in the file mvt.csv. We'll add the argument stringsAsFactors = FALSE, since we have a text field, and we want to make sure it's read in properly. Let's take a look at the structure of our data using the str function. We have over 190,000 observations of three different variables-- the date of the crime, and the location of the crime, in terms of latitude and longitude. We want to first convert the Date variable to a format that R will recognize so that we can extract the day of the week and the hour of the day. We can do this using the strptime function. So we want to replace our variable, Date, with the output of the strptime function, which takes as a first argument our variable, Date, and then as a second argument the format that the date is in. Here, we can...

7.3.11 Visualization for Law and Order - Video 6 A Heatmap on the United States

In this video, we'll create a heat map on a map of the United States. We'll be using the data set murders.csv, which is data provided by the FBI giving the total number of murders in the United States by state. Let's start by reading in our data set. We'll call it murders, and we'll use the read.csv function to read in the data file murders.csv. Let's take a look at the structure of this data using the str function. We have 51 observations for the 50 states plus Washington, DC, and six different variables: the name of the state, the population, the population density, the number of murders, the number of murders that used guns, and the rate of gun ownership. A map of the United States is included in R. Let's load the map and call it statesMap. We can do so using the map_data function, where the only argument is "state" in quotes. Let's see what this looks like by typing in str(statesMap). This is just a data frame summarizing how ...

7.2.7 An Introduction to Visualization - Video 4 Basic Scatterplots Using ggplot

In this video, we'll create a basic scatterplot using ggplot. Let's start by reading in our data. We'll be using the same data set we used during week one, WHO.csv. So let's call it WHO and use the read.csv function to read in the data file WHO.csv. Make sure you're in the directory containing this file first. Now, let's take a look at the structure of the data using the str function. We can see that we have 194 observations, or countries, and 13 different variables-- the name of the country, the region the country's in, the population in thousands, the percentage of the population under 15 or over 60, the fertility rate or average number of children per woman, the life expectancy in years, the child mortality rate, which is the number of children who die by age five per 1,000 births, the number of cellular subscribers per 100 population, the literacy rate among adults older than 15, the gross national income per capita, the percentage of male ...

17.2.2 Processes

Let's create a new abstraction called a "process" to capture the notion of a running program. A process encompasses all the resources that would be used when running a program including those of the CPU, the MMU, input and output devices, etc. Each process has a "state" that captures everything we know about its execution. The process state includes * the hardware state of the CPU, i.e., the values in the registers and program counter. * the contents of the process' virtual address space, including code, data values, the stack, and data objects dynamically allocated from the heap. Under the management of the MMU, this portion of the state can be resident in main memory or can reside in secondary storage. * the hardware state of the MMU, which, as we saw earlier, depends on the context-number and page-directory registers. Also included are the pages allocated for the hierarchical page map. * additional information about the process' input an...