R function for pictograms