Re: [R] Why does `[<-.matrix` not exist in base R

2019-11-24 Thread Bert Gunter
Re: [<-. It is perhaps worth noting that the OP seems "misguided" in another sense. His complaint seems to rest on the assumption that because matrices and data frames both have a row/column structure, certain operations on them should be similar. I disagree. In fact, data frames and matrices are

[R] ggplot inside of the function

2019-11-24 Thread Thevaraja, Mayooran
Hello Folks I am working some R package development. When I was using ggplot inside of the function, I need to get the output graph's legend must be corresponding to the input parameters numerical value (need to be automatically changed when we input different parameters). Theref

Re: [R] Why does `[<-.matrix` not exist in base R

2019-11-24 Thread peter dalgaard
The subject is misguided. It is not a problem to assign to a subset of columns. The issue is that the assignment operation does not want to _expand_ the matrix automatically upon seeing an out-of-bounds index. E.g.: > M <- matrix(0,2,2) > M[,3]<-1 Error in `[<-`(`*tmp*`, , 3, value = 1) : subsc

Re: [R] Why does `[<-.matrix` not exist in base R

2019-11-24 Thread Ivan Krylov
Hello David, On Sat, 23 Nov 2019 11:58:42 -0500 David Disabato wrote: > For example, if I want to add a new column to a data.frame, I can do > something like `myDataFrame[, "newColumn"] <- NA`. Arguably, iterative growth of data structures is not the "R style", since it may lead to costly rea