ggplot2 to create boxplots to all columns of a dataset [duplicate] - r

This question already has answers here:
creating a boxplot for two different column of data frame using ggplot [duplicate]
(2 answers)
Making a ggplot boxplot where each column is it's own boxplot
(2 answers)
Closed 13 days ago.
I have a dataset composed of 10 columns and I want to create a boxplot for each column using ggplot2. They idea is to see if there are outliers in any column
I know how to use to the package to create a boxplot for each column individually but I would like to know if it is possible to make it directly to all columns of the data set

Related

plot 3 continuous variables against each other in one plot [duplicate]

This question already has answers here:
Plot each column against each column
(2 answers)
Plot all pairs of variables in R data frame based on column type [duplicate]
(1 answer)
Closed 17 days ago.
I have the output of 3 different algorithms as a continuous vector. Instead of comparing their correlation 1 by 1, I would like to plot them all simuntaionusly in the same plot, but in different panels. The dataframe looks like this (but contains >10k ids):
df <- data.frame(id=1:5,
feature1=runif(5),
feature2=runif(5,min = 3,max=5),
feature3=runif(5, min = 5,max=8))
Ideally, the resulting plot should looks something like this:
I am fairly sure that there is some simple tidyr function, which expands my dataframe in such a way that I can simply use ggplot2 in combination with facet_grid, but I searched and coudn't find anything..
Any help is much appreciated!

R remove names and order ggplot by frequency [duplicate]

This question already has answers here:
Order Bars in ggplot2 bar graph
(16 answers)
Remove all of x axis labels in ggplot [duplicate]
(1 answer)
Closed 2 years ago.
I have a dataframe DiatomFiltered containing the column species. I want to have a ggplot (ggplot2) of all species and their frequency ordered from highest to lowest. The below code works, but the names are a mess (because of way too many species names) so I want to remove that and i want the frequencies ordered. How do i do this?
ggplot(DiatomFiltered, aes(species)) +
geom_bar(fill = "#0073C2FF")

Isolating data to calculate things (such as mean) by locking the associated categorial variable in another column [duplicate]

This question already has answers here:
Mean per group in a data.frame [duplicate]
(8 answers)
How to find mean for subset using R?
(2 answers)
Closed 3 years ago.
Beginner problem in R. I have a data frame in R that has 1 column ranking the data into specific subgroups, named "Group" (Groups: Heavy, Medium, Light), then another column with values (named "Value") of those groups. How do I check, for example the mean, within the "value" column for a specific subset based on the "Group" column, lets say for "Heavy"?

How to remove value from a plot on R [duplicate]

This question already has answers here:
Boxplot sees values that aren't there
(1 answer)
How to remove ticks and labels of dropped off factors in a box plot
(1 answer)
Closed 5 years ago.
You can see my plot in this link.
I want to remove the first three points from the x axis, so I only display data from "2.31-52k", "1.52-100k", "3.18-31k", "4.<18k", "0.>100k". And not -1.0,-3.1 etc.
I have managed to remove the data to produce this graph, by creating a subset in dAll$income and assigning it to a new data frame with the following code.
new_df = subset(dAll, subset = dAll$income %in% c("2.31-52k", "1.52-100k", "3.18-31k", "4.<18k", "0.>100k"))
However when I plot this, the values remain on the x axis.

How to create a frequency table in R from a variable within a data frame? [duplicate]

This question already has answers here:
How to generate a frequency table in R with with cumulative frequency and relative frequency
(5 answers)
Closed 6 years ago.
I have a data frame created within the R console called lungdata. It has six separate variables. I need to create a frequency table from the variable Smoke. Smokers and NonSmokers relative frequency. What would be the correct syntax to create the table. The variables are input as Yes/No.
If you want relative frequencies, just do
prop.table(table(lungdata$smoke))
and that should do the trick. If you want counts, not percentages, just use
table(lungdata$smoke)

Resources