Hi! I am trying to run a CFA in Rstudio.
Here are the commands I've ran (sorry, new users can apparently only add one picture to a post)
# load data
D <- read.csv("C:/Users/User/Downloads/results-survey278539.csv")
# make subset
dat <- D[,6:25]
# rename variables
names(dat) <- paste("Q", sep = "", 1:20)
# compute means
Summary(fit)But when I run the Summary(fit) I get the following error:
It might have something to do with the fact that the Lavaan package might not be properly installed, if I run install.packages("lavaan") I get the following pop-up:
'One or more of the packages that will be updated by this installation are currently loaded. Restarting R prior to updating these packages is strongly recommended. RStudio can restart R and then automatically continue the installation after restarting. Do you want to restart R prior to installing?
If I click Yes, nothing happens, the pop-up just reappears. If I click no, I get the following outcome:
Installing package into ‘U:/Documents/R/win-library/3.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/lavaan_0.6-5.zip'
Content type 'application/zip' length 2818039 bytes (2.7 MB)
downloaded 2.7 MB
package ‘lavaan’ successfully unpacked and MD5 sums checked
Error in install.packages : ERROR: failed to lock directory ‘U:\Documents\R\win-library\3.0’ for modifying
Try removing ‘U:\Documents\R\win-library\3.0/00LOCK’
If I run library(lavaan) nothing seems to be wrong.
I have just started using Rstudio so I have no idea how to fix this. Could someone help?