Question: I hope to get help on the following problem in R.

I have 4 variables, `firm ID`, `sales`, `size`, `date`, for almost 4,000 firms.

I want to run this regression: 

`lm(size~sales)`, while adding 100 firms at a time from the 4000. 

So, the first regression will have 100 firms, the second will have 200, third will have 300 ... until reaching the last regression which includes all of the firms (4000). 

The second task, is I want to save the beta coefficient of each regression (i.e. each regression after I add extra 100 firms), and then plot beta on Y and number of firms on x (from 100 to 4000) to observe how beta changes when adding firms.

Do I need some sort of loop for regressions, loop for saving betas, and loop for plotting?
Thank you for reading

Answer: 
You need to pass in `x` and `y` - currently they're parameters. You can also simplify your function a little:

```
await page.waitForFunction((x, y) => (x && y ? true : undefined), {}, x, y);

```
You need to pass in the `x` and `y` arguments to the `waitForFunction`.

```js
console.log(x,y); // 24 42
await page.waitForFunction((x, y) => {
    console.log(x, y); // undefined, undefined
    if(x && y) {
        return true;
    }
}, {}, x, y);

```