This is an R HTML document. When you click the Knit HTML button a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00
plot(cars)
plot of chunk unnamed-chunk-1

You can also embed plots, for example:

library(dplyr)
## Warning: package 'dplyr' was built under R version 3.4.4
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(jsonlite)
sampleData2 <-'[
     {"group": "fruits", "food": "apple"},
     {"group": "fruits", "food": "banana"},
     {"group": "vegetables", "food": "broccoli"},
     {"group": "vegetables", "food": "carrot"},
     {"group": "grains"}
   ]'


mydf <- fromJSON(sampleData2)
mydf
##        group     food
## 1     fruits    apple
## 2     fruits   banana
## 3 vegetables broccoli
## 4 vegetables   carrot
## 5     grains     <NA>
by_data2<-group_by(mydf,group)

by_data2 %>% select(group) %>% print()
## # A tibble: 5 x 1
## # Groups:   group [3]
##   group     
## * <chr>     
## 1 fruits    
## 2 fruits    
## 3 vegetables
## 4 vegetables
## 5 grains