-1

How would you make a simple plot in R from a data frame comparing 2 of the variables, as well as only using the data from a subset of a third variable?

  • It is comparing the age and shoe size of the participants but I want to make a simple plot for only male participants which is also recorded in the data frame – H McMath Nov 02 '17 at 15:11
  • What is "a simple plot"? – S Rivero Nov 02 '17 at 15:11
  • 2
    It's easier to help you if you provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input data and a clear description of the desired output for that input. Show any attempts so far and describe exactly where you are getting stuck. – MrFlick Nov 02 '17 at 15:11

1 Answers1

1

There is no reproducible example, but I guess it could go like this.

First, filter only your male subset. Here, I use subset from the dplyr package.

male_data<-subset(data, gender== "male")

Then, create, for example, a scatter plot for shoes vs age from your male_data using ggplot

ggplot(male_data, aes(Age, shoesize)) + geom_point()
Neoromanzer
  • 422
  • 2
  • 15