Example using a csv File

cup.diameters <- function()
{
phant1 <- read.csv(file="hip_stats1.csv",header=TRUE,sep=",");
diameter1 <- ((phant1[2:15, 10])*2)

phant1a <- read.csv(file="hip_stats1a.csv",header=TRUE,sep=",");
diameter1a <- ((phant1a[2:15, 10])*2)

phant2 <- read.csv(file="hip_stats2.csv",header=TRUE,sep=",");
diameter2 <- ((phant2[2:15, 10])*2)

total_cup <- c(diameter1, diameter1a, diameter2)
print("total cup diameter is")
print(total_cup)
total.cup <- total_cup

Transcript

So continuing with an example using a CSV file, (as we said a comma-separated values file) in this case we have a little function who's going to read a series of values in from different files, each of which has a header, the separator, in this case, was actually a comma, we put the data into these data frames.  And now we can manage to, of course, do all of these things within our function.  So you can do that again and again, which makes it very convenient.