#Filters
library(plyr)
library(jsonlite)
b=read_json("S:\\Insight\\data\\info.JSON",simplifyVector = T)
b=as.data.frame(b)
b$agg=rep(1,length(b$index))
bb=ddply(b,.(Manufacturer),summarize,Freq=sum(agg))
cell=ddply(b,.(CellularCarrier),summarize,Freq=sum(agg))
batsize=ddply(b,.(BatteryCapacity),summarize,Freq=sum(agg))
perc=bb$Freq/sum(bb$Freq)*100
perccell=cell$Freq/sum(cell$Freq)*100
percbatsize=batsize$Freq/sum(batsize$Freq)*100
library(plotly)
p=plot_ly(bb,labels=~Manufacturer,values=~Freq,type="pie",textposition="inside",textinfo="label",hoverinfo="text",
text=paste(bb$Freq," devices, " ,perc,"%"),showlegend=F)%>%
layout(title = 'Manufacturer')
pcell=plot_ly(cell,labels=~CellularCarrier,values=~Freq,type="pie",textposition="inside",textinfo="label",hoverinfo="text",text=paste(cell$Freq," devices, " ,perccell,"%"),showlegend=F)%>%
layout(title = 'CellularCarrier')
pbatsize=plot_ly(batsize,labels=~BatteryCapacity,values=~Freq,type="pie",textposition="inside",textinfo="label",hoverinfo="text",text=paste(batsize$Freq," devices, " ,percbatsize,"%"),showlegend=F)%>%
layout(title = 'BatteryCapacity')
p
pcell
pbatsize