>> How about an argument to lapply which would specify the [ or [[ subseting
>> to use
>> in the splitting of the vector?
>> Or may be a different set of functions lapply1,
>> sapply1?
>>
>>
> I'm not sure what you want exactly, but  what about just using mapply over
> the names and vector elements?
>

General rule for "[[" operator is to extract the atomic part of the object.
"[" instead returns an object of the same type as original.

Just imagine an S4 objects with multiple parallel vectors as slots. My "["
extracts an object of the same class as the original, but now, in each slot
is an element with length one.

With current tools in R one can not loop through such an object easily. If a
version of "lapply" would exist which would split the original object with
"[" the problem would be solved.

Thanks for the tip on mapply, works for the names indeed. Never occurred to
me, ashamed.

>
>
>> I believe this pattern is rather common for other users as well.
>>
>> Thanks.
>> VS.
>>
>> ______________________________________________
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to