This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
From the other direction, I know nothing of the ADF test. However, I've attached a workflow that generates some dummy data and passes it into R. I then run the ADF test on one of the variables; (again: I don't know what the test is, at all, so please take with a grain of salt).
I then pass the original dataset to Output#1 and the results of the ADF test to Output#2.
Thanks soooooooo much. That was above and beyond anything I thought i'd get. Thanks so much for the help.
I have an additional question if you don't mind: Is there a way for me to wrap it in a loop? Like lets say I have a set of 1000 records for 3 Widgets. Is there a way to loop through and have 3 records for output by my WidgetID? I would think it would have less overhead than wrapping this in a macro and calling R multiple times.
I have attached an adapted version of your wf as an example.
Example "looped" output
Again thanks so much for the help. Sorry if I am not explaining it precisely I am not super versed in R jargon.
again thanks so much for the help. That was definitely what i was looking for but i think i messed up on the example. I was just trying to convey the three input sets. How can i get the rest of the results that i saw with the first workflow you provided?
statistic parameter alternative p.value method data.name -10.1034752108035 9 stationary 0.01 Augmented Dickey-Fuller Test df$r
I tinkered around and dropped the "[, ]" off the outDF which got me some results that i can transpose but i just wanted to get your opinion on whether that was SOP or if im just hacking it together. Here is the code i updated:
df <- as.data.frame(read.Alteryx("#1", mode="data.frame"),stringsAsFactors=FALSE)
# ADF test on column "r" grouped by WidgetID...
outDF <- aggregate(df$r, list(df$WidgetID), adf.test)
# alteryx often prefers everything as character data...
outDF <- lapply(outDF[,], as.character)
I had another look at it and, frankly, I'm not exactly polished on the R apply/grouping functions. Based on this post at StackOverflow, and in particular the answer that looks at performance, I tried it using a data.table rather than a data.frame, and the code is actually almost identical, and should be faster if you're running a lot of data through it.
It also didn't have any trouble with the format of the output (so I could exclude the lappy/as.character stuff entirely, and it provided the output pretty much exactly as you desire, column headers and all:
... although, you may have to sort it; for some reason it comes in haphazard order for WidgetID.