I am having a problem with this code in my data, please help?

Error in pdata.frame(data, index) :
variable 'ccode' does not exist (individual index)

when I enter plm(govright2 ~ Health1, data = scandanavia.data, index = c("ccode"))

Welcometo the forum

I think we need to see more of your code and some sample data. See
FAQ Asking Questions

A handy way to supply some sample data is the dput() function. In the case of a large dataset something like dput(head(mydata, 100)) should supply the data we need. Just do dput(mydata) where mydata is your data. Copy the output and paste it here between
```

```

Thanks for your reply! I added screen shots below. V278 is Health 1.

Thank you but screenshots are close to useless when trying to diagnose a problem in R. We really need you to copy all of your code and paste it here between
```

```

and to supply data output by dput() in the same way.

In the case of a large dataset something like dput(head(mydata, 100)) should supply the data we need. Just do dput(mydata) where mydata is your data. Copy the output and paste it here between
```

```

It is better if you try to put an example of your database to get a more accurate help.
Checking your images you can see some errors in your script.

plm(govright2 ~ Health1, data = scandanavia.data, index = c("ccode"))

In some cases you use Health1 with spaces Health 1. If your original column has a space you could use it like this Health 1.

To check the correct name of your columns use:

names(scandanavia.data) # show the names like R read your data.

Another thing I notice is when using a multi-valued vector c. Is used to combine or concatenate elements in a vector.

plm(govright2 ~ Health1, data = scandanavia.data, index = c("ccode")) 
# the correct way is
plm(govright2 ~ Health1, data = scandanavia.data, index ="ccode" )  # 

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.