functions from R prog and getting cleaning data