Flow
October 26, 2022, 9:52pm
1
Hey, I am running into a problem answering the question in the title. All variables are numeric.

```
lm1 <- lm(y ~ x * z, data = data)
```

I have tried a pairwise t-test, but am unsure if this is the right approach, but I get an error message:

Error in unique.default(x, nmax = nmax) :
unique() applies only to vectors

Does anyone know how to do this?

Hi, It is a bit hard to tell without seeing the data. Perhaps you could try a reproducible example?

A minimal reproducible example consists of the following items:
A minimal dataset, necessary to reproduce the issue
The minimal runnable code necessary to reproduce the issue, which can be run
on the given dataset, and including the necessary information on the used packages.
Let's quickly go over each one of these with examples:
Minimal Dataset (Sample Data)
You need to provide a data frame that is small enough to be (reasonably) pasted on a post, but big enough to reproduce your issue.
Let's say, as an example, that you are working with the iris data frame
head(iris)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.…
Can I ask questions from a course I am taking here?
General questions are always welcome!
Please do ask general questions about things like:
How to use R
How to use the RStudio IDE or RStudio Cloud
How to work with tidyverse packages
Where to find resources to help you learn or solve problems
Specific questions can be OK, if you follow these rules:
Never copy-paste instructions from an assignment (even for online courses).
Explicitly mention the course you are taking and use the #homework tag.
Ask your question as a reproducible example (reprex) , preferably prepared for posting using the reprex package .
Want to maximize your chances of getting the help you need? Keep readin…

ILCC
October 28, 2022, 9:17am
3
I don't think the lm() function is appropriate for a t-test. This is used for linear models, so for regression analyses. If you do want to run a regression and Z is a control variable, try the below:

```
lm1 <- lm(y ~ x:z, data = data)
```

Difficult to tell without a reprex though

system
Closed
December 9, 2022, 9:17am
4
This topic was automatically closed 42 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.