Data for periodic table of the elements

elements

Examples

# \donttest{ # prepare data elements <- subset(elements, !is.na(group)) elements$group <- as.character(elements$group) elements$period <- as.character(elements$period) # add colors for groups metals <- c("alkali metal", "alkaline earth metal", "halogen", "metal", "metalloid", "noble gas", "nonmetal", "transition metal") colors <- c("#a6cee3", "#1f78b4", "#fdbf6f", "#b2df8a", "#33a02c", "#bbbb88", "#baa2a6", "#e08e79") elements$color <- colors[match(elements$metal, metals)] elements$type <- elements$metal # make coordinates for labels elements$symx <- paste(elements$group, ":0.1", sep = "") elements$numbery <- paste(elements$period, ":0.8", sep = "") elements$massy <- paste(elements$period, ":0.15", sep = "") elements$namey <- paste(elements$period, ":0.3", sep = "") # create figure p <- figure(title = "Periodic Table", tools = "", ylim = as.character(c(7:1)), xlim = as.character(1:18), xgrid = FALSE, ygrid = FALSE, xlab = "", ylab = "", height = 600, width = 1200) %>% # plot rectangles ly_crect(group, period, data = elements, 0.9, 0.9, fill_color = color, line_color = color, fill_alpha = 0.6, hover = list(name, atomic.number, type, atomic.mass, electronic.configuration)) %>% # add symbol text ly_text(symx, period, text = symbol, data = elements, font_style = "bold", font_size = "15pt", align = "left", baseline = "middle") %>% # add atomic number text ly_text(symx, numbery, text = atomic.number, data = elements, font_size = "9pt", align = "left", baseline = "middle") %>% # add name text ly_text(symx, namey, text = name, data = elements, font_size = "6pt", align = "left", baseline = "middle") %>% # add atomic mass text ly_text(symx, massy, text = atomic.mass, data = elements, font_size = "6pt", align = "left", baseline = "middle") p # }