Description Usage Format Source Examples
The elasticband
data frame has 7 rows and 2 columns
giving, for each amount by which an elastic band is stretched
over the end of a ruler, the distance that the band traveled when
released.
1 |
This data frame contains the following columns:
the amount by which the elastic band was stretched
the distance traveled
J. H. Maindonald
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | print("Example 1.8.1")
attach(elasticband) # R now knows where to find stretch and distance
plot(stretch, distance) # Alternative: plot(distance ~ stretch)
detach(elasticband)
pause()
print("Output of Data Frames - Example 12.3.2")
write(t(elasticband),file="bands.txt",ncol=2)
sink("bands2.txt")
elasticband # NB: No output on screen
sink()
print("Lists - Example 12.7")
elastic.lm <- lm(distance ~ stretch, data=elasticband)
names(elastic.lm)
elastic.lm$coefficients
elastic.lm[["coefficients"]]
pause()
elastic.lm[[1]]
pause()
elastic.lm[1]
pause()
options(digits=3)
elastic.lm$residuals
pause()
elastic.lm$call
pause()
mode(elastic.lm$call)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.