-
Notifications
You must be signed in to change notification settings - Fork 979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: rownames=
option for setDF
#1320
Labels
Comments
|
This was referenced Sep 10, 2015
Closed
Closed
arunsrinivasan
added a commit
that referenced
this issue
Sep 11, 2015
Closes #1320; setDF gains the rownames argument
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to play along with this vignette on combining spatial data by Roger Bivand & have run into the thorny issue that
Spatial*
objects (most importantlySpatialPolygons
) depend on adata.frame
's row names to communicate between the IDs used for plotting & the associated data.So while it's handy to have
sp@data
as adata.table
for various operations where I'm comfortable usingdata.table
syntax (merging, adding/dropping columns, etc.), I found that I neededsetDF
at a step used to match aSpatial*
object's IDs to its data (specifically these lines on page 3:row.names(nc90_df) <- paste(nc90_df$ST, nc90_df$CO, sep = ""); nc90b <- SpatialPolygonsDataFrame(nc90a, nc90_df)
).I was thinking it would be convenient for
setDF
to have an argument,rownames
parallel tosetDT
'skeep.rownames
to simultaneously assign non-sequential row names to the result, ideally (for parsimony) evaluating within thedata.table
's environment, e.g.setDF(sp@data, rownames = paste0(ST, CO))
, though explicitly calling thedata.table
environment would also be simple:setDF(sp@data, rownames = sp@data[, paste0(ST, CO)])
The text was updated successfully, but these errors were encountered: