I'm sorry for such a basic question but I am having a heck of a time getting convert.inp to read my .inp file. I inherited a complex and large dataset with 1 group factor with 5 levels and 62 covariates. I have broken it down to just the encounter history and the group variable column.
Here is my code
bevi <- convert.inp('bevi_group_nofreq', group.df = data.frame(eco = c('oh','cip','ecp','ip','irvh')))
and a sample of the data
/*ch OH CIP ECP IP IRVH*/
00000.....00000 1 0 0 0 0
00000.....00000 1 0 0 0 0
00000.....00010 1 0 0 0 0
00000.....00000 1 0 0 0 0
00000.....00000 1 0 0 0 0
00000.....00000 1 0 0 0 0
00000.....00000 1 0 0 0 0
00000.....00000 1 0 0 0 0
00000.....00000 1 0 0 0 0
00000.....00000 1 0 0 0 0
00000.....00000 1 0 0 0 0
00000.....00000 1 0 0 0 0
00000.....00000 1 0 0 0 0
The group variable was originally coded as a dummy variable like this and when I run it this way I get the error
Error in `row.names<-.data.frame`(`*tmp*`, value = c("1:1", "1:2", "1:3", :
invalid 'row.names' length
If I add in a freq column I get this error
Error in convert.inp("bevi_eco", group.df = data.frame(eco = c("oh", "cip", :
Number of columns in data file does not match group/covariate specification
So to match the example dataset I changed the way the group was arranged to a column "eco" with all the values below like this both with and without the freq column.
/*ch freq eco*/
000000000000000 1 oh
000000000000000 1 oh
000000000000000 1 oh
000000000000000 1 oh
000010000000000 1 oh
000000010000000 1 oh
I get this error.
Error in convert.inp("bevi_eco_long", group.df = data.frame(eco = c("oh", :
Number of columns in data file does not match group/covariate specification
I have double checked the data set to make sure I only have those 5 values for eco, no blanks or typos. I am just at a loss for why this won't work. I have consulted others who know R very well but not Rmark and gone as far as I can troubleshooting this on my own. Please help!
Do I even need to use convert.inp or can I get my data in another way using base R to re-structure the data correctly?