make query.R main package with func