Search Results
Search this site
38 results found with an empty search
- Make Your Shiny Apps Excel
"Can I view that in Excel?" The capabilities of R programming are expanding. Fast. From publication-quality graphics with ggplot2 to the capability to handle large scale computing with Apache Spark, the analytics community embraces R as a core environment. At CANA Advisors, we use the latest developments in order to deliver the fastest, most adaptable solutions. For clients, results need to be in a form that is easy to process by any member of their team-- with little to no learning curve. As analytics professionals, how can we ensure the best of both worlds? That is, state of the art solutions that produce results in the familiar form clients seek. In this post, I'll go over one such method: using R programming to export the results of a Shiny analysis to Microsoft Excel. For those not familiar with Shiny, it is a package to create interactive, aesthetically pleasing web apps with all the statistical capability of the R programming language. This brief tutorial will utilize the Shiny and XLConnect packages in R. The Method In this example, we'll be working with the iris data set [1], which contains information about the dimensions of different instances of various iris flower species. For the purpose of this tutorial, we'll assume we already have a functioning Shiny app and the data structures we are interested in saving. In this case, the data we'd like to store is reactive in nature. This means, it will change with user inputs. You can recognize calls to reactive expressions in the code below by their distinctive form expression(). To export a worksheet: 1. Lay the groundwork: Create the download button, workbook, and worksheets. 2. Assign the data frames to the worksheets. 3. Save and download. The Result The above process will take us from a shiny app like this: To an excel file like this: The Implementation # Load the shiny and XLConnect packages library(shiny); library(XLConnect) # Create and label the download button that will appear in the shiny app renderUI({ downloadButton("downloadExcel", "Download") }) output$downloadFile <- downloadHandler(filename = "Iris_data.xlsx", content = function(file) # Name the file fname <- paste(file, "xlsx", sep = ".") # Create and assign names to the blank workbook and worksheets wb <- loadWorkbook(fname, create = TRUE) createSheet(wb, name = "Sepal Data") createSheet(wb, name = "Petal Data") # Write the reactive datasets to the appropriate worksheets writeWorksheet(wb, sepal(), sheet = "Sepal Data") writeWorksheet(wb, petal(), sheet = "Petal Data") # Save and prepare for download saveWorkbook(wb) file.rename(fname, file) }) To learn more about any of the features discussed above, use the ?topic feature in R. A more comprehensive overview of shiny is provided by RStudio here. Lucia Darrow is an valued Operation Research Analyst at CANA Advisors to read more R articles by her and other members of the CANA Team visit the CANA Blog. [1] In R, type ?iris to learn more than you would ever want to know about it. #R #Rstudio #shiny #XLConnect #ShinnyApps #codeexample #RStudio #programming #graphics #ggplot2 #LuciaDarrow
- The CANA Way: People Always Responding with Compassion (PARC)
It is somewhat difficult to convey the spirit of Camp PARC to someone unfamiliar with it. When describing the communal shower house and lack of air conditioning, the squeaky beds and sharing a cabin with up to 35 other people, plus whatever wildlife critters invite themselves in for the night, most people don't match my enthusiasm. It’s hard to put into words an experience so fulfilling, self-validating, yet humbling. A person so innocent, one who is open to your kindness, seeks nothing, yet is overwhelmed by your compassion and companionship, is someone truly worth meeting and making smile. Through Camp PARC we have 100+ of those people. One of the core values of CANA Advisors is to balance work and life through flexible working hours, encouraging each of us to pursue passions and focus on our personal goals. In July I chose to invest my time at Laurel Hill State Park in Somerset, Pennsylvania and volunteer for a local non-profit organization - Camp PARC. 2016 was my tenth year of service with the organization. Camp PARC is a privately funded service organization "[that] creates recreational and social opportunities for children and adults with mental and developmental disabilities (Down Syndrome, Fetal Alcohol Syndrome, severe autism, etc.) through its residential summer camp." With a mission to provide summer camp experiences to these special needs "campers," Camp PARC hosts three (3) unique weeks of camp: 7-day Main Camp is for anyone over 18 and has been the traditional format of the camp for over 50 years. 5-day Adult Mini Camp for those over 18 who cannot, or may not want to, keep up with the faster paced week-long camp 4-day Youth Mini Week for the younger crowd to experience their first time away from home overnight and start building new relationships. This year, a total of 130 campers attended our camp season. To add additional awe to the very special mission of Camp PARC, the camp is run ENTIRELY by volunteers and donations. From the cooks to the Directors, dishwashers to the very important nurses, and everyone in between, hundreds of people flock to this camp annually to lend a hand. The most important people, though, are the junior staff. These positions are filled by local young adults (ages 13-21) who volunteer a week (or three!!) of their summer to be paired with 1 - 2 campers. They provide 24-hour care for the duration of the camp session. Junior staff are responsible for serving campers food, keeping them safe, and ensuring all their needs are met, while also encouraging them to participate in activities, go outside of their comfort zone, and have fun. For a teenager who is just coming into their own as well, the interactions between junior counselor and camper is something very special. Day-to-day camp activities are organized and executed by the Senior Staff (this where I fit in!). We are adults over 21 and most of us have previously served as a junior counselor during our high school years. Even as jobs and families force us away from Western PA, several of our staff make the journey annually, traveling from Texas, Missouri, Alabama, Virginia, and all across Pennsylvania. In 2014 & 2015, I traveled in from Afghanistan because this camp is that special. Koa Beam, another CANA Advisors team member, was gracious enough to volunteer one morning and experienced first-hand the spirit of Camp PARC. "I just thought it was a great thing and seeing the kids you guys help out with is a daunting task, but so needed. My hat goes off to the people who volunteer a portion of their summer to go help-out. I just hope that my small contribution of time put a smile on at least one or two kids' faces and that they enjoyed my time there as well. It couldn't have been a nicer day." How many of us miss out on these kinds of people, opportunities, and smiles? It is amazing what happens when we put down our phones, walk away from our computers, and live in life’s beautiful and inspiring moments. Somehow, our ships sail straighter when we invest in others and balance ourselves. For more information about Camp PARC, please visit their website: http://campparc.org/ #camp #PARC #CANAAdvisors #volunteers #community #kindness #team #summer #connection


