[R] grid: dividing units by numbers
Deepayan Sarkar
deepayan at stat.wisc.edu
Wed Oct 29 17:04:03 CET 2003
On Wednesday 29 October 2003 09:36, Wolfram Fischer wrote:
> How can I divide a unit by an number
> or average a vector of units, e.g.:
>
> u1 <- unit( 3, 'npc' )
> u2 <- unit( 6, 'npc' )
>
> u1 / 2
0.5 * u1
> ( u1 + u2 ) / 2
0.5 * (u1 + u2)
> mean( unit.c(u1,u2) )
Not sure if that's generally doable (other than adding all the units one at a
time in a loop and then multiplying by 1/length).
But if all your units are going to be "npc", you might as well keep the 'x'-s
separate and do arithmetic on them.
HTH,
Deepayan
> I would use that e.g. to to calculate the coordinates
> of the midpoint of a line.
>
> Wolfram
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list