next up previous contents home.gif
Next: How Can I See Up: Frequently Asked Questions Previous: How Exactly are the   Contents


How Do I Create Observation Names?

Since the diagnostics often make use of the observation names of the data frame, you may find it helpful to specify observation names for the data input. Use the row.names command to achieve this. For example, to assign the names ``Dan'', ``Kosuke'', ``Liz'' and ``Gary'' to a data frame with the first four observations in the Lalonde data, type:

> test <- lalonde[1:4, ]
> row.names(test) <- c("Dan", "Kosuke", "Liz", "Gary")
> print(test)
       age educ black hisp married nodegr re74 re75  re78 u74 u75 treat
Dan     37   11     1    0       1      1    0    0  9930   1   1     1
Kosuke  22    9     0    1       0      1    0    0  3596   1   1     1
Liz     30   12     1    0       0      0    0    0 24910   1   1     1
Gary    27   11     1    0       0      1    0    0  7506   1   1     1



RBuild autobuild user 2011-10-24