LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  R node jpeg package

    Employee
    Posted 01-10-2014 15:48

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: raylee

    The setup instructions for the R node says to install the jpeg and png R packages. In R I can write images to do. How do I use the package in LAE?

    Assume I have an output pin called myOutput. If I do the following:

    myOutput <- hist(data$age)

    I get an error saying: Variable "myOutput" for output 1 not of class "data.frame" or "laeImage".

    I'm also curious how this laeImage works.


  • 2.  RE: R node jpeg package

    Employee
    Posted 01-25-2014 15:51

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ejones

    Use createImage() to do this. As soon as you call it the images will go to that specified output pin. See the Node Help for more details.

    Here is an example which is a modification of code in "An Introduction to R" r-intro.pdf page 21. First create an R node with three outputs named outD, outFr and thePlot. Then use the following code for the RScript. This example is also attached.

    d <- outer(0:9, 0:9)
    outD <- data.frame(d)

    fr <- table(outer(d, d, "-"))
    outFr <- data.frame(fr)

    createImage("thePlot")
    plot(as.numeric(names(fr)), fr, type="h",
    xlab="Determinant", ylab="Frequency")
    Attachments:
    RNodeJpeg.brg


  • 3.  RE: R node jpeg package

    Employee
    Posted 04-23-2014 02:22

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dsc88dsc88

    For those interested, here is a more colourful example image:


    node:Example_R_Chart_Image
    bretype:r::R
    editor:Label=Example R Chart Image
    editor:sortkey=5346787d2ba16e34_9
    input:5346787f7311612a/myInput=Static_Data_2.40fe6c55598828e5
    output:5346790939853e75/ExampleImage=
    prop:RScript=<<EOX
    # Display the Student's t distributions with various degrees of freedom and compare to the normal distribution

    x <- seq(-4, 4, length=1000)
    hx <- dnorm(x)
    outD <- data.frame(hx)

    degf <- c(1, 3, 8, 30)
    colors <- c("red", "blue", "darkgreen", "gold", "black")
    labels <- c("df=1", "df=3", "df=8", "df=30", "normal")
    outFr <- data.frame(degf)

    createImage("ExampleImage")
    plot(x, hx, type="l", lty=2, xlab="x value",
    ylab="Density", main="Comparison of t Distributions")

    for (i in 1:4){
    lines(x, dt(x,degf[i]), lwd=2, col=colors[i])
    }

    legend("topright", inset=.05, title="Distributions",
    labels, lwd=2, lty=c(1, 1, 1, 1, 2), col=colors)

    EOX
    editor:XY=390,340
    end:Example_R_Chart_Image


  • 4.  RE: R node jpeg package

    Employee
    Posted 05-16-2014 06:20

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dsc88dsc88

    For the above - I would like to clarify that the node above can be connected to the default Static Data node.

    For those that do not have R configured, the attached image shows what the chart looks like.

    Example_R_Chart_Image.jpg