tbl_df vs data.frame

Home forums Other Discussions tbl_df vs data.frame

This topic contains 1 reply, has 2 voices, and was last updated by  henrik 3 months, 1 week ago.

  • Author
  • #169

    Paul Warren

    reading the same data in by two methods in RStudio gives different results from mixed in afex. One method of reading in is to Import Dataset from the Excel spreadsheet. The other is to save the Excel data as a .csv and read.csv. The former creates a tbl_df and the latter a data.frame. These give very different results when analysed by afex::mixed, though the data have the same source. Which should be trusted?

  • #170


    Your question unfortunately presents very little detail to understand what the actual problem is. I would guess it has something to do with the data types of the variables passed to mixed. Like most R modeling functions it behaves differently for factors versus numerical variables. You can check the type of your data with str(), e.g., str(my_data).

    Also, mixed should behave completely identical for data.frame and tbl_df as it converts the data to a data.frame (see line 164 at: https://github.com/singmann/afex/blob/master/R/mixed.R). If your could show that this is not the case, this would be a bug.

    If you want a more precise answer, provide a reproducible example: http://stackoverflow.com/q/5963269/289572

You must be logged in to reply to this topic.