June 2017
Beginner to intermediate
576 pages
15h 22m
English
The colors() function returns a list of colors that are used in the current palette. We can then perform a little code manipulation in conjunction with the gsub() function that we just used to replace all of the specified colors from OnlineRetail$Description with blanks.
We will also use the kable() function, which is contained within the knitr package, in order to produce simple HTML tables of the results:
# compute the length of the field before changes before <- sum(nchar(OnlineRetail$Description)) # get the unique colors returned from the colors function, and remove any digits found at the end of the string # get the unique colors col2 <- unique(gsub("[0-9]+", "", colors(TRUE))) #Now we will filter out any colors ...