KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
So, I have a data frame with two factors and one numeric variable like so: >D f1 f2 v1 1 A 23 2 A 45 2 B 27 . . . so the levels of f1 are 1 and 2 and the levels of f2 are A and B. Here's the thing, there is no value inputted for when f1=1 and f2=B (that is D$V1[D$f1=1 & D$f2=B] isn't there) in reality this should be zero. In my actual data frame I have 11 levels of f1 and close to 150 levels of f2 and I need to create an observation with v1=0 for every combination of f1 and f2 that is missing from my data frame. How would I go about doing this? Thanks in advance, Ian
Tags (comma-separated)
Save Edits
Cancel