Posts Tagged ‘R’

R vs Python

R Programming Language Python Programming Language R favor for Statisticians and Mathematicians Python favor for computer scientists and software engineers R is Statistical tool Python is general purpose language

Sort dataframe by column in R

Sort dataframe by columns in R? We can sort the dataframe by column in R. Sort can be either ascending or descending order. Examples: 1. Create Dataframe df< -data.frame(x=c("A","B","K","M","L"), y=c(4,7,6,9,11), z=c(1,4,2,3,0))

Apply functions in R

Apply functions are alternatives to Loops in R. In this tutorial, we are going to discuss about apply and apply family functions. We are going to explain following apply functions with examples: apply() sapply() lapply() mapply() vapply() rep() rapply() tapply() apply Function:

dplyr Tutorial with examples

dplyr package is used for data manipulation, written by Hadley Wickham. In this tutorial, we are using R built-in dataset “mtcars” dataset for all examples. Installation of dplyr package Use install.packages(“package_name”) as shown below. > install.packages(“dplyr”)

Pipe %>% Operator in R

Pipe %>% Operator in R is used to sequence of multiple operations. Pipe operators, available in magrittr, dplyr, and other R packages. Aim of pipe is to increase the performance of operation. Usage: 1. Load dplyr(or magrittr) package. library(dplyr)

Error: package or namespace load failed for ‘ggplot2’

I have installed ggplot2 package successfully. This error occurred while loading package using R function library. >library(ggplot2) Error in loadNamespace(j < - i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : there is no package called ‘Rcpp’ Error: package or namespace load failed for ‘ggplot2’ Troubleshooting Steps:

How to install ggplot2 package in R

What is ggplot2? ggplot2 package is used to produce statistical, or data, graphics based on Grammar of Graphics. ggplot2 provides beautiful hassle-free plots. To use ggplot2,e have to install it. To use ggplot2 package, first we have to install it and then load it. Install ggplot2 package in R: 1. Install ggplot2 package with R […]

How to change Working Directory in R

When we open RStudio or R gui it uses Default Working Directory. getwd(): It is used to know the current working directory setwd(): It is used to change the current working directory to another. When RStudio started following things will happen: Executes the .Rprofile (if any) from the default working directory. Loads the .RData file […]

head and tail functions in R

head and tails function in R used to get first or last parts of a vector,table, matrix, data frame or function. head() function: Used to get first parts of vector,table, matrix, data frame or function. By default, it will provide first 6 rows. tail() function: Used to get last parts of vector,table, matrix, data frame […]

How to delete rows from Data Frame in R

There is no direct method to remove rows from R. We can remove the row(s) from Data Frame by creating new Data Frame. How to delete rows from Data Frame in R?

Powered by k2schools