Hi,

I'm generating the name of the variable with paste function and then using that 
variable name further to get the specific position value from the data.frame, 
here is the snippet from my code:

modelResults <- extractModelParameters("C:/PilotStudy/Mplus_Input/Test", 
recursive=TRUE)

#extractModelParameters reads all the output files from the Test folder and 
create the following variables in R for each file read:
#C..PilotStudy.Mplus_Input.Test.rep1.out.unstandardized.est
#C..PilotStudy.Mplus_Input.Test.rep2.out.unstandardized.est
#C..PilotStudy.Mplus_Input.Test.rep3.out.unstandardized.est

modelResultsTemp <- as.data.frame(modelResults)

MeansTempC1 = rep(NA ,9)
counter = 1

for (f in 1:3)
{
i=31

for (g in 1:3)
{
OutputFileName <- 
paste("modelResultsTemp$C..PilotStudy.Mplus_Input.Test.rep",f,".out.unstandardized.est[",i,"]",sep="")

MeansTempC1[counter] = OutputFileName
i=i+1
counter = counter+1
}
}

Its not giving me any error but I'm not getting the desired output in 
MeansTempC1 because OutputFileName is a string and thats why its not returning 
the OutputFileName[31] etc. Does anybody know how to eliminate the double 
quotes 
so that I can use the variable name (generated with the paste function) further 
in the code

Regards
Bob



      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to