Question: I have a dataframe which has data like:

```
col1    col2    col3
1       3       bob
2       1       alice
3       3       bob
4       3       rose

```

And what I want to do is keep duplicate rows of col2 and discard duplicates with greater than 1 instance of col3's value. Or put another way, duplicates of col2 but only where col3's values are different. So in the above example, what I would end up with is:

```
col1    col2    col3
1       3       bob
4       3       rose

```

Alice wouldn't be in the output because obviously there's no second value of col2's '1' - it isn't duplicate. The second entry of Bob (3 3 bob) wouldn't be in the output because while col2's '3' is a duplicate, col3's 'bob' is already in the result set (1 3 bob). (I am aware of the `keep=` parameter to change the behaviour of keeping first or last, but ignoring it for simplicity.)

Any thoughts? Thank you.

Answer: 
Before you can even run a program written in C, the compilation needs to be fulfilled.

Functions are called at run-time and so are the parameter values determined at run-time, too.

You can't make the compilation of your code dependent upon the variable `x` in C.
What you're trying to achieve is basically completely impossible.

Let's take an example. Assume that you want to manufacture an elevator, and you set the weight limit to 800 kilograms. You could build in something that makes the elevator stop if the weight exceeds the limit.

So take the scenario where we program the elevator so that it does not move if the weight limit is exceeded. That would typically be done with an `assert()` or something like that.

You could also in various way try to prevent this from happening, like making the elevator very small so that you cannot fit too many people. But that is not a fail safe option. We have restricted the volume, but nothing prevents a person from bringing a big chunk of solid gold into the elevator.

The point here is that you can measure the weight before moving the elevator, since this is done at runtime. But preventing someone from even trying to exceed the limit is virtually impossible.

In the general case, what you're asking for is completely impossible. What you can do is something like this:

```
void func(int x)
{
    assert(x>0);

    /* Do stuff */
}

```

And a slightly related thing that is possible is to create a test that is a part of the build process. You cannot prevent compilation the way you want, but you can use it to fail the whole build process. An example.

```
// main.c

int add(int x, int y) 
{
    return x+y;
}

bool test()
{
    if(add(4,5) != 9) return false;
    return true;
}

int main(int argc, char **argv)
{
    if(strcmp(argv[1], "--test") == 0) {
        if(!test()) {
            printf("Test failed\n");
            exit(EXIT_FAILURE);
        }

        // More tests

        printf("All tests passed\n");
        exit(EXIT_SUCCESS);

    /* Rest of the main function */
}

```

Then you create a Makefile that compiles `main.c` and then calls `./a.out --test` as a part of the build process. The above example is a very simple case, and for a more realistic case I would have made it a bit more sophisticated, but it shows how it can be done. Also, there are libraries that can take care of this kind of stuff, but this is a way to do it without having to use that.