Hi. I'm doing a research in which I have to find if there is a correlation between a categorical variable called 'type of face product' and some lifestyle characteristics.

I did a factorial analysis in order to find 5 different factors that represent 5 different lifestyle categories.

- it gives me an error saying that 'Error in cor(beauty[, 70:85]) : 'x' must be numeric'

But it is numeric. Sometimes it runs the code and sometimes the error appears.

```
correlation <- cor(beauty[,70:85])
round(correlation, 3)
```

- The last code I wrote to divide in factors is

```
lifestyle.factan2 <- factanal(lifestyle, 5, rotation="varimax", scores="regression")
fact.scores <- lifestyle.factan2$scores
fact.load <- lifestyle.factan2$loadings
```

The pvalue is larger than 5% so we can conclude that 5 factors are enough in this case.

The factors are named by looking at the correlation between the factors and the original variables.

- factor 1 is more correlated with BetterPerson, ReadLab, Difference: we can call it a
**conscious factor**. - factor 2: is more correlated with takecareimage, look fundam and ImpGoodapp:
**good image factor** - factor 3 is more correlated to DesignClothes, FollowTrends, personality:
**fashion factor**. - factor 4 is more correlated with NatSuppl, carenatmethods and regExercise: we can call it a
**natural methods factor**. - factor 5: is more correlated with Envir, organicfood:
**environment friendly factor**

How can I see if there are correlations between the lifestyle characteristics we have identified and the type of face care product bought?

I'd like to create a correlation matrix and a graph where I can see on one axis the type of face product bought and on the other the different lifestyles, in order to see how many people bought what kind of product.

Which code should I use?

Thank you