Skip to main content
added 217 characters in body
Source Link
Greg Burghardt
  • 46.4k
  • 8
  • 87
  • 150

I am way outside my area of specialty, but I think this is worth a small proof of concept, which would be appropriate when assessing the viability of an idea.

A cursory search on the web suggests R can be compiled to Web Assembly. This, coupled with web workers, might be a way to generate the visualization right in the browser. You can also export Web Assembly functions for JavaScript which might be a more intuitive developer experience. Using a web worker should make the rendering process feel more responsive because the web worker won't freeze the page while it crunches numbers.

This would be easier to set up than spinning up a web server to execute an R program, but performance might be an issue for large datasets or complex calculations. You become limited by the hardware on the client. I could see this turning your laptop into a space heater if you aren't careful.

If the visualization requires too much memory or processing time, you have no choice but to offload this to a server. Assuming you solve the myriad cyber security issues you encounter by exposing this to the web (internal or external) then you could look into web frameworks for R. Failing that, consider picking a language that has a good web framework which you are familiar with to provide the bridge between the browser and your R program.

Offloading this to a server allows you to cache visualizations. A small web app could start a process on the server pointing to the exe file for your R program and invoke it that way. For example, you can start an external executable from Python. There are some good web frameworks for Python, but that isn't your only language choice.

Another cursory search suggests you might be able to save the visualization as an SVG file. Save the file to hard disk and serve that from the web app if it exists. If the cached file doesn't, invoke the R program first, then attempt to serve the file again.

This is all very high level, and I have zero experience in R, but that's how I would approach this problem.

First, attempt to compile R to Web Assembly, and use web workers to render the visualization in the browser. If that turns your laptop into a space heater for the afternoon, then building a web app that invokes your R app is about your only option for something web based, unless you can generate the visualizations ahead of time and just serve them as static files.

I am way outside my area of specialty, but I think this is worth a small proof of concept, which would be appropriate when assessing the viability of an idea.

A cursory search on the web suggests R can be compiled to Web Assembly. This, coupled with web workers, might be a way to generate the visualization right in the browser. You can also export Web Assembly functions for JavaScript which might be a more intuitive developer experience. Using a web worker should make the rendering process feel more responsive because the web worker won't freeze the page while it crunches numbers.

This would be easier to set up than spinning up a web server to execute an R program, but performance might be an issue for large datasets or complex calculations. You become limited by the hardware on the client. I could see this turning your laptop into a space heater if you aren't careful.

If the visualization requires too much memory or processing time, you have no choice but to offload this to a server. Assuming you solve the myriad cyber security issues you encounter by exposing this to the web (internal or external) then you could look into web frameworks for R. Failing that, consider picking a language that has a good web framework which you are familiar with to provide the bridge between the browser and your R program.

Offloading this to a server allows you to cache visualizations. A small web app could start a process on the server pointing to the exe file for your R program and invoke it that way. Another cursory search suggests you might be able to save the visualization as an SVG file. Save the file to hard disk and serve that from the web app if it exists. If the cached file doesn't, invoke the R program first, then attempt to serve the file again.

This is all very high level, and I have zero experience in R, but that's how I would approach this problem.

First, attempt to compile R to Web Assembly, and use web workers to render the visualization in the browser. If that turns your laptop into a space heater for the afternoon, then building a web app that invokes your R app is about your only option for something web based, unless you can generate the visualizations ahead of time and just serve them as static files.

I am way outside my area of specialty, but I think this is worth a small proof of concept, which would be appropriate when assessing the viability of an idea.

A cursory search on the web suggests R can be compiled to Web Assembly. This, coupled with web workers, might be a way to generate the visualization right in the browser. You can also export Web Assembly functions for JavaScript which might be a more intuitive developer experience. Using a web worker should make the rendering process feel more responsive because the web worker won't freeze the page while it crunches numbers.

This would be easier to set up than spinning up a web server to execute an R program, but performance might be an issue for large datasets or complex calculations. You become limited by the hardware on the client. I could see this turning your laptop into a space heater if you aren't careful.

If the visualization requires too much memory or processing time, you have no choice but to offload this to a server. Assuming you solve the myriad cyber security issues you encounter by exposing this to the web (internal or external) then you could look into web frameworks for R. Failing that, consider picking a language that has a good web framework which you are familiar with to provide the bridge between the browser and your R program.

Offloading this to a server allows you to cache visualizations. A small web app could start a process on the server pointing to the exe file for your R program and invoke it that way. For example, you can start an external executable from Python. There are some good web frameworks for Python, but that isn't your only language choice.

Another cursory search suggests you might be able to save the visualization as an SVG file. Save the file to hard disk and serve that from the web app if it exists. If the cached file doesn't, invoke the R program first, then attempt to serve the file again.

This is all very high level, and I have zero experience in R, but that's how I would approach this problem.

First, attempt to compile R to Web Assembly, and use web workers to render the visualization in the browser. If that turns your laptop into a space heater for the afternoon, then building a web app that invokes your R app is about your only option for something web based, unless you can generate the visualizations ahead of time and just serve them as static files.

Source Link
Greg Burghardt
  • 46.4k
  • 8
  • 87
  • 150

I am way outside my area of specialty, but I think this is worth a small proof of concept, which would be appropriate when assessing the viability of an idea.

A cursory search on the web suggests R can be compiled to Web Assembly. This, coupled with web workers, might be a way to generate the visualization right in the browser. You can also export Web Assembly functions for JavaScript which might be a more intuitive developer experience. Using a web worker should make the rendering process feel more responsive because the web worker won't freeze the page while it crunches numbers.

This would be easier to set up than spinning up a web server to execute an R program, but performance might be an issue for large datasets or complex calculations. You become limited by the hardware on the client. I could see this turning your laptop into a space heater if you aren't careful.

If the visualization requires too much memory or processing time, you have no choice but to offload this to a server. Assuming you solve the myriad cyber security issues you encounter by exposing this to the web (internal or external) then you could look into web frameworks for R. Failing that, consider picking a language that has a good web framework which you are familiar with to provide the bridge between the browser and your R program.

Offloading this to a server allows you to cache visualizations. A small web app could start a process on the server pointing to the exe file for your R program and invoke it that way. Another cursory search suggests you might be able to save the visualization as an SVG file. Save the file to hard disk and serve that from the web app if it exists. If the cached file doesn't, invoke the R program first, then attempt to serve the file again.

This is all very high level, and I have zero experience in R, but that's how I would approach this problem.

First, attempt to compile R to Web Assembly, and use web workers to render the visualization in the browser. If that turns your laptop into a space heater for the afternoon, then building a web app that invokes your R app is about your only option for something web based, unless you can generate the visualizations ahead of time and just serve them as static files.