Help with shiny::reactiveFileReader()

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with shiny::reactiveFileReader()

Lars Bishop-2
Hello,

Is it possible to execute functions (outside the ui and server shiny
environments) after reading data using reactiveFileReader() ?

For example, I'd like to fit a linear model on data read using
reactiveFileReader() outside ui/server.


library(shiny)
library(dplyr)

bigData <- reactiveFileReader(1000, NULL, 'data.csv', read.csv)

fit <- lm(y ~., data = bigData())

ui <- function() {

}

server <- function(input, output) {

}

Thank you,
Lars.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Help with shiny::reactiveFileReader()

Jeff Newmiller
No. However, you can modify the global environment from within a function if you understand how variable scoping works. [1] See `<<-`. Be warned that this leads down a perilous path of confusing code (side effects) if misused.

[1] http://adv-r.had.co.nz/Environments.html
--
Sent from my phone. Please excuse my brevity.

On September 16, 2017 6:04:49 AM PDT, Lars Bishop <[hidden email]> wrote:

>Hello,
>
>Is it possible to execute functions (outside the ui and server shiny
>environments) after reading data using reactiveFileReader() ?
>
>For example, I'd like to fit a linear model on data read using
>reactiveFileReader() outside ui/server.
>
>
>library(shiny)
>library(dplyr)
>
>bigData <- reactiveFileReader(1000, NULL, 'data.csv', read.csv)
>
>fit <- lm(y ~., data = bigData())
>
>ui <- function() {
>
>}
>
>server <- function(input, output) {
>
>}
>
>Thank you,
>Lars.
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.