Nizamuddin Siddiqui has Published 2303 Articles

How to drop data frame columns in R by using column name?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Jul-2020 12:39:01

228 Views

Columns of a data frame can be dropped by creating an object of columns that we want to drop or an object of columns that we want to keep.Example> df keeps df[keeps] Var3 Var4 1 21 31 2 22 32 3 23 33 4 24 34 5 25 35 6 26 36 7 27 37 8 28 38 9 29 39 10 30 40

How to extract p-value and R-squared from a linear regression in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Jul-2020 12:36:36

2K+ Views

We can use regression model object name with $r.squared to find the R-squared and a user defined function to extract the p-value.ExampleExtracting R-Squared> x y LinearRegression summary(LinearRegression)$r.squared [1] 0.2814271Extracting p-value> Regressionp

How to sort a data frame in R by multiple columns together?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Jul-2020 12:33:58

354 Views

We can sort a data frame by multiple columns using order function.ExampleConsider the below data frame −> df df x1 x2 x3 x4 1 Hi A 4 9 2 Med B 7 5 3 Hi D 5 7 4 Low C 3 4Let’s say we want to sort the ... Read More

Advertisements