I have a .txt
file that contains row names. However, R set the row names as the first column.
相关问题
- R - Quantstart: Testing Strategy on Multiple Equit
- How to remove spaces in between characters without
- Using predict with svyglm
- Reshape matrix by rows
- Extract P-Values from Dunnett Test into a Table by
相关文章
- How to convert summary output to a data frame?
- How to plot smoother curves in R
- Paste all possible diagonals of an n*n matrix or d
- ess-rdired: I get this error “no ESS process is as
- How to read local csv file in client side javascri
- How to use doMC under Windows or alternative paral
- dyLimit for limited time in Dygraphs
- Saving state of Shiny app to be restored later
See
?read.table
. Basically, when you useread.table
, you specify a number indicating the column:If you used
read.table()
(or one of it's ilk, e.g.read.csv()
) then the easy fix is to change the call to:where
....
is other arguments you needed/used. Therow.names
argument take the column number of the data file from which to take the row names. It need not be the first column. See?read.table
for details/info.If you already have the data in R and can;t be bothered to re-read it, or is came from another route, just set the
rownames
attribute and remove the first variable from the object (assumingobj
is your object)