Re: [R] extracting numeric values returned when using the by function to run the acf function

2022-05-10 Thread Sarah Goslee
Hi, You can either write a small function that returns just the values you want, or use a convenience function within by, as in: > by(RecallSmall[1:4,"value"],RecallSmall[1:4,"ID"], FUN=function(x){acf(x, > na.action=na.pass,plot=FALSE)$acf}) RecallSmall[1:4, "ID"]: 1 , , 1 [,1] [1,] 1.0

Re: [R] extracting numeric values returned when using the by function to run the acf function

2022-05-10 Thread Rui Barradas
Hello, by returns an object of class "by" that inherits from class "list". So assign its return value and then use sapply to extract the list members you want. RecallSmall <- data.frame(ID=c(1,1,1,1),value=c(6,5,3,4)) acf_list <- by(RecallSmall[1:4,"value"],RecallSmall[1:4,"ID"],acf,na.act

Re: [R] extracting numeric values returned when using the by function to run the acf function

2022-05-10 Thread Eric Berger
as.numeric(by(RecallSmall[1:4,"value"],RecallSmall[1:4,"ID"],acf,na.action=na.pass,plot=FALSE)[[1]]$acf) On Tue, May 10, 2022 at 8:29 PM Sorkin, John wrote: > I am using the by function to run the acf function. Each run of the by > function returns more information than I want. All I want is th