添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
  • Previous message: [R] model.frame: object is not a matrix
  • Next message: [R] about subsetting vectors/list in R
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
    The problem was that my formula had 2 "~" in it.  It also had a lot of 
    duplicate terms, but by themselves they don't cause trouble.
    On 4/4/2013 5:30 PM, Ross Boylan wrote:
    > Over a decade ago there was a problem with model.frame when the 
    > variable names were long:
    > https://stat.ethz.ch/pipermail/r-help/2002-August/024492.html
    > I have similar symptoms with R 2.15.3 on Windows 7:
    > Browse[2]> x <- model.matrix(formula(myform), p$data)
    > Error in model.frame.default(object, data, xlev = xlev) (from 
    > mice.R#601) :
    >   object is not a matrix
    > My attempt at a work-around did not help:
    > Browse[2]> x <- model.matrix(formula(myform), as.matrix(p$data))
    > Error in model.frame.default(object, data, xlev = xlev) (from 
    > mice.R#601) :
    >   'data' must be a data.frame, not a matrix or an array
    > Browse[2]> formula(myform)
    > ~educ_sg + ethnic_sg + hiv + J10 + A5 + mar_stat + orientation +
    >     Born_US ~ educ_sg + ethnic_sg + hiv + J10 + A5 + mar_stat +
    >     orientation + Born_US + (DWPAD_ActAvoid + DWPAD_EducConf +
    >     DWPAD_PasAvoid + DWPAD_Support) * ethnic_sg * racGayDiscStress +
    > Notice there are many three-way interactions, which certainly will 
    > produce long column names.
    > There was a suggestion in the old thread to set width= in aov, for use 
    > by deparse, but I'm not using aov and there are no obvious hooks to 
    > deparse.  The level names are also long and include spaces, inequality 
    > signs, and periods (also "-" if it uses raw numeric values); perhaps 
    > that is the culprit.
    > Any suggestions for how to diagnose or fix?  This is all happening 
    > inside a package that is for general use, and so require recoding of 
    > variable and level names to something brief is not very attractive. 
    > However, changing these within the program might be workable.
    > Ross Boylan
    	
  • Previous message: [R] model.frame: object is not a matrix
  • Next message: [R] about subsetting vectors/list in R
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
  •