The function of crossprod in R puzzled me.
I would like to calculate the cross product of two vectors. According to my
text book, it defines like this:
a = (ax, ay, az)
b = (bx, by, bz)
then, the cross product of a and b is:
a X b = (ay*bz-az*by, az*bx-ax*bz, ax*by-ay*bz)
It can also write in a de
This is my first time to ask for help in the R mailing list, so sorry for my
misbehavior.
The question is actually an example of the apply function embedded in R. Code
is here:
> x <- cbind(x1 = 3, x2 = c(4:1, 2:5)) > dimnames(x)[[1]] <- letters[1:8] > x
> x1 x2 a 3 4 b 3 3 c 3 2 d 3
I encounters some codes in ggplot2 manual and confused with one of its lm
syntax. The code is here:
library(ggplot2) d <- subset(diamonds, carat < 2.5 & rbinom(nrow(diamonds), 1,
0.2) == 1) d$lcarat <- log10(d$carat) d$lprice <- log10(d$price) detrend <-
lm(lprice ~ lcarat, data = d) d$lprice2
3 matches
Mail list logo