What is the difference between = and ==?

It depends on context as to what = means. == is always for testing equality. = can be in most cases used as a drop-in replacement for <-, the assignment operator.> x = 10 > x [1] 10 used as the separator for key-value pairs used to assign values to arguments in function calls.rnorm(n = 10, mean = 5, sd = 2) … Read more

Categories r

How to create an empty matrix in R?

The default for matrix is to have 1 column. To explicitly have 0 columns, you need to write A better way would be to preallocate the entire matrix and then fill it in

Categories r