Dear Patrick,

Try this:

NAMES=rownames(yourdata)
NAMES

See ?rownames for more information.

HTH,

Jorge


On Mon, Jun 23, 2008 at 12:09 PM, Patrick Richardson <[EMAIL PROTECTED]>
wrote:

>
> List,
>
> I'm trying to extract the row names of a table I have read into R.
>
> > data <- read.table("mesodata.txt", header=TRUE, row.names=1)
>
> When I try to extract them using,
>
> > names <- data$row.names
>
> I get,
>
> > names
> NULL
>
> I've tried changing to a matrix, data frame, etc. and still get "NULL".
> I've checked ?row.names as well as help on extracting part of an object,
> etc. and unless I'm missing something obvious (likely), I can't figure out
> how to extract them.
>
> BACKGROUND
> I want to extract the row names (which are basically gene id's) as well as
> some other columns (which I can do successfully) and "cbind" them into
> another data frame (which I can also do successfully). I just can't get the
> row names extracted (Assigned) to an seperate object.
>
> Any suggestions would be appreciated.
>
> Many Thanks,
>
> Patrick
>
>
>
> > sessionInfo()
> R version 2.7.0 (2008-04-22)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> --
> View this message in context:
> http://www.nabble.com/Extracting-%22row.names%22-tp18072521p18072521.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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