Introduction to ibmsunburst

2024-02-27

The goal of {ibmsunburst} is to wrap the JavaScript library that IBM have produced for making sunburst personality insights charts for use in R and R Markdown documents.

Use with example data

The package contains a few examples JSON files corresponding to output from the API.

ibmsunburst::ibmsunburst(system.file(
  "extdata", "profiles",
  "en_v2.json", package = "ibmsunburst"
),
                           version = "v2")
Big 5ValuesNeedsOpenness (98%)Hedonism (0%)Ideal (1%)Openness (98%)Conscientiousness (89%)Extraversion (34%)Agreeableness (5%)Emotional range (92%)Conservation (16%)Openness to change (59%)Hedonism (0%)Self-enhancement (1%)Self-transcendence (11%)Challenge (1%)Closeness (16%)Curiosity (65%)Excitement (9%)Harmony (6%)Ideal (1%)Liberty (6%)Love (3%)Practicality (5%)Self-expression (4%)Stability (38%)Structure (82%)Adventurousness (95%)Artistic interests (88%)Emotionality (17%)Imagination (20%)Intellect (98%)Authority-challenging (96%)Achievement striving (92%)Cautiousness (96%)Dutifulness (76%)Orderliness (48%)Self-discipline (82%)Self-efficacy (91%)Activity level (98%)Assertiveness (98%)Cheerfulness (19%)Excitement-seeking (22%)Outgoing (60%)Gregariousness (24%)Altruism (87%)Cooperation (76%)Modesty (35%)Uncompromising (65%)Sympathy (98%)Trust (92%)Fiery (2%)Prone to worry (5%)Melancholy (27%)Immoderation (1%)Self-consciousness (13%)Susceptible to stress (6%)
ibmsunburst::ibmsunburst(system.file(
  "extdata", "profiles",
  "en_v3.json", package = "ibmsunburst"
),
                           version = "v3")
Big 5ValuesNeedsOpenness (98%)Hedonism (0%)Ideal (1%)Openness (98%)Conscientiousness (89%)Extraversion (34%)Agreeableness (5%)Emotional range (92%)Conservation (16%)Openness to change (59%)Hedonism (0%)Self-enhancement (1%)Self-transcendence (11%)Challenge (1%)Closeness (16%)Curiosity (65%)Excitement (9%)Harmony (6%)Ideal (1%)Liberty (6%)Love (3%)Practicality (5%)Self-expression (4%)Stability (38%)Structure (82%)Adventurousness (95%)Artistic interests (88%)Emotionality (17%)Imagination (20%)Intellect (98%)Authority-challenging (96%)Achievement striving (92%)Cautiousness (96%)Dutifulness (76%)Orderliness (48%)Self-discipline (82%)Self-efficacy (91%)Activity level (98%)Assertiveness (98%)Cheerfulness (19%)Excitement-seeking (22%)Outgoing (60%)Gregariousness (24%)Altruism (87%)Cooperation (76%)Modesty (35%)Uncompromising (65%)Sympathy (98%)Trust (92%)Fiery (2%)Prone to worry (5%)Melancholy (27%)Immoderation (1%)Self-consciousness (13%)Susceptible to stress (6%)

If you use the wrong version argument, then the widget will be blank.

Use with real data

The actual use of the package is to apply it on the output from IBM Personality Insight API. ibmsunburst::ibmsunburst() accept the data as list, JSON or path to file.

Say you have a text file of someone’s writing, called “sample.txt”. Here’s how you could query the API. There is no R wrapper for it… yet?

key = "your-key-not-this"
url = "https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13"
uname="your-username-not-this"
pword="your-password"
library(httr)
cr=POST(url,
        authenticate(uname, pword),
        content_type("text/plain;charset=utf-8"),
        accept_json(),
        body=upload_file("sample.txt")
)
insightdata = content(cr)

The result is a list, that you can directly pass to ibmsunburst::ibmsunburst().

ibmsunburst::ibmsunburst(insightdata,
                         version = "v3")
Big 5ValuesNeedsOpenness (100%)Self-enhancement (0%)Challenge (0%)Openness (100%)Conscientiousness (99%)Extraversion (8%)Agreeableness (19%)Emotional range (95%)Conservation (52%)Openness to change (62%)Hedonism (1%)Self-enhancement (0%)Self-transcendence (35%)ChallengeCloseness (37%)Curiosity (85%)Excitement (12%)Harmony (47%)Ideal (2%)Liberty (11%)Love (1%)Practicality (2%)Self-expression (19%)Stability (40%)Structure (89%)Adventurousness (79%)Artistic interests (99%)Emotionality (77%)Imagination (31%)Intellect (100%)Authority-challenging (80%)Achievement striving (84%)Cautiousness (95%)Dutifulness (80%)Orderliness (76%)Self-discipline (71%)Self-efficacy (70%)Activity level (96%)Assertiveness (92%)Cheerfulness (23%)Excitement-seeking (21%)Outgoing (71%)Gregariousness (22%)Altruism (97%)Cooperation (82%)Modesty (77%)Uncompromising (95%)Sympathy (100%)Trust (83%)Fiery (1%)Prone to worry (6%)Melancholy (35%)Immoderation (1%)Self-consciousness (20%)Susceptible to stress (7%)

Enjoy visualizing IBM Personality Insights!