Articles on Trending Technologies

Technical articles with clear explanations and examples

How to create a matrix in R by filling the data with predefined values in loop?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 22-Nov-2021 838 Views

If we know the total number of rows we want in our matrix and the number of columns then we can use matrix function to create a matrix by filling the data with predefined values. These values must be equal to the multiplication of number of rows and columns.Check out the below given examples to understand how it works.Example 1Following snippet creates a matrix in R by filling the data with predefined values in loop −n=20 k=2 data=rpois(n*k, 5) M1=matrix(data, nrow=n, ncol=k) M1If you execute the above given snippet, it generates the following output −     [, 1] [, 2] ...

Read More

How to convert character column of a matrix into numeric in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 22-Nov-2021 3K+ Views

If we have a matrix that contains character columns and we want to convert a single column to numeric then we first need to convert the matrix into a data frame using as.data.frame function after that as.numeric function can be used to change the particular column to numeric type as shown in the below examples.Example 1Following snippet creates a matrix −M1

Read More

How to find the average of a particular column in R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 22-Nov-2021 14K+ Views

To find the average of a particular column in R data frame, we can take the help of delta ($) operator.For example, if we have a data frame called df that contains a column x then we can find the average of column x by using the command given below −mean(df$x)Example 1Following snippet creates a sample data frame −x1

Read More

How to find the mean of all matrices stored in an R list?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 22-Nov-2021 478 Views

To find the mean of all matrices stored in an R list, we can use sapply function along with mean function. For example, if we have a list called LIST that contains some matrices then the mean of each matrix can be found by using the command given below −sapply(LIST,mean)Check out the below given example to understand how it works.ExampleFollowing snippet creates a list of matrices −M1

Read More

How to update single value in an R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 22-Nov-2021 4K+ Views

To update single value in an R data frame, we can use row and column indices with single square brackets.For example, if we have a data frame called df that contains two columns and ten rows and if we want to change the fifth value in second column to 10 then we can use the command given below −df[5,2]

Read More

How to find the coordinate of a value in an R matrix?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 22-Nov-2021 2K+ Views

The coordinate of a value in an R matrix is the row and column intersection that is the row and column index for that particular value. This can be found by using which function.For example, if we have a matrix called M that contains value starting from 1 to 20 then we can find the coordinate of value 5 by using the command given below − which(M==5,arr.ind=TRUE)ExampleFollowing snippet creates a matrix −M1

Read More

What are the techniques of Discretization and Concept Hierarchy Generation for Numerical Data?

Ginni
Ginni
Updated on 19-Nov-2021 3K+ Views

It is complex and laborious to define concept hierarchies for numerical attributes because of the broad diversity of applicable data ranges and the frequent updates of data values. There are various methods of concept hierarchy generation for numeric data are as follows −Binning − Binning is a top-down splitting technique based on a defined number of bins. These methods are also used as discretization methods for numerosity reduction and concept hierarchy generation. These techniques can be used recursively to the resulting partitions to make concept hierarchies. Binning does not use class data and is, therefore, an unsupervised discretization technique. It ...

Read More

What is Data Discretization?

Ginni
Ginni
Updated on 19-Nov-2021 7K+ Views

The data discretization techniques can be used to reduce the number of values for a given continuous attribute by dividing the range of the attribute into intervals. Interval labels can be used to restore actual data values. It can be restoring multiple values of a continuous attribute with a small number of interval labels therefore decrease and simplifies the original information.This leads to a concise, easy-to-use, knowledge-level representation of mining results. Discretization techniques can be categorized depends on how the discretization is implemented, such as whether it uses class data or which direction it proceeds (i.e., top-down vs. bottom-up). If ...

Read More

Difference between Dimensionality Reduction and Numerosity Reduction?

Ginni
Ginni
Updated on 19-Nov-2021 1K+ Views

Dimensionality ReductionIn dimensionality reduction, data encoding or transformations are used to access a reduced or “compressed” depiction of the original data. If the original data can be regenerated from the compressed data without any loss of data, the data reduction is known as lossless. If data reconstructed is only approximated of the original data, then the data reduction is called lossy.The DWT is nearly associated with the discrete Fourier transform (DFT), a signal processing technique containing sines and cosines. In general, the DWT achieves better lossy compression. That is if a similar number of coefficients is maintained for a DWT ...

Read More

What is Numerosity Reduction?

Ginni
Ginni
Updated on 19-Nov-2021 2K+ Views

In the Numerosity reduction, the data volume is reduced by choosing an alternative, smaller form of data representation. These techniques may be parametric or nonparametric. For parametric methods, a model is used to estimate the data, so that only the data parameters need to be stored, instead of the actual data, for example, Log-linear models. Non-parametric methods are used for storing a reduced representation of the data which include histograms, clustering, and sampling.There are the following techniques of numerosity reduction which are as follows −Regression and Log-Linear Models − These models can be used to approximate the given data. In ...

Read More
Showing 47161–47170 of 61,297 articles
Advertisements