Wednesday, October 26, 2016

Shiny and R: How to Add Themes and Customize Error Messages

R Shiny themes and error messages

The purpose of Shiny is to provide an intuitive and user-friendly interface to R. R is a highly popular statistical environment for doing heavy data analysis and constructing statistical models, and therefore is highly popular among data scientists. However, for a user with a non-coding background, using R to conduct such analysis can become quite intensive. This is where Shiny Web Apps come in. Essentially, Shiny allows for a more intuitive graphical user interface that is still capable of conducting sophisticated data analysis --- without the need for extensive coding on the part of the end user.

In my article on using Shiny with R and HTML, I illustrated how an interactive web application can be created to conduct analysis without the need for direct manipulation of code. In this article, I'll use a slightly different model to illustrate how the Shiny environment can be customized to work with the end user in a more intuitive fashion. Essentially, the goal of this article is to illustrate how a user can:

  1. Build an application by linking the UI and server side
  2. How to customize the themes available in the Shiny Themes library
  3. Implement error messages in order to provide guidance to an end user on how to use a particular program

The program itself that is developed for this tutorial is quite basic: a slider input allows the user to manipulate a variable within the program by means of reactivity, which causes instantaneous changes in the line plot output that is developed by means of reactivity.

This inherent function gives Shiny a significant advantage over using R code as a stand-alone. Traditionally, in order to analyze the change in a particular variable, the code must be manipulated directly (or the data from which the code is reading), and this can ultimately become very inefficient. However, Shiny greatly speeds up this process by allowing the user to manipulate the variables in a highly intuitive manner, and changes are reflected instantly.

However, the whole purpose of Shiny is to make an R Script as interactive as possible. In this regard, the user will want to be able to add features to the program that go well beyond reactivity. Two such aspects of this that I will discuss in this tutorial are:

  1. Using shinythemes in order to customize the appearance of our Shiny appearance
  2. Constructing a validate() function in order to display an alert once variables are manipulated in a certain manner

Shiny Themes

In the UI of our original program, we did not specify a theme, and therefore ended up with quite a basic (default Bootstrap) view of our output:

default Shiny app view

When we defined the shinyUI(fluidPage(…)) function, we didn't specify a theme. In this instance, we're going to specify several of the themes available from the Shiny Themes package.

After we've specified shinyUI(fluidPage(…)), we're also specifying our theme as follows:

shinyUI(fluidPage(theme = shinytheme("cyborg")

the cyborg theme

From the above, we see that selecting the Cyborg theme gives our web app a dark background. As another example, let’s now select the Spacelab theme and see what we come up with:

the spacelab theme

These themes demonstrate more levels of customization depending on the other attributes in the Shiny code, such as additional buttons, tabs, etc. Feel free to experiment with the other themes at the RStudio GitHub account and see what you come up with!

Continue reading %Shiny and R: How to Add Themes and Customize Error Messages%


by Michael Grogan via SitePoint

4 Great Ways to Get Actionable Customer Feedback

A group having a discussion

Since the dawn of time, asking people what they wanted in order to make them a tailored offer is one of the founding bricks of smart commerce. In our fast-paced, highly technological and marketing-oriented world, asking people how they feel about you, what they want from you and what you can do to keep them happy sounds like a no-brainer.

We have customer satisfaction polls and surveys for everything these days, and seasoned businessmen and beginner entrepreneurs know that they should always get as much feedback from their clients as they can. However, the most popular question of them all "Are you satisfied with our product/service?" seems to lead nowhere: being a rather vague word expressing an average emotion, it doesn't tell you much about your company either.

I Can't Get No Satisfaction

Let's change perspective for a second: you use products and services every day. There are tens or hundreds of companies delivering the same thing and in competition with each other. They want to retain you as a faithful and returning customer and turn you into a conversion from here on in – which is exactly what you want from your own customers. So, one day, they send you a request to participate in their survey of customer satisfaction.

And you are satisfied with their dry cleaning services. But you are also satisfied with other dry cleaners' services you happened to use in the past. What makes the real difference between them? Which of the two companies is the one turning you into a zealot, a loyal client, a customer that will not sleep until they tell the entire world how ecstatic they are with that particular dry cleaner?

When it comes to surveying for satisfaction, you swim in murky waters, as the word doesn't give you a clear idea on what to do next to improve your business. So, let's change the tune a little and see if you can get actionable feedback instead of just feedback.

1. Survey Behavioral Insights - Vero Used Pop-Up Survey Questions

Now, this may sound quite complicated, but it isn't. Instead of asking your customers to offer you generalized feedback for products or services or their general position towards your company, you can individualize your surveys and ask people for real feedback related to specific issues that interest you:

  • Survey their interaction with your website landing page: is it catchy enough? Do they find what they are looking for just after a quick eye-browsing? Is there a visible search bar? Do they get confused by the template? What other things would they like to see the first second they land on your company's website?
  • Survey real-time interaction with a product you sell.

Tools like Qualaroo and Google Customer Survey allow you to ask people questions on the spot and redirect them to pages of interest in real time. They also allow you to understand customer behavior, issues and need for help. Listening to your clients in real time and registering their answers not only helps you learn what they want but also teaches you how to approach the new ones.

A good case study is Vero and their Qualaroo survey which helped them understand how users read their articles, why they subscribe to their newsletter and how they navigate the site. The on-site survey increased Vero's conversions by 25%.

The Lesson

Don't expect people to know what they want or how they feel and voluntarily share things with you. Get ahead of your competition and use on-site surveys that personalize the experience of your users and gather information from them. After all, you should learn from high-converting websites that do things differently instead of trying to reinvent the wheel.

2. Ask the Right Questions in Polls – Perfect Audience Is a Good Source of Inspiration

How many times did you answer a question along the lines of "On a scale from 1 to 10, how satisfied are you with our new toaster"? They say 5 and you are out of business.

When creating a poll or a survey, make sure you know exactly what you ask and guide people to tell you exactly how they feel. While scale polls are very useful (as we will see in the next example), they are not enough sometimes, as they can offer you a general feeling, not some actionable advice you can implement the next day to grow your business. So, let's see what can be done:

  • Ask open-ended questions and also offer multiple choice answers related to your products and services. Instead of "how happy are you with our new toaster" ask "what other features would you like our toaster to have?" or "pick one feature that you feel would make a powerful change to our toaster" – you may learn you should add a timer to the toaster to make morning breakfast more efficient or some safety measures so small children can use it as well.
  • Leave room for complex answers: How could we make servicing you easier? What do you love most about our products and why? What specific parts of our services pleased you the most and why?

The Lesson

The Perfect Audience case study shows the company performed quarterly surveys that mixed open questions with open-ended ones, multiple choice ones, and multiple selection options. Answering all these in less than five minutes is a plus. You can learn a great deal about specific products, issues, and problems and actively try to improve on them.

Continue reading %4 Great Ways to Get Actionable Customer Feedback%


by Amanda Wilks via SitePoint

Fun Functional Programming with the Choo Framework

Today we'll be exploring Choo by @yoshuawuyts — the little framework that could.

It's a brand new framework to help you build single page apps that includes state management, unidirectional data flow, views and a router. With Choo you'll be writing similar style applications to React and Redux but at a fraction of the cost (file size) and number of API's. If you prefer minimal frameworks and like playing with new technology at the bleeding edge, you'll enjoy exploring Choo. Because it's so slender another place it makes a lot of sense is for mobile web apps where you should keep the file size to a minimum.

There's nothing genuinely new that Choo introduces, it simply builds on top of a lot of good ideas that have come from React, Redux, Elm, the Functional Programming paradigm and other inspirations. It's a neat little API that wraps all of these good things into one cohesive package you can install and start building single page apps.

This article will be covering Choo v3. At the time of writing v4 is in alpha so you'll need keep an eye out for changes — this train is moving quickly.

Note: This article will make most sense if you have some knowledge of a declarative view library like React and a state management library like Redux. If you don't have experience with those yet you might find Choo Docs - Concepts offer more in depth explanations of the important concepts.

Do Try This At Home

Follow along by pulling down the demo repo and installing the dependencies.

git clone http://ift.tt/2dXBBcH
cd choo-demo
npm install

There's npm scripts to run each of the examples e.g.

npm run example-1
npm run example-2

Hello Choo

First, we need to require the choo package and create an app.

View file on GitHub: 1-hello-choo.js

const choo = require('choo')
const app = choo()

We use models to house our state and functions to modify it (reducers, effects & subscriptions), here we initialize our state with a title property.

app.model({
  state: {
    title: '🚂 Choo!'
  },
  reducers: {}
})

Views are functions that take state as input and return a single DOM node. The html function that ships with Choo is a wrapper around the yo-yo package.

const html = require('choo/html')
const myView = (state, prev, send) => html`
  <div>
    <h1>Hello ${state.title}</h1>
    <p>It's a pleasure to meet you.</p>
  </div>
`

This html`example` syntax may be new to you but there's no magic going on here, it's an ES6 tagged template literal. See the Let's Write Code with Kyle episode for an excellent explanation of them in detail.

Routes map URLs to views, in this case / matches all URLs.

app.router(route => [
  route('/', myView)
])

To get this locomotive moving we call app.start and append the root node to the document.

const tree = app.start()
document.body.appendChild(tree)

And we're done. Run npm run example-1 and you should see the following document:

<div>
  <h1>Hello 🚂 Choo!</h1>
  <p>It's a pleasure to meet you.</p>
</div>

We're making solid progress through Choo's tiny API. We have basic routing in place and are rendering views with data from our models. There's not all that much more to learn really.

Read more in the docs: Models, Views

Running Choo in the Browser

If you're following along at home the examples are all using a dev server named budo to compile the source with browserify and run the script in a simple HTML page. This is simplest way to play with Choo examples but you can also easily integrate Choo with other bundlers or take a look at the minimal vanilla approach if that's your jam.

Ch-ch-ch-changes

Now I'm sure by this point your mind is blown, alas there is zero point of using Choo to render static content like this. Choo becomes useful when you have changing state over time and dynamic views: that means responding to events, timers, network requests etc.

Continue reading %Fun Functional Programming with the Choo Framework%


by Mark Brown via SitePoint

Shopify App Development Made Simple with HTTP APIs and Guzzle

In this tutorial, you’re going to get started with developing Shopify apps. You’re going to create a simple app that lists out products from a Shopify store. The full source code of the app is available on Github. What are Shopify Apps? Shopify apps are a way of extending the functionality of a Shopify store […]

Continue reading %Shopify App Development Made Simple with HTTP APIs and Guzzle%


by Wern Ancheta via SitePoint

The Hideout

The Hideout is a studio of designers, developers and content makers based in the garden of England. We offer a full range of services and can help you from the very creation of an idea through to delivery and on-going support.


by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery

Octav Design

Expert en Mobile et Webdesign – DA Senior – Responsive Ergonomie et Design interfaces


by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery

Brando OnePage Agency WordPress

Brando is a completely modern, feature-rich, professionally designed, fully responsive and multi-purpose onepage WordPress theme with portfolio and blog features.


by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery