0

I have a dataset that I am trying to analyze with PCA. The first column of my dataset is an ID and then the rest of the data. However, R adds on a first column to the dataset so that instead of the ID I want assigned to each row, it uses "1" , "2", "3", etc. as the row identifier. There is an R dataset I practiced with called mtcars - in this dataset it used the car names as each row identifier. How do I remove/prevent R from adding on a column that makes each row identifier an integer?

enter image description here

MrFlick
  • 195,160
  • 17
  • 277
  • 295
  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Pictures of data are not very helpful because we can't interact with them. – MrFlick Oct 14 '19 at 16:53
  • This has nothing to do with PCA, just how you imported the data. – G5W Oct 14 '19 at 17:00

1 Answers1

0

This can be done as follows

Data = read.csv("filename.csv",  row.names=1) # 1st column should contain the row names
UseR10085
  • 7,120
  • 3
  • 24
  • 54