Dear Mark,
A data frame is a list, and thus foo[5] returns a one-element list, while
foo[[5]] returns a vector. One can also subscript a data frame as a matrix,
so foo[1, 5] returns the element in the 1st row, 5th column, foo[,5] returns
the 5th column as a vector, and foo[,c(3, 5)] returns a two-
try
hist(foo[,5])
plot(foo[,c(1,5)])
HTH
> Currently I invoke:
>
> foo <- read.table("foo.data", header=TRUE)
>
> to read a table into foo
>
> Then when I try to plot a histogram out of the 5th column of foo:
>
> hist(foo[5])
>
> It fails and it says:
>
> Error in hist.default(foo[5]) : '
2 matches
Mail list logo