The variable data should be a data frame. You should check whether the input file is actually in a dataframe format with columns and rows. It must be made if it is not, however, if the data is in rows and columns, then simply follow Proloy Barua's suggestion. Thanks