Displaying 3 results from an estimated 3 matches for "myattribute".
2006 Jan 20
2
assign object to list
Dear all
I want to generate a list like this:
a <- data.frame(1:10)
attr(a,'myattribute') <- 'something'
b <- data.frame(11:20)
attr(b,'myattribute') <- 'anything'
mylist <- list(a,b)
Is there a way to place the dataframes into the list giving them the
attribute at the same time?
I don't want to create all the dataframes in my workspace fi...
2018 Oct 15
2
sys.call() inside replacement functions incorrectly returns *tmp*
...) )
massign (r, theta) = cart2polar (x, y)
Now, I'm considering a multiple assignment operator, so something like:
c (theta, r) $<-$ cart2polar (x, y)
And while we're on the topic, I'm also considering an attribute operator
(to access object attributes), something like:
myobject%$%myattribute
This would be similar to . in C++/Java or @ in S4.
And seems like something obvious that's missing from R.
Implementing an attribute read this way is easy, however, implementing an
attribute assignment this way (without language level support) is difficult.
kind regards
Abs
[[alternative...
2018 Oct 15
4
sys.call() inside replacement functions incorrectly returns *tmp*
Kia Ora
Let's say we have:
"myreplacementfunction<-" = function (..., value)
{ call = sys.call ()
print (as.list (call) )
0
}
Then we call:
x = 0
myreplacementfunction (x, y, z) = 0
It will return:
[[1]]
`myreplacementfunction<-`
[[2]]
`*tmp*`
[[3]]
y
[[4]]
z
$value
<promise: 0x06fb6968>
There's two problems here.
Firstly, x has to be defined otherwise we