I installed lme4 package
install.packages("lme4")
#My dissertation supervisor gave me a code to use but R keeps returning an error... please help!
I installed lme4 package
install.packages("lme4")
#My dissertation supervisor gave me a code to use but R keeps returning an error... please help!
lme4
is the name of the package. lmer
is the actual model-fitting function from the package. So try:
# Load the package to make its functions available
library(lme4)
# Fit the model
my_model = lmer(y ~ x + (1|z), data=my_data)
To make it easier for us to provide additional help tailored to your problem, please provide a reproducible example. A picture of the RStudio window generally doesn't provide enough information and code and data can't be copied/pasted from it.
Hi,
Thank you for the reply. The '>' has changed to '+' and model isn't running, what have I done wrong now ahh. Sorry probably very obvious, I am extremely new to R.
You're missing a comma. Change (1|Spider_name)data
to (1|Spider_name), data
I have added in comma but still not running and keeps giving a '+' symbol instead of a '>' symbol.
Please do not post screenshots when the content you want to share is essentially text.
As a note, it is extremely hard to help debug code and/or error messages when screenshots are posted. Posting screenshots, instead of actual code/error messages, is likely to decrease your chances of getting the help you are looking for in general. Instead of posting a screenshot, please copy and paste the code and error message and format the pasted code/error messages as shown below.
Put code that is inline (such as a function name, like mutate
or filter
) inside of backticks ( mutate
) and chunks of code (including error messages and code copied from the console) can be put between sets of three backticks:
```
example <- foo %>%
filter(a == 1)
```
This process can be done automatically by highlighting your code, either inline or in a chunk, and clicking the </>
button on the toolbar of the reply window!
This will help keep our community tidy and help you get the help you are looking for!
For more information, please take a look at the community's FAQ on formating code
Your issue is that your previous inputs to the console did not terminate, therefore the corrected code you added is simply added to it.
You can press escape to back out of the console. Before trying again
Hi,
Sorry I will type out the code next time! And thank you for the help aswell.
Do you know how I can summarise my data to show the p-value? Thanks again.
summary(mynewmodel)
You're having the issue that Nir pointed out in the accepted answer. Press escape to end the previous statement and enter the code on a new line. You should see a >
rather than a +
to indicate you're at the start of a new line of code, rather than continuing a previous statement.
Instead of entering the code at the console, you will probably find it easier to open an R script file. Type your code in the script and save the file. Then you can run the code any time and edit the script as needed, and you will have a record of what you did.
Hi it is library("Matrix"). Matrix enclosed between two " "....
Cheers
F.
This topic was automatically closed 7 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.