[R] lapply function

Sohail Khan sohail13 at gmail.com
Sat May 30 13:40:07 CEST 2015


Hi R Gurus,

I am writing a simple function that take a numeric vector column from a
data frame and scales the vector column with certain criteria.  I would
then pass this function to a list of dataframes by lappy.

Question is how do I write a function that works on a numeric vector.  My
function as is, seems to work on the first element of the vector.

I.E.
scale
function(x,mn,max){
if (x==min(x)) 0

if (x==max(x)) 10
else x=max-min/10
}

where x is the numeric column of the dataframe.

Thank you.

	[[alternative HTML version deleted]]



More information about the R-help mailing list