Col() in R Gives Warning Message
On 6-Month-Old iMac with Osx V. 10.8.5 Using R v 2.15.2 (2012-10-26) with Either Rstudio or Terminal This Simple Code: M
on 6-month-old iMac with OSX v. 10.8.5 using R v 2.15.2 (2012-10-26) with either RStudio or Terminal this simple code:
m <- matrix(c(1,2,3,4),2)
yields the expected 2x2 matrix and row(m) yields the expected 2x2 matrix with row 1s in the first row and 2s in the second.
But col(m) gave the following error:
Warning message: In seq. int(0, 1, length.out = n): first element used of 'length.out' argument.
Curiously, the same code on a 5-year-old MacBook Air, OSX 10.6.8, but the same version of R gave the expected result for col(m) of 1's in the first col and 2s in the second.
Any suggestions?
1 Answer
As stated by other posters, this works on a current version of R. Some suggestions to figure out why it produces a warning for you:
- Check that you do not have a custom function called "col" in your workspace. Try rm(col) to remove.
Check if the following works
.Internal(col(c(2L, 2L)))If this does not work, I would suspect that you have a strange R build and would suggest re-downloading from CRAN.
- If the internal command works, use debug() to find out what is happening.