On 2015-03-27 09:19, Patrick Connolly wrote:

[...]

On Sun, 22-Mar-2015 at 08:06AM -0800, John Kane wrote:

|> Well, first off, you have no variable called "Name".  You have lost
|> the state names as they are rownames in the matrix state.x77 and
|> not a variable.

If you did this:

all.states  <- within(as.data.frame(state.x77), Name <- rownames(state.x77))
instead of
all.states  <- within(as.data.frame(state.x77), state <- rownames(state.x77))

Alternatively, since 'data.frame()' coerces internally, one could do

all.states <- data.frame(state.x77, Name = rownames(state.x77))


Henric Winell




then this would worka;
cold.states <- all.states[all.states$Frost > 150, c("Name", "Frost")]

Modify the above to match where my guess at what you tried is in error.


HTH


______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to