Graphics Reference
In-Depth Information
datac$ci <- datac$se * ciMult
return
return (datac)
}
The following usage example has a 99% confidence interval and handles NA s and missing com-
binations:
# Remove all rows with both c52 and d21
c2 <- subset(cabbages, !( Cult == "c52" & Date == "d21" ) )
# Set some values to NA
c2$HeadWt[c( 1 , 20 , 45 )] <- NNA
summarySE(c2, "HeadWt" , c( "Cult" , "Date" ), conf.interval = .99 ,
na.rm = TRUE
TRUE , . drop = FALSE
FALSE )
Cult Date n HeadWt sd se ci
c39 d16 9 3.255556 0.9824855 0.32749517 1.0988731
c39 d20 9 2.722222 0.1394433 0.04648111 0.1559621
c39 d21 10 2.740000 0.9834181 0.31098410 1.0106472
c52 d16 10 2.260000 0.4452215 0.14079141 0.4575489
c52 d20 9 3.044444 0.8094923 0.26983077 0.9053867
c52 d21 0
NaN
NA
NA
NA
Warning message:
In qt(p, df, lower.tail, log.p) : NaNs produced
It will give this warning message when there are missing combinations. This isn't a problem; it
just indicates that it couldn't calculate a quantile for a group with no observations.
See Also
See Adding Error Bars to use the values calculated here to add error bars to a graph.
Converting Data from Wide to Long
Problem
You want to convert a data frame from “wide” format to “long” format.
Search WWH ::




Custom Search