Question

In: Finance

Does anyone know the code to use in R programming to create a box plot?

Does anyone know the code to use in R programming to create a box plot?

Solutions

Expert Solution

The basic syntax to create a boxplot in R is −

boxplot(x, data, notch, varwidth, names, main)

Following is the description of the parameters used −

  • x is a vector or a formula.

  • data is the data frame.

  • notch is a logical value. Set as TRUE to draw a notch.

  • varwidth is a logical value. Set as true to draw width of the box proportionate to the sample size.

  • names are the group labels which will be printed under each boxplot.

  • main is used to give a title to the graph

EXAMPLE

We use the data set "mtcars" available in the R environment to create a basic boxplot. Let's look at the columns "mpg" and "cyl" in mtcars. The below script will create a boxplot graph for the relation between mpg (miles per gallon) and cyl (number of cylinders).


Related Solutions

Does anyone know the code to use in R programming to create a scatter plot?
Does anyone know the code to use in R programming to create a scatter plot?
Does anyone know how to import data from Microsoft Excel code to use in R programming...
Does anyone know how to import data from Microsoft Excel code to use in R programming ?
Use R programming to resolve this; can you please provide details on the code? A) Create...
Use R programming to resolve this; can you please provide details on the code? A) Create a dataframe – comparativeGenomeSize with the following vectors: > organism<-c("Human","Mouse","Fruit Fly", "Roundworm","Yeast") > genomeSizeBP<-c(3000000000,3000000000,135600000,97000000,12100000) > estGeneCount<-c(30000,30000,13061,19099,6034) B) Print the organism and estGeneCount for Human and fruitfly.(1) C) Add a column to this data frame calculating base pairs per gene. To do this, write a function “genedensity” that takes as arguments the genomesizeBP and estimatedGeneCount information, and calculates from this the estimated bp per gene....
Hey anyone good with R studio? How do you create a square shape with R code...
Hey anyone good with R studio? How do you create a square shape with R code by using plot() and lines() please show your code !
Does anyone know to create a model of a ball and urn model of an American...
Does anyone know to create a model of a ball and urn model of an American Roulette Wheel? Please provide a detailed model with an explanation of how you came to the conclusion you did. And if possible, provide an example of using the model to solve a problem. Thank you!
Does anyone know how to do it on EXCEL? Does anyone know how to do it...
Does anyone know how to do it on EXCEL? Does anyone know how to do it on EXCEL? Does anyone know how to do it on EXCEL? Does anyone know how to do it on EXCEL? Anyone know how to do it on EXCEL? The Statistical Abstract of the United States published by the U.S. Census Bureau reports that the average annual consumption of fresh fruit per person is 99.9 pounds. The standard deviation of fresh fruit consumption is about...
There are four numeric columns in R programming language's iris data set. Create a scatter plot...
There are four numeric columns in R programming language's iris data set. Create a scatter plot between the four numeric columns using R programming language and give answers to the following parts. Calculate the correlation between each pair of the four numeric columns in iris. Which pair of variables has the strongest linear relationship? Interpret their ??. Which pair of variables has the weakest linear relationship? Interpret their ??. Which pair(s) of variables can you conclude have a population correlation...
(Use R Programming to Code) Use the Monte Carol simulation to estimate the probability that all...
(Use R Programming to Code) Use the Monte Carol simulation to estimate the probability that all six faces appear exactly once in six tosses of fair dice.
Create a histogram of this data with 15 bins. Create a box plot of this data.
7, 9, 8, 11, 14, 7, 11, 17, 18, 12, 10, 9, 16, 17, 15, 13, 7, 12, 7, 8, 14, 16, 20, 12, 11, 14, 22, 8, 10, 14, 15, 20, 17, 14, 12, 22, 12, 15, 17, 16, 9, 11, 16, 18, 11, 12, 11, 9, 11, 9, 13, 7, 12, 9, 19, 9, 8, 15, 12, 16, 16, 20, 21, 9, 11, 17, 17, 8, 11, 7, 10, 17, 13, 15, 14, 11, 19,10, 11, 11, 9,...
v Create a graph (either a histogram, box plot or stem and leaf plot … pick...
v Create a graph (either a histogram, box plot or stem and leaf plot … pick just one). Your graph could have either 5, 6 or 7 classes, depending on how you set it up. Create a table and list the class boundaries and the frequency in each class. You must explain to me in detail if you used fewer than 5 classes or more than 7 classes.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT