Displaying 2 results from an estimated 2 matches for "whichid".
Did you mean:
whichi
2012 Jun 20
3
data normalization
...le to use 2 loops to do the normalization, however, as 2 loops took
a long time for the calculation, I don't know whether there's a better way
to do it.
I have the following code with only 1 loop, but it did not work. Can anyone
help with this? Thanks,
IDS <- unique(data.frame$ID)
for(WhichID in IDS)
{
subset <- data.frame[,"ID"] == WhichID
DVREAL <- data.frame[subset,"DV"]
DVNORM[WhichID] <- DVREAL/DVREAL[1]
}
--
View this message in context: http://r.789695.n4.nabble.com/data-normalization-tp4633911.html
Sent from the R help mailing list archive at...
2006 Jun 08
1
Formatting numbers for printing
...012, i.e., the first two
digits padded to the left by a zero, followed by a dash, followed by
the final three digits, also padded to the left by zeros.
I can do this with brute force:
FirstPart <- sprintf("%03d", floor(Number / 1000))
SecondPart <- sprintf("%03d", WhichID %% 1000)
Combined <- paste(FirstPart, "-", SecondPart, sep="")
But, I suspect that there is some more clever means to accomplish
this using formatC or sprintf. Unfortunately, the help pages don't
provide sufficient insight. I would appreciate any tricks to
accom...