[R] Problem with GroupedData

Kingsford Jones kingsfordjones at gmail.com
Tue Jul 14 20:38:48 CEST 2009


Hi Fir,

Are you sure data2 is a data frame?  The error message suggests it
isn't.  Try class(data2) or str(data2) if you're not sure.

On another note -- perhaps it's better to avoid using groupedData.
I've used the nlme library for years without ever using the grouped
structure.  My opinion is that code is much clearer if modeling and
plotting calls do not implicitly rely on a non-standard data
structure.

hth,

Kingsford Jones

On Tue, Jul 14, 2009 at 8:54 AM, FMH<kagba2006 at yahoo.com> wrote:
> Hi,
>
> I have an original data frame with 8 columns of variables, which are stored in 'data1' frame.
>
> data1 <- read.csv("E:\\PHD GLASGOW UNIVERSITY\\Data\\R\\Colin\\Cailness21.csv")
> attach(data1)
> names(data1)
>
> [1] "Date"       "d"          "m"          "y"          "Time"
> [6] "Depth"      "Temp"       "Group_Time"
>
>
> Recently, i try two add a column into this data frame, but when i try to use the 'groupedData' function with this new data frame via command below, it reported the problem stated after the command below.
>
> library(nlme)
> tmp <- groupedData(Temp ~ d | Depth, data2, order.groups = TRUE, labels = list(x = "Month", y = "Temperature"), units = list(y = "0C"))
>
> Error in nfGroupedData(formula = Temp ~ d | Depth, data = data2, order.groups = TRUE,  :
>   second argument to groupedData must inherit from data.frame
>
>
> Could someone help me to sort out on this problem, please?
>
> Thank you
> Fir
>
>
>
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>




More information about the R-help mailing list