Assignment Task:
By using R programming
In R, a function is a set of statements organized together to perform a specific task. R has many in-built functions, and the user can make their own functions. Simple examples of in-built functions are seq (), mean (), max (), sum(x) and paste(...) etc. They are directly called by user-written programs. We can also create and use our own functions, referred to as user-defined functions. Now, you will require the use of in-built and user-defined functions and give the following questions answer.
Answer the following:
1. Using the diamond dataset, write a function that states the number of rows and number of columns in a data frame in a sentence.
2. Do a function that takes a mean of every column of a dataframe made of numeric values. You may have to subset the data to the numeric columns.
3. Do a function that returns an n-way frequency table for each factor in the table (say with a limit of 4 factors). Make it ignore any numeric data - you may have to subset the data.
4. Do a function to do the same job that 'summary function' does for a dataframe - give descriptive statistics such as min, quantile for 25%, median, mean, quantile for 25%, max and length and do frequency tables for each column of the dataset. The formatting should to be neat but doesn't have to be exactly the same as the summary function.
5. do a function that is more useful than summary function such as min, quantile for 25%, median, mean, quantile for 25%, max , standard deviation, skew, and kurtosis -1) do some simple ASCII plotting such as histogram, lines and boxplot of each numeric column? 2) compare each of the columns in some way.