Closed tsquall121 closed 1 year ago
This can be solved by transforming the tibble
to a data.frame
. I found the error messages not very helpful. You @adamrauh may want to remind people about transforming the dataset to a dataframe given that nowadays tibble
is the default for many datasets. Or, is it possible to add one line in your source code to coerce the input data as data.frame
? The following if statements only work when the data is a data.frame
. If it is a tibble
, it returns neither integer
nor numeric
even if the unit.id
and time.id
are formatted properly.
data <- as.data.frame(data)
if(!class(data[, unit.id]) %in% c("integer", "numeric")) stop("please convert unit id column to integer or numeric")
if(class(data[, time.id]) != "integer") stop("please convert time id to consecutive integers")
Hi @tsquall121 , thanks for raising this. I believe this should be fixed the most recent version of the se_comparison
branch. It just hasn't made its way onto the CRAN version yet.
Hello, I was having so much trouble when trying to use the
DisplayTreatment
andPanelMatch
functions on my own data. The persistent error messages are "please convert time id to consecutive integers" forDisplayTreatment
and "please convert time id to consecutive integers" forPanelMatch
, when, in fact, my time id column is converted to consecutive integers and unit id column is also integers. Below is the code to generate simulated data.Both
id
andyear
in the tibble are integers and consecutive.id
goes from 1 to 746 whileyear
ranges from 1985 to 2021.However, when I ran the following code, I encountered the error messages mentioned above.
When looking at the example data in the
PanelMatch
package, thewbcode2
column (i.e., unit id) fordem
data set is not consecutive even though the column type is integer. The following code showswbcode2
column is NOT consecutive.However, the
id
column in thesimulated_data
is both integer and consecutive. The following code shows the proof.Similarly, when we look at the
year
column, both thedem
andsimulated_data
are integer and consecutive.Nonetheless, I still got persistent error messages. I was wondering whether this is a potential bug. Other people reported similar issues on Stackoverflow: https://stackoverflow.com/questions/74815244/panelmatch-r-errors-please-convert-time-id-to-consecutive-integers-and-pleas
Thank you all! @adamrauh @insongkim @erikhw @kosukeimai @ahalterman