Skip to content

Instantly share code, notes, and snippets.

View benjaminwnelson's full-sized avatar

Benjamin Nelson benjaminwnelson

View GitHub Profile
anonymous
anonymous / helath_analysis
Created March 30, 2015 13:19
Analyze your Health app data using R
# -*- coding: utf-8 -*-
# Setting up all required elements
setwd('~/Documents/Health')
options(stringsAsFactors=FALSE)
Sys.setlocale(category="LC_ALL", locale = "en_US.UTF-8")
library(XML)
library(ggplot2)
#####################
@ryanpraski
ryanpraski / apple_health_load_analysis_R.r
Last active April 30, 2023 21:08
Load Apple Health Kit export.xml file in R then analyze and visualize Steps Data using R. See the full post here: http://www.ryanpraski.com/apple-health-data-how-to-export-analyze-visualize-guide/
library(dplyr)
library(ggplot2)
library(lubridate)
library(XML)
#load apple health export.xml file
xml <- xmlParse("C:\\Users\\praskry\\Desktop\\apple_health_data\\export.xml")
#transform xml file to data frame - select the Record rows from the xml file
df <- XML:::xmlAttrsToDataFrame(xml["//Record"])