search for: aggregationfunction

Displaying 2 results from an estimated 2 matches for "aggregationfunction".

2009 May 04
1
help_if command_new column
Hi everyone, Do you know how to apply a If command to a vector in a data.frame, creating a new column? Example: If one species has "1" value in the Abundance column then it is "Solitary". If the abundance is higher than 1, is "School". I did: aggregationFunction <-function(x){ (if (x>1) a<- 'School' else a<- 'Solitary') return (a) } Then: Aggregation <- lapply (df$Number, aggregationFunction ) Then: df <- data.frame (df, Aggregation) And I got this error: Error in data...
2009 May 05
1
self organizing map advice for categorical data
...tent-Type: text/plain Hi everyone, Do you know how to apply a If command to a vector in a data.frame, creating a new column? Example: If one species has "1" value in the Abundance column then it is "Solitary". If the abundance is higher than 1, is "School". I did: aggregationFunction <-function(x){ (if (x>1) a<- 'School' else a<- 'Solitary') return (a) } Then: Aggregation <- lapply (df$Number, aggregationFunction ) Then: df <- data.frame (df, Aggregation) And I got this error: Error in data...