Query and R scripts for xuanpin project.