So I'm trying to run an apply function over an array. The idea is to look at the value in the risk factor column and if this is 1, use "OnsetFunction" and if it's a zero to use the HighOnsetFunction. The would then produce a column of values which populates another column in array.
> apply(OutComes, 1, function(x) { if(x["Risk_Factor"] == 1)
> + {OnsetFunction()}
> + else{ HighOnsetFunction()}})
I'm having trouble with the apply function above and keep getting this message.
>Error in xy.coords(x, y) : 'x' and 'y' lengths differ
There are only five rows in the array at the moment as I'm trying to make sure the code works on a small group before I extend it to be many people, but I'm not sure what the x and y are. I've seen this message with graphs, but never with this before.
Aucun commentaire:
Enregistrer un commentaire