da=read.table("m-ibm6708.txt",header=T) #<== Load data with header
#<== Check dimension of the data (row = sample size, col = variables)
###############502 rows, col 1 = date, col 2 = ibm, col 3 = sprtn
#<== Print out the first 6 rows of the data object "da".
printrows <- da[1:6]
printrows
The print rows didn't work. I tried a bunch of things. I think it might use cbind. da is a big table, but I only need the first 6 rows displayed.
As jdharrison said, head(da,6)
will work - alternatively you can use the indices to print the top 6 rows da[1:6,]
When using the indices notation remember it's [rows,columns]
and you must include the comma if you have a data.frame
or matrix
- i.e. [1:6,]
for the first six rows or [,1:6]
for the first six columns.