Question

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

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

Homework Answers

Answer #1

The basic syntax for creating a histogram using R is −

hist(v,main,xlab,xlim,ylim,breaks,col,border)

Following is the description of the parameters used −

  • v is a vector containing numeric values used in histogram.

  • main indicates title of the chart.

  • col is used to set color of the bars.

  • border is used to set border color of each bar.

  • xlab is used to give description of x-axis.

  • xlim is used to specify the range of values on the x-axis.

  • ylim is used to specify the range of values on the y-axis.

  • breaks is used to mention the width of each bar.

EXAMPLE

The script given below will create and save the histogram in the current R working directory.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
I don't know how to properly create a histogram. Question 8: Draw a histogram for the...
I don't know how to properly create a histogram. Question 8: Draw a histogram for the variable of TV watching hours. Based on the frequency table and histogram you create, write a paragraph summarizing the distribution of scores.    # of hours seniors watched TV Frequency 2-4 3 5-7 7 8-10 3 11-13 3 14-16 3 17-19 2 20-22 2 23-25 0 26-28 1 29-31 0 32-34 1
5) R Code: Overlap a histogram of 10000 random values from Z ∼ N(0,1) with the...
5) R Code: Overlap a histogram of 10000 random values from Z ∼ N(0,1) with the histogram below. Include your code X = hist(replicate(10000, (mean(rbinom(50, 1, 0.1))))
1. how to create residual vs. fitted plot in R ? (I know I can use...
1. how to create residual vs. fitted plot in R ? (I know I can use plot(), but I ONLY want one graph instead of four graphs created by plot(). ) 2.how to find outliers from a scatter plot in R? I need the code.
Use either R or Excel for the following. Provide the formulas or code that you are...
Use either R or Excel for the following. Provide the formulas or code that you are using. Let x1 be a random variable that is N(100, 225). Let x2 be a random variable that is U(50,150) and let x3 be a random variable that is U(500,1500). Set Y = (X1)(X2)/ (X3) a) Use R to create 500 random numbers of each type (X1, X2, X3 and Y). b) Estimate P(0.1 < Y < 0.25) c) Estimate E(Y) and the Standard...
In Java programming language 11.Create the code for a for loop to print the numbers 1  through...
In Java programming language 11.Create the code for a for loop to print the numbers 1  through 5 inclusive vertically so the output is 1 2 3 4 5 11b What is the output of the following               OUTPUT int i=3; while(int i >0) { System.out.println(i); i--; } 11c What is the output of the following               OUTPUT for(int i=3;i<10;i++) System.out.println(3*i); 11d Create the line of code to print the numbers 10 through 1 decreasing by 1 each time 11e Create the line of code...
Use the programming language R to code the following project.. * Make sure you turn in...
Use the programming language R to code the following project.. * Make sure you turn in your code and answers from each question. (not the raw data). 1. Generate 1000 random samples of size 40 from the normal distribution with mean µ = 3 and standard deviation σ = 2. Compute 95% the confidence interval of 1000 samples and find the rate of confidence interval contains the true mean. What did you learn from this simulation study? 2. For each...
Use R to code a function to generate a random sample of size n from the...
Use R to code a function to generate a random sample of size n from the Beta(a, b) distribution by the acceptance-rejection method. (1) Generate a random sample of size 3000 from the Beta(4,3) distribution. (2) Graph the histogram of the sample with the theoretical Beta(4,3) density superimposed. Answer the above questions by showing the R codes and results.
java: can anyone explain. why does my code print out ##### and ***** instead of just...
java: can anyone explain. why does my code print out ##### and ***** instead of just #####? int a=1, b=2, c=3;    if(a<b) System.out.println("####"); else System.out.println("&&&&"); System.out.println("****");
Using R programming language, complete the following. 1. Generate the bivariate normal sample of size 100...
Using R programming language, complete the following. 1. Generate the bivariate normal sample of size 100 with parameters a. marginal mean of X equal to 1, b. marginal mean of Y equal to 2, c. marginal variance of X equal to 3, d. marginal variance of Y equal to 4, e. correlation between X and Y equal to -1/2. You can use the function mvrnorm(), first installing its package by the code if (! require ("MASS")) install.packages("MASS"); library ("MASS") 2....
Please use R-studio code to answer the question! Create a variable called 'pizza' whose value corresponds...
Please use R-studio code to answer the question! Create a variable called 'pizza' whose value corresponds to the price of pizza you’ve eaten in the last week. Or something equally same. Now create another varible 'tax' whose value corresponds to 15% of the price of pizza. Now add these two values and store your result as 'myCost'. I assume the utility you enjoyed was 50 utils. So create a third variable 'myUtility' whose value is 50. Use logical operations to...