ggplot geom_text font size control

Here are a few options for changing text / label sizes The size in the geom_text changes the size of the geom_text labels. For this And why size of 10 in geom_text() is different from that in theme(text=element_text()) ? Yes, they are different. I did a quick manual check and they appear to be in the ratio of ~ (14/5) for geom_text sizes to theme sizes. … Read more

Change size of axes title and labels in ggplot2

You can change axis text and label size with arguments axis.text= and axis.title= in function theme(). If you need, for example, change only x axis title size, then use axis.title.x=. There is good examples about setting of different theme() parameters in ggplot2 page.

How to drop columns by name in a data frame

You should use either indexing or the subset function. For example : Then you can use the which function and the – operator in column indexation : Or, much simpler, use the select argument of the subset function : you can then use the – operator directly on a vector of column names, and you can even omit the quotes around the names ! Note that you … Read more

Transpose a data frame

You’d better not transpose the data.frame while the name column is in it – all numeric values will then be turned into strings! Here’s a solution that keeps numbers as numbers:

How to change line width in ggplot?

Whilst @Didzis has the correct answer, I will expand on a few points Aesthetics can be set or mapped within a ggplot call. An aesthetic defined within aes(…) is mapped from the data, and a legend created. An aesthetic may also be set to a single value, by defining it outside aes(). As far as I … Read more

Find duplicate values in R

You could use table, i.e. gives you a data frame with a list of ids and the number of times they occurred. tells you which ids occurred more than once. returns the records with more than one occurrence.