Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in model.frame.default(weights, data = list(OUTCOME = c(1, 1, 1, : object is not a matrix #12

Closed
b-w-a opened this Issue Feb 3, 2019 · 6 comments

Comments

Projects
None yet
3 participants
@b-w-a
Copy link

b-w-a commented Feb 3, 2019

Cannot get past this error code and not sure what the issue is. Tried lots of things to match some of the formatting of the 'immigration' data set, but cant get anything to work. I stacked 4 data.frames exported from read.qualtrics where I added a group variable based off race/ethnic group.

Happy to send the data directly, but don't to post here.

Put your code here:

## load package
library("cregg")

model <- selected ~ Convenience + Crime + Housing.Cost + Neighborhood.Composition +
  Neighborhood.Quality + School.Quality + Type.of.Place

out <- cj(df, model, id = ~ Response.ID, estimate = "mm", by ~ group)


## session info for your system
sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6
@leeper

This comment has been minimized.

Copy link
Owner

leeper commented Feb 4, 2019

Is this the exact code? Are you just missing an = in by = ~ group?

@b-w-a

This comment has been minimized.

Copy link
Author

b-w-a commented Feb 4, 2019

Ok, well that solved that problem! I had that in earlier code and still could not get it to run. Now when I run the code I get Error in fix.by(by.y, y) : 'by' must specify a uniquely valid column

However, that is only when i read the data in from a .csv using read.csv. When I stack the object from read.qualtrics, I don't have the issue. Thanks for your help, I got it working.


@leeper leeper added the question label Feb 16, 2019

@leeper leeper closed this Feb 16, 2019

@GitHubKawata

This comment has been minimized.

Copy link

GitHubKawata commented Mar 3, 2019

I also have the same error - Has this question been answered elsewhere?

@b-w-a

This comment has been minimized.

Copy link
Author

b-w-a commented Mar 4, 2019

Yeah, I think it has to do with structure of the data.frame. I didn't 100% check this, but when the data.frame from cjoint::read.qualtrics was passed to cregg I had no issues. When saved as a .csv and read using readr::read_csv it gives issues since readr::read_csv reads the factors as characters by default. My guess is ensuring those values are factors you should be fine.

@leeper leeper reopened this Mar 4, 2019

@leeper

This comment has been minimized.

Copy link
Owner

leeper commented Mar 4, 2019

If anyone can provide a minimal reproducible example of the problem (even using just a toy dataset), I can investigate more and try to provide a more informative error message.

@leeper leeper added bug good first issue and removed question labels Mar 4, 2019

@leeper

This comment has been minimized.

Copy link
Owner

leeper commented Apr 7, 2019

I think this is resolved by #25. If not, I will re-open.

@leeper leeper closed this Apr 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.