1

data.frame example:

dataframe

Hi guys, I need to set row names of this dataset to be equal to the polling id station variable. Then I have to use row name indexing to report the name of the polling station with psid 089/081.

I'm new to r, all help is highly appreciated.

digEmAll
  • 56,430
  • 9
  • 115
  • 140
ea9
  • 21
  • 4
  • Which variable is the polling station id ? – patL Feb 15 '18 at 08:16
  • 1
    Welcome to StackOverflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). This will make it much easier for others to help you. – Sotos Feb 15 '18 at 08:18
  • 1
    Please **[edit]** your post and show the actual data as text instead of screenshots. Others can't copy and paste from your images. [See here](https://meta.stackoverflow.com/a/285557/1402846) for details. Thank you. – Pang Feb 15 '18 at 08:18

2 Answers2

2

what about rownames(df) <- as.character(df$psid)?

drmariod
  • 11,106
  • 16
  • 64
  • 110
2

very simple.

row.names(yourdf) <- yourdf$psid
Seymour
  • 3,104
  • 2
  • 22
  • 46