Displaying 2 results from an estimated 2 matches for "ivcat".
Did you mean:
icat
2013 Jan 16
1
equivalent code that doesn't return same results?
I need to automate changing the reference value for factors in analysis, and
it is my understanding that the following two sets of code should produce
identical results, but they do not:
1)dataset$method
2)eval(parse(text=paste("dataset",IVcat[k],sep="$"))) (in this case I
have IVcat[k]=method, which is why they are equal)
I even tested them in R, which says that these two objects are identical:
> identical(dataset$method,eval(parse(text=paste("dataset",IVcat[k],sep="$"))))
[1] TRUE
However, when...
2013 Jan 17
0
help with error: DV "converted to a factor"
...ing my code to return a matrix with just the comparisons I want).
Here is the code:
DV<-factors[,1]
IV<-factors[,2]
int<-factors[,3]
IV<-IV[!is.na(IV)]
int<-int[!is.na(int)]
#Limit our modification of reference values to categorical variables only by
redefining IV vector as IVcat
IVcat<-IV
for(p in 1:length(IV)){
if((class(dataset[[toString(IV[p])]])=="character")|(class(dataset[[toString(IV[p])]])=="factor")){
IVcat[p]<-IV[p]
}
else{IVcat[p]<-""}
}
IVcat<-IVcat[!is.na(IVcat)]
#Create vectors (IVvalslist[n] for nth facto...