Indexing in pdata.frame not working as it should be

Hi, could you edit to provide your example as a reproducible example, called a reprex, please, and correct the error?

df <-data.frame(name=c(rep("r1",152), rep("r2",152), rep("r3", 152)), year=c(1:152, 1:152, 1:152), y = y, var = x)  #tai
#> Error in data.frame(name = c(rep("r1", 152), rep("r2", 152), rep("r3", : object 'y' not found
b <- pdata.frame(df, index=c("name","year"))
#> Error in pdata.frame(df, index = c("name", "year")): variable name does not exist (individual index)
#> Error in print(b): object 'b' not found

Created on 2019-12-15 by the reprex package (v0.3.0)