My script generates row and column names with increasingly large number of characters.
Is there a maximum number of characters in a row or column name permissible for a R matrix?
You're absolutely right: Table names are 30 characters maximum same as column names.
name , "Names are limited to 10,000 bytes (and were to 256 bytes in versions of R before 2.13.
Not quite--the big difference is that colnames also works for matrices, whereas names does not (just dataframes). In addition, you can use names to set/get the names of vectors (and, for obvious reasons, you can't do this with colnames--the result is NULL for getting and an error for setting).
colnames() method in R is used to rename and replace the column names of the data frame in R. The columns of the data frame can be renamed by specifying the new column names as a vector. The new name replaces the corresponding old name of the column in the data frame.
Row and column names are attributes of a data frame or matrix object. As such, they are only limited by the system resources available to R.
x <- data.frame(col = 0)
object.size(x)
# 680 bytes
# Huge name for a column
colnames(x)=paste(rep("x",10^8),collapse="")
object.size(x)
# 100000680 bytes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With