**Factor Analysis** also known as **Exploratory Factor Analysis** is a statistical technique used in R programming to identify the inactive relational structure and further, narrowing down a pool of variables to few variables. The main motive to use this technique is to find out which factor is most responsible for influence in the categorization of weights.

Syntax:factanal(x, factors)

Parameters:

x:represents dataset

factors:specifies number of factors to be fitted

**Example:**

Let us suppose, there are number of food available in the dataset with their food texture data points such as Oil, Density, Crispy, Fracture, and Hardness.

`# Reading csv file of food textures ` `food_textures <` `-` `read.csv(` `"https://userpage.fu-berlin.de/soga/300/30100_data_sets/food-texture.csv"` `) ` ` ` `food_textures <` `-` `food_textures[, ` `2` `:` `6` `] ` ` ` `factor_analysis <` `-` `factanal(food_textures, factors ` `=` `2` `) ` ` ` `print` `(factor_analysis) ` ` ` `# Output to be present as PNG file ` `png(` `file` `=` `"factorAnalysisGFG.png"` `) ` ` ` `# Plot factor 1 by factor 2 ` `load <` `-` `factor_analysis$loadings[, ` `1` `:` `2` `] ` ` ` `# Plot graph ` `plot(load, ` `type` `=` `"n"` `) ` `text(load, labels ` `=` `names(food_textures), cex ` `=` `.` `9` `) ` ` ` `# Saving the file ` `dev.off() ` |

*chevron_right*

*filter_none*

**Output:**

Call: factanal(x = food_textures, factors = 2) Uniquenesses: Oil Density Crispy Fracture Hardness 0.334 0.156 0.042 0.256 0.407 Loadings: Factor1 Factor2 Oil -0.816 Density 0.919 Crispy -0.745 0.635 Fracture 0.645 -0.573 Hardness 0.764 Factor1 Factor2 SS loadings 2.490 1.316 Proportion Var 0.498 0.263 Cumulative Var 0.498 0.761 Test of the hypothesis that 2 factors are sufficient. The chi-square statistic is 0.27 on 1 degree of freedom. The p-value is 0.603

## Recommended Posts:

- Checking if the Object is a Factor in R Programming - is.factor() Function
- Convert a Vector into Factor in R Programming - as.factor() Function
- Convert an Unordered Factor to an Ordered Factor in R Programming - as.ordered() Function
- Check if a Factor is an Ordered Factor in R Programming - is.ordered() Function
- Convert Factor to Numeric and Numeric to Factor in R Programming
- Get or Set Levels of a Factor in R Programming - levels() Function
- Applying User-defined Functions on Factor Levels of Dataset in R Programming - by() Function
- Replace values of a Factor in R Programming - recode_factor() Function
- Removing Levels from a Factor in R Programming - droplevels() Function
- Get the Number of Levels of a Factor in R Programming - nlevels() Function
- Performing different Operations on Two Arrays in R Programming - outer() Function
- Performing Operations on Multiple Lists simultaneously in R Programming - mapply() Function
- The Factor Issue in a DataFrame in R Programming
- Perform Probability Density Analysis on t-Distribution in R Programming - dt() Function
- Perform the Probability Cumulative Density Analysis on t-Distribution in R Programming - pt() Function
- Perform the Inverse Probability Cumulative Density Analysis on t-Distribution in R Programming - qt() Function
- Perform Linear Regression Analysis in R Programming - lm() Function
- Performing Binomial Test in R programming - binom.test() Method
- Performing F-Test in R programming - var.test() Method
- Performing Logarithmic Computations in R Programming - log(), log10(), log1p(), and log2() Functions

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.