String Manipulation String manipulation basically refers to the process of handling and analyzing strings . It involves various operations concerned with modification and parsing of strings to use and change its data . Paste: str <- paste(c(1:3), "4", sep = ":") print ( str ) ## "1:4" "2:4" "3:4" Concatenation: # Concatenation using cat() function str <- cat("learn", "code", "tech", sep = ":") print ( str ) ## learn:code:tech
Packages and Visualization
Loading and Packages R is not limited to the code provided by the R Core Team. It is very much a community effort, and there are thousands of add-on packages available to extend it. The majority of R packages are currently installed in an online repository called CRAN (the Comprehensive R Archive Network1) which is maintained by the R Core Team. Installing and using these add-on packages is an important part of the R experience
Loading Packages To load a package that is already installed on your machine, you call the library function We can load it with the library function: library(lattice) the functions provided by lattice. For example, displays a fancy dot plot of the famous Immer’s barley dataset: dotplot( variety ~ yield | site, data = barley, groups = year )
Scatter Plot A "scatter plot" is a type of plot used to display the relationship between two numerical variables, and plots one dot for each observation. It needs two vectors of same length, one for the x-axis (horizontal) and one for the y-axis (vertical): Example x <- c(5,7,8,7,2,2,9,4,11,12,9,6) y <- c(99,86,87,88,111,103,87,94,78,77,85,86) plot(x, y)