; > twoTimes(p[1:2]) <- c(100,102)
> Calling twoTimes<-: x= 1:2
> > p
> [1] 50 51 3 4 5
>
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
>
> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help
ling twoTimes<-: x= 1:2
> p
[1] 50 51 3 4 5
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of Harry Mamaysky
> Sent: Wednesday, July 10, 2
So how would I get the following to work?
> aa<-1
> aa
[1] 1
> 'foo<-' <- function(x,value) x<-value
> foo(aa)<-1:10
> aa
[1] 1 2 3 4 5 6 7 8 9 10
> # This doesn't work:
> foo(aa)[4:5] <- c(101,102)
Error in foo(aa)[4:5] <- c(101, 102) : could not find function "foo"
> # What I would like
I think the OP may perhaps want to define a method for "[<-" .
e.g. try:
methods("[<-")
If this is not it ... ??
Cheers,
Bert
On Wed, Jul 10, 2013 at 12:51 PM, David Winsemius
wrote:
>
> On Jul 10, 2013, at 12:17 PM, Harry Mamaysky wrote:
>
>> As I understand it rownames(aa) returns a copy of
On Jul 10, 2013, at 12:17 PM, Harry Mamaysky wrote:
> As I understand it rownames(aa) returns a copy of an attribute of aa. So
> changing the value of this vector should make the change to the copy of the
> row.names attribute. I would then have to set the original row.names equal to
> this co
As I understand it rownames(aa) returns a copy of an attribute of aa. So
changing the value of this vector should make the change to the copy of the
row.names attribute. I would then have to set the original row.names equal to
this copy to effect the change.
So my question is why "rownames(aa)[
On Jul 10, 2013, at 11:47 AM, Harry Mamaysky wrote:
> I know how to define replacement functions in R (i.e. ‘foo<-‘ <-
> function(x,value) x<-value, etc.), but how do you define replacement
> functions that operate on subsets of arrays (i.e. how do you pass an index
> into foo)?
> For example,
I know how to define replacement functions in R (i.e. âfoo<-â <-
function(x,value) x<-value, etc.), but how do you define replacement functions
that operate on subsets of arrays (i.e. how do you pass an index into foo)?
For example, why does the following use of ârownamesâ work?
> aa <-
8 matches
Mail list logo