Archive for the ‘R Programming’ Category

R(R Studio) Connection with PostgreSQL

R(R Studio) Connection with PostgreSQL: We have to use R package: RPostgreSQL 1. Install RPostgreSQL package install.packages(“RPostgreSQL”) Installing package into ‘C:/Users/pinnapav/Documents/R/win-library/3.3’ (as ‘lib’ is unspecified) trying URL ‘’ Content type ‘application/zip’ length 433117 bytes (422 KB) downloaded 422 KB package ‘RPostgreSQL’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\pinnapav\AppData\Local\Temp\RtmpWcxGA7\downloaded_packages 2. […]

Select numeric columns from a Data frame in R

We can get the list of columns in a data frame using sapply function. In this article, we are going extract the numeric columns of diamonds dataset. 1. Diamonds data frame contains numeric and noon-numeric columns. head(diamonds)

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 […]

Powered by k2schools