Hi,
I am working on an additional health research project. I successfully converted the SPSS file to an R file as I am using R now for this project instead of SPSS. However, I am having trouble with some of the if then conditions in R and I keep receiving errors. Do you know what the code would be for the following below? I have also provided the SPSS syntax.
I tried this as an example along with other things but it was incorrect.
#Create vector quantity
quantity <- 2018
Set the is-else statement
if (quantity = 2018) {
+ print('vfa')
+ } else {
+ print('not vfa')
+ }
[1] "vfa"
Thanks so much!
"Use pcode and id for analysis. You’ll see other variables with the same info from different sources – but use these ones.
year = 2018. This keeps records in the EDI file (n=4,666). It removes the 19 records in the audit file that I don't have in the EDI file because PCCF+ couldn't geocode the postal codes.
flag="VSSO". This keeps all the audit records (n=4,589). This removes EDI records where this is no corresponding entry in the file.
visual = 1. This keeps VSSO records that have visual data. 53 records are in VSSO data without visual data.
vfa=1. This is a variable and needs to be used. It identifies EDI records valid for analysis, which is 4196 of the 4,666.
Language variable. Options are 1=new to language of instruction, 0=speak language of instruction, .=missing. There are 19 missing language status in the vfa=1 sample.
As an FYI: No missing gender in vfa sample, and 1 missing age."
The syntax in SPSS was the following.
IF (Province) year=2018.
VARIABLE LABELS year 'EDI years'.
EXECUTE.
IF (Province) p_code=p_code.
VARIABLE LABELS p_code 'Postal code'.
EXECUTE.
IF (Province) EDI_id=EDI_id.
VARIABLE LABELS EDI_id 'Postal code'.
EXECUTE.
IF (Province) flag="VSSO".
VARIABLE LABELS flag ' flag'.
EXECUTE.
IF (Province) Visual=1.
VARIABLE LABELS Visual ' Visual'.
EXECUTE.
IF (Province) vfa=1.
VARIABLE LABELS vfa 'Valid for analyses - typically developing'.
EXECUTE..