A function in R is defined as a set of statements grouped together to perform a specific task. User-defined functions can be created in R using the "function" keyword and follow a syntax that includes the function name, arguments, function body, and optional return value. Functions allow users to reuse code for common tasks.