get 95 percentile outliers in column in r

To get the 95 percentile outliers in a column in R, you can follow these steps:

  1. Load your data into R. For example, if your data is stored in a CSV file named "mydata.csv", you can use the read.csv() function to load it into R:
main.r
mydata <- read.csv("mydata.csv")
33 chars
2 lines
  1. Calculate the 95th percentile of the column using the quantile() function:
main.r
percentile <- quantile(mydata$mycolumn, 0.95)
46 chars
2 lines

Replace "mycolumn" with the name of the column containing the data you want to analyze.

  1. Identify the outliers in the column by comparing each value to the 95th percentile:
main.r
outliers <- subset(mydata, mycolumn > percentile)
50 chars
2 lines

This will create a new data frame called "outliers" that contains all the rows where the value in the "mycolumn" column is greater than the 95th percentile.

That's it! You now have a data frame with all the outliers in the column you were analyzing. You can further analyze or visualize this data to gain insights into your data set.

gistlibby LogSnag