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 > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
