For example, I rewrite this loop
my.kernel <- function(v){ for (x in 1:length(v)) { v[x] <- ifelse(abs(v[x]) <= 1, (35/32)*(1 - v[x]^2)^3, 0)