I have frequency counts that line up with a set number of states of the world
Data=
S <- c("a","b","c","d","e")
n <- c(1,2,3,4,5)
df<- data.frame(S,n)
I want to create some values that line up with the n values for each, named with the relevant subscripts:
Pa = n for state a Pb = n for state b etc.
Even though I can go:
Pa <- 1
Pb <- 2
I will be using a lot of different dataframes that use the sames states but that will yield different values of n each time.
I fear that this is a horribly basic question but what can I do to create a Pa value for every possible n that lines up with state a?