Question

In: Computer Science

How do you graph integers in r studio. I made new data frames for specific parts...

How do you graph integers in r studio. I made new data frames for specific parts of the data I wanted to use and then got the sum of a column and saved it as a variable under values. My goal is to know how to graph these integer values in a barplot comparing all the values.

Solutions

Expert Solution

Program to print sum of specific column.

df<- data.frame(group=rep(c("Men", "Women"),each=6),
                fruit=rep(c("Apple", "Kiwi", "Grapes", "Banana", "Pears", "Orange"),2),
               people=c(22, 10, 15, 23, 12, 18, 18, 5, 15, 27, 8, 17))

add=sum(df$people)
print(add)

Output: - here Output Show some of people column.

Program to barplot integer values: -(makes sure are you install ggplot2 library in your system)

df<- data.frame(group=rep(c("Men", "Women"),each=6),
                fruit=rep(c("Apple", "Kiwi", "Grapes", "Banana", "Pears", "Orange"),2),
               people=c(22, 10, 15, 23, 12, 18, 18, 5, 15, 27, 8, 17))


library(ggplot2)
ggplot(survey, aes(x=fruit, y=people, fill=group)) +
geom_bar(stat="identity")

Output: -


Related Solutions

How do I do this in R Studio? 1 Students who performed poorly on a City...
How do I do this in R Studio? 1 Students who performed poorly on a City of New York Skills Assessment Test were enrolled in a summer math program. Scores of 10 students before and after the summer program were recorded. They were: Before = 18,18,21,18,18,20,23,23,21,17 After = 24,25,33,29,33,36,34,36,34,27 (Scores for individual students are in the same order in each list.) Did the NYC summer math program improve student performance significantly? 8. How many points did student scores improve on...
How do you plot continuous versus category in r studio
How do you plot continuous versus category in r studio
How do I input this in R studio 1. Combine the following lists into a matrix...
How do I input this in R studio 1. Combine the following lists into a matrix called animals, where each list becomes a row: Cats = 2,2,4 Dogs = 1,2,1 Cows = 30,35,41 2. Add column names of “Farm A”, Farm B”, and “Farm C”. 3. Transpose the rows and columns in animals and store the result to a matrix called farms. 4. Display the contents of farms.
how do you test for regression in R studio with variables x and y
how do you test for regression in R studio with variables x and y
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 !
( In R / R studio ) im not sure how to share my data set,...
( In R / R studio ) im not sure how to share my data set, but below is the title of my data set and the 12 columns of my data set. Please answer as best you can wheather its pseudo code, partial answers, or just a suggestion on how i can in to answer the question. thanks #---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The dataset incovid_sd_20201001.RDatacontains several variables related to infections of covid-19 for eachzip code in San Diego County as of October...
How is this done in R-studio? I have been trying to figure it out but I...
How is this done in R-studio? I have been trying to figure it out but I am getting more and more confused. While imprisoned by the Germans during World War II, the English mathematician John Kerrich tossed a coin 10,000 times and obtained 5067 heads. Let p be the probability of a head on a single toss. We wish to check if the data are consistent with the hypothesis that the coin was fair. a) Set up the hypotheses. Why...
Use R studio to do this problem. This problem uses the wblake data set in the...
Use R studio to do this problem. This problem uses the wblake data set in the alr4 package. This data set includes samples of small mouth bass collected in West Bearskin Lake, Minnesota, in 1991. Interest is in predicting length with age. Finish this problem without using Im() (a) Compute the regression of length on age, and report the estimates, their standard errors, the value of the coefficient of determination, and the estimate of variance. Write a sentence or two...
In r studio, how do you find significant variables that differ between two datasets of the...
In r studio, how do you find significant variables that differ between two datasets of the same variables?
R software Create a list made up of two Vectors, two Data frames and Two Matrices....
R software Create a list made up of two Vectors, two Data frames and Two Matrices. i) Name the elements of the list appropriately ii) Output just the two vectors iii) Output just the two matrices
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT