- One of the responsabilities of the National Institute of Standards and
Technology (NIST) is maintaining standards for accurate measurements, including
weights measurements.
- Look at the AI Overview for the question "what does NIST do?"
- The NIST 10 Gram Prototype Weight Weighings Dataset is the second dataset
posted on the R Datasets Page. It consists
of weight measurements of a 10 gram prototype weight once a week for 100 weeks
(almost two years). This prototype is weighed with a scale that measures weights
to the nearest microgram (10-6 gram).
- To create a vector of these 100 weighings for R to use, first create a
folder named workspace to use for the calculations. This
folder should be created in the root folder C:/ for windows. Then copy the
nist10.txt database into your new
workspace folder. If you wish, you can use R to create
this new workspace folder:
setwd("C:/")
dir.create("workspace")
- I need a volunteer that uses a Mac to help me write a short description of how to
create the folder named workspace in the home directory.
On a Mac, you should be able to use to create the workspace folder like this:
setwd("~")
dir.create("workspace")
- Here is an R script that creates the vector of these weights named
w to be analyzed using R. Note that an R comment line is marked
with # at the beginning of the line.
# Obtain the current working directory.
getwd( )
# Set the current working directory to C:/workspace.
setwd("C:/workspace")
# When using unix, set the current working directory
# to ~/workspace where ~ is the home directory.
# setwd("~/workspace")
# Create a dataframe named weightsDf from the file nist10.txt
# This dataframe will contain the columns
weightsDf <- read.csv("nist-10.txt")
# Extract a vector named w from the Weight column
# of the data frame
w <- weightsDf$Weight
# Print the weight vector
print(w)
- When you copy and paste this script into R and press Enter, the w vector is printed:
[1] 9.999591 9.999600 9.999594 9.999601 9.999598 9.999594 9.999599 9.999597
[9] 9.999599 9.999597 9.999602 9.999597 9.999593 9.999598 9.999599 9.999601
[17] 9.999600 9.999599 9.999595 9.999598 9.999592 9.999601 9.999601 9.999598
[25] 9.999601 9.999603 9.999593 9.999599 9.999601 9.999599 9.999597 9.999600
[33] 9.999590 9.999599 9.999593 9.999577 9.999594 9.999594 9.999598 9.999595
[41] 9.999595 9.999591 9.999601 9.999598 9.999593 9.999594 9.999587 9.999591
[49] 9.999596 9.999598 9.999596 9.999594 9.999593 9.999595 9.999589 9.999590
[57] 9.999590 9.999590 9.999599 9.999598 9.999596 9.999595 9.999608 9.999593
[65] 9.999594 9.999596 9.999597 9.999592 9.999596 9.999593 9.999588 9.999594
[73] 9.999591 9.999600 9.999592 9.999596 9.999599 9.999596 9.999592 9.999594
[81] 9.999592 9.999594 9.999599 9.999588 9.999607 9.999563 9.999582 9.999585
[89] 9.999596 9.999599 9.999599 9.999593 9.999588 9.999625 9.999591 9.999594
[97] 9.999602 9.999594 9.999597 9.999596
- We can now analyze this w vector like we did last week with the Celsius
temperatures in Review Exercise 10 of the Jan 7 Lecture Notes, and also like you
are analyzing the hypothetical exam scores for Project 1. Use these R functions
to perform the analysis:
median IQR quantile hist boxplot mean