I have completed PCA in R using example code from stat quest <https://github.com/StatQuest/pca_demo/blob/master/pca_demo.R> 
(with my own data in it, dataframe called "PCA4", which was then named PCstats for the PCA) :

[Dataset](https://i.stack.imgur.com/R8igU.png)

> 
> dput(PCA4)
> 
> 
> 

```
structure(list(X40.45cm = c(0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L), X50.55cm = c(0L, 0L, 0L, 0L, 0L, 
3L, 0L, 0L, 0L, 0L, 32L, 0L, 64L, 96L, 0L, 0L), X60.65cm = c(0L, 
3L, 1L, 64L, 3L, 3L, 0L, 0L, 128L, 0L, 0L, 0L, 352L, 512L, 160L, 
0L), X70.75cm = c(1L, 7L, 0L, 32L, 33L, 7L, 1L, 0L, 256L, 32L, 
0L, 0L, 352L, 544L, 320L, 0L), X80.85cm = c(109L, 1L, 2L, 11L, 
164L, 34L, 2L, 64L, 480L, 32L, 160L, 96L, 352L, 1184L, 224L, 
32L)), .Names = c("X40.45cm", "X50.55cm", "X60.65cm", "X70.75cm", 
"X80.85cm"), class = "data.frame", row.names = c(NA, -16L))

```

My data consists of samples in the columns and then each row is a type of species and the given number of those found in each sample. 
In order to complete the PCA I had to remove the species names, but I think this may now be hindering my ability to generate loading scores. The code I'm trying to use is below:

```
loading_scores <- PCstats$rotation[,1]
species_scores <- abs(loading_scores)
species_score_ranked <- sort(species_scores, decreasing=TRUE)
top_10_species <- names(species_score_ranked[1:10])

top_10_species 
PCstats$rotation[top_10_species,1]

```

However, when I input this it just says numeric (0) and then NULL.

I apologise if this is badly explained, I've never asked a question on here before, but if you need any more info or clarification please let me know- any help is gratefully received! 

Many thanks!