R How to call '[.class<-' directly -


out of curiosity, how call '[.class' function in r directly?

i know can do:

test <- c(2,4,6) test[2] 

but possible specify class directly? , if so, how?

'[.numeric<-'(test , 2) '[.numeric'(test , 2) 

i have tried these come

error: not find function "[.numeric" 

[ internal generic, means dispatch occurs in c, , base types (like numeric) don't have s3 methods in r. that's why there's no [.numeric or [<-.numeric.

it's not clear want, example, can do

test <- 1:3 `[`(test, 2) `[<-`(test, 2, 3) 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -