How do I use arguments of a function when using sapply?
I have a dataset which I created by column binding using the cbindX function from the gdata package. This function allows me to bind columns with different numbers of rows. So, NA 's are introduced when there are no values in a particular column. Now, I want to calculate the standard deviation for each column. I tried using sapply(dataset,sd) This returns the standard deviation for the column having all rows with values and NA for the columns having fewer rows. I tried using the na.rm argument with the sd function: sapply(dataset,sd(na.rm=T)) and got the error message Error in is.data.frame(x)