Alike Objects/Functions in R
Posted on Nov 05, 2010 in Computer Science
Things under legendu.net/outdated are outdated technologies that the author does not plan to update any more. Please look for better alternatives.
Matrix VS Data Frame:
-
The data in a matrix must be of the same type while different columns in a data frame can have different types.
-
A data frame is much bigger than a matrix with the same dimension. If possible, always use matrix instead of data frame to do computation. Especially, when you creating arrays using the function
array, you should avoid using a data frame as the data source (even if all columns of the data frame have the same type). A way to work around this is to first convert a data frame to a matrix and then use the matrix as the data source. -
A data frame has names for rows and columns by default while a matrix not.
sub VS gsub
- The function
subsubstitute only the first occurence of the string that matches the given pattern while functiongsubsubstitute all occurences of strings that matches the given pattern.
warning VS warnings
- The function
warningshows a user-defined warning message while the functionwarningsdisplays previously generated warning messages.