Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

How to output a summary in R

bruno_
6 - Meteoroid

I have a very simple R code that reads the input of two variables (x, y) and makes a polynomial regression. I want to output the "summary", but I don't know how. I can print in the Messages, but is it possible to put it in a output anchor (with the command "write.Alteryx()?)

 

My code so far:

a <- read.Alteryx("#1", mode="data.frame")
x<-a$x
y<-a$y
fit<-lm(y~x+I(x^2))
print(summary(fit))

7 REPLIES 7
pedrodrfaria
13 - Pulsar

Hi @bruno_ 

 

If you want to output to the output anchor, use this:

 

write.Alteryx(data.out, nOutput = 1)

 

Use this cheat sheet for reference:

 

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/A-Cheat-Sheet-of-Functions-to-Use-i... 

 

Pedro.

bruno_
6 - Meteoroid

Hi Pedro,

 

Actually my question is what to put in "data.out" of this function to output the Summary. I tried something like this:

write.Alteryx(summary(fit), nOutput = 1) 

 

pedrodrfaria
13 - Pulsar

In this case would be the variable, the table, the object you are trying to output. Is the variable "fit" ? Then just write "fit".

bruno_
6 - Meteoroid

I tried  "write.Alteryx(fit, 1)" but it returns an error.

pedrodrfaria
13 - Pulsar

@bruno_what is the error?

 

See below an example:

 

pedrodrfaria_0-1613654888673.png

 

Pedro.

 

bruno_
6 - Meteoroid

bruno__0-1613655038326.png

 

In your case the object is a string. In my case is a whole summary. I think that is not possible to output this kind of object, or I'm just doing it wrong.

pedrodrfaria
13 - Pulsar

You can try to convert it to a data frame and then output it 

 

pedrodrfaria_0-1613655259662.png

 

Pedro.

 

Labels