Nizamuddin Siddiqui has Published 2307 Articles

How to add a rank column in base R of a data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 05-Dec-2020 13:15:15

6K+ Views

Ranking of a variable has many objectives such as defining order based on hierarchy but in data science, we use it mainly for analyzing non-parametric data. The ranking of a variable in an R data frame can be done by using rank function. For example, if we have a data ... Read More

How to set the Y-axis tick marks using ggplot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 05-Dec-2020 13:12:08

6K+ Views

The default value of Y-axis tick marks using ggplot2 are taken by R using the provided data but we can set it by using scale_y_continuous function of ggplot2 package. For example, if we want to have values starting from 1 to 10 with a gap of 1 then we can ... Read More

How to match the names of a vector in sequence with string vector values in another vector having same values in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 05-Dec-2020 13:10:37

102 Views

If we want to match the names of a vector in sequence with string vector values in another vector having same values then pmatch function can be used. The pmatch function means pattern match hence it matches all the corresponding values and returns the index of the values. Check out ... Read More

How to subset rows of an R data frame based on duplicate values in a particular column?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 05-Dec-2020 13:06:08

10K+ Views

Duplication is also a problem that we face during data analysis. We can find the rows with duplicated values in a particular column of an R data frame by using duplicated function inside the subset function. This will return only the duplicate rows based on the column we choose that ... Read More

How to concatenate string vectors separated with hyphen in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 05-Dec-2020 13:03:09

345 Views

The concatenation of string vectors will create combination of the values in the vectors thus, we can use them for interaction between/among the vectors. In R, we can use expand.grid along with apply to create such type of combinations as shown in the below examples.Example 1 Live Demox1Read More

What are some examples of data sets with missing values in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 05-Dec-2020 13:01:43

676 Views

Instructors/educators often need to teach missing value imputation to their students; hence they require datasets that contains some missing values or they need to create one. We also have some data sets with missing values available in R such as airquality data in base R and food data in VIM ... Read More

How to detect a binary column defined with 0 and 1 in an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 05-Dec-2020 12:54:26

726 Views

If a column in an R data frame has only two values 0 and 1 then we call it a binary column but it is not necessary that a binary column needs to be defined with 0 and 1 only but it is a general convention. To detect a binary ... Read More

How to perform a left outer join using linq extension methods in C#?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 05-Dec-2020 06:45:26

1K+ Views

With INNER JOIN only the matching elements are included in the result set. Non-matching elements are excluded from the result set.With LEFT OUTER JOIN all the matching elements + all the non-matching elements from the left collection are included in the result set.Let us understand implementing Left Outer Join with an example. ... Read More

How to display methods and properties using reflection in C#?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 05-Dec-2020 06:43:53

195 Views

Reflection is the process of describing the metadata of types, methods and fields in a code. The namespace System.Reflection enables you to obtain data about the loaded assemblies, the elements within them like classes, methods and value types. There are numerous classes of System.Reflection but the most commonly used ones ... Read More

How to implement dependency injection using Interface-based injection in C#?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 05-Dec-2020 06:42:43

3K+ Views

The process of injecting (converting) coupled (dependent) objects into decoupled (independent) objects is called Dependency Injection.Types of Dependency InjectionThere are four types of DI −Constructor InjectionSetter InjectionInterface-based injectionService Locator InjectionInterface InjectionInterface Injection is similar to Getter and Setter DI, the Getter, and Setter DI use default getter and setter but ... Read More

Advertisements