Homemade utils for R