Create an R script to perform the assignment, commenting every step. Include
in your script a title of your code, the author name, the date of the last
update, and a description of what the script performs. Your script must be
saved as YOURNAME_Assignment_L4.R

The script should be able to run perfectly. An error in the code means that
particular question will be graded as zero. If the error affects
posterior questions, all of them will be graded zero as well. To make sure your
scripts works, erase all the objects in your environment and re-run your
code.

Import the data (provided) called Data1Lesson_L4.txt

1) Determine the letter or letters in row names with the maximum value
of "maxdep"

2) Determine the letter or letters in row names with the minimum value of
"maxdep"

3) Subset all information (all columns) of the rows with turbi=15, name it
s1

4) Calculate the mean of the hardness of the table s1

5) Create a new column called ClassPhospha where if Phospha has value of ten
or less then assign the word "low", if it has a value larger than 10
until 25 assign the word "medium", and values larger than 25 assign
"high"

6) Change the column name "pond.area" to "PonderateArea"

7) Add to all rownames letters the word Field followed by a "_", in
order to obtain for instance "Field_Q" and so on

8) Change all rownames to uppercase, for instance "FIELD_Q" and so
on

9) Calculate the Mean of the square root of the logarithm of column
"turbi"

10) Add the values obtained of the calculation of the square root of the
logarithm of column "turbi" to a new column in the data, called
"SQRTLOGturbi"

11) Abbreviate column names to a 6-letter names

12) Sort the dataset by columns 1 (ascending) and 2(descending)

13) Create a subset table with the rows whose pH are in the following
vector. vecpH<-
c("38","40","42","47",
"68","69", "75")

14) Create a scatter plot of ponderate area in x axis vs Phosphate in
Y axis, the spots must be circles, and must be filled by color
"dodgerblue2". Assign a title to your plot, as x axis title you must
put "Ponderate Area" and as y axis title you must put "Phosphate
Levels". For this you will need to call for the plot help, so A COMMAND
LINE CALLING FOT THE HELP PF THE PLOT MUST BE IN YOUR SCRIPT.

Create an R script to perform the assignment, commenting every step. Include
in your script a title of your code, the author name, the date of the last
update, and a description of what the script performs. Since you will create a
data file, you should submit not only the script but also this data object.
Your script must be saved as YOURNAME_Assignment_L3.R

The script should be able to run perfectly. An error in the code means that
particular question will be graded as zero. If the error affects
posterior questions, all of them will be graded zero as well. To make sure your
scripts works, erase all the objects in your environment and re-run your code.

1) Create a matrix of 50 rows and 20 columns with numbers from 1 to 5
sampled randomly.

2) Save the matrix

3) erase the matrix from your environment

4) Import your matrix

5) Assign names of US states as column names

6) Assign values to the rows, 1,2,3, etc.

7) Assume these were results of a survey about the flavor of a new brand of
carrot juice, being 1, Not satisfied at all, and 5 Very satisfied and determine
if there are values larger than 5

8) Create a histogram of the total data matrix

9) Create a histogram of one state that you like, and determine if it is
different than the previous one

10) Calculate the mean and standard deviation of the entire survey and of
your selected state, determine if there is a significant difference between
both.

11) Calculate the difference between the number of "5, very
satisfied" obtained in your selected state and the total number of
"5", clue: remember the command "sum()"

12) Conclude about the satisfaction that the carrot juice produced in that
particular state.

13) Suppose now that the first 25 rows are females and the last 25 are
males, create a vector of females and males

14) Calculate the mean and standard deviation by males and females, comment
the result

15) Create a boxplot of the results of females by state. Clue: You could
request help from R

16) Create a boxplot of the results of males by state. Clue: You could
request help from R

17) Compare if there is any difference in any state

18) Create a boxplot to compare the distribution between males and females.
Clue: You should obtain here one plot with two boxplot, one belonging to
females and the other to males, you could request help from R.

Get Higher Grades Now

Tutors Online

Get Free Quote!

299 Experts Online