How it works…

The type of output produced by the object is created or mentioned inside the return statement. If you want a character type output, then you must supply a character type object inside the return statement. In this recipe, the meanSe function calculates the mean and standard deviation, and then, it converts it into a character object by the following code lines:

    out <- paste("Mean of the input vector is = ",
paste(avg), " with a standard error = ",
paste(se), sep = "")

The paste function here has been used to print the text and convert the numeric output into character type. The out object contains a line of text with the value of mean and standard deviation in it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset