I know you already have a solution, but your original problem might have
been that you needed
attributes(Dataset1[[1]]) <-
i.e., double brackets, rather than
attributes(Dataset1[1]) <-
Example:
> foo <- data.frame(a=1:4, b=factor(letters[4]))
> attributes(foo[[2]])
$class
[1] "factor"
You can also upgrade to R-devel or to R 3.1.0 due out in a month or so
-- those will run this code much more efficiently.
Using setattr is OK if you really know what you are doing, but if you
are not careful using it can modify objects you do not intend to
modify.
Best,
luke
On Tue, 11 Mar 201
Apologies for the late reply. I was out on vacation.
I tried setattr() from data.table package and it worked like a magic.
Thanks a lot for the help. setattr() is really faster than "attributes".
Regards,
SG
On 22 February 2014 12:29, Philippe Grosjean wrote:
> You can use setattr() in the dat
You can use setattr() in the data.table package. It can be used too on
data.frames or other objects.
Best,
Philippe Grosjean
On 22 Feb 2014, at 03:13, Smart Guy wrote:
> Hi All
>
> I am having problem running the 'attributes' command to set a attribute on
> each column of a large dataset. Da
4 matches
Mail list logo