The sd function is doing *exactly* what it should. the sd of 5 is "NA", and the sd of 7 is "NA" try looking at "a" itself. My guess is that you didn't intend to have two columns each with one value. Did you instead intend to have 5 and 7 in one vector, like so: a<-c(5,7) sd(a) Glen