On Thu, 26-Mar-2015 at 04:58PM -0400, yoursurrogate...@gmail.com wrote: [...] |> I agree with you on the indexing approach. But even after using |> within, I still get the same error. >
You leave us to guess just what you tried, but if you did this: > all.states <- within(as.data.frame(state.x77), state <- rownames(state.x77)) and then again did this: > cold.states <- all.states[all.states$Frost > 150, c("Name", "Frost")] of course it will give the same error, because as you haven't addressed the problem as you've been told 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)) 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 -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___ Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) ..... Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ______________________________________________ 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.