The UPDATE clause needs to be expanded to support assignment of aggregations:
So
if (is.na(age)) age = mean(age, na.rm=TRUE)
translates into:
UPDATE person
SET age = u.age
FROM
(SELECT id,AVG(age) OVER () as age FROM person) AS u
WHERE person.age is NULL AND person.id = u.id
The UPDATE clause needs to be expanded to support assignment of aggregations:
So
if (is.na(age)) age = mean(age, na.rm=TRUE)translates into: