Error in sort.list(y) : 'x' must be atomic for 'sort.list'


#1

Error in sort.list(y) : ‘x’ must be atomic for 'sort.list’
Have you called ‘sort’ on a list?

on running …

combi <- dummy.data.frame(combi,names=c(‘Outlet_Size’,‘Outlet_Location_Type’,‘Outlet_Type’,‘Item_Type_New’),sep=’_’)


#2

Hi gautam.
Can you tell me your output of str(combi).


#3

I think you are using dummy.data.frame from the Dummy Package in R. It returns the output as data frame or Matrix.

Could you please show the structure of combi by using str(combi) ?


#4

Hi,
I am getting similar kind of issue.

NewDF<- dummy.data.frame(Latestdata, names = (“county”,“age_group”,“life_phase”,“couple_pair”,“house_type”,“car_type”))

Error in sort.list(y) : ‘x’ must be atomic for 'sort.list’
Have you called ‘sort’ on a list?


#5

This is the result of srt function:

str(combi)
Classes ‘tbl_df’, ‘tbl’ and ‘data.frame’: 14204 obs. of 16 variables:
Outlet_Establishment_Year: int 1985 1985 1985 1985 1985 1985 1985 1985 1985 1985 ... Outlet_Year : num 28 28 28 28 28 28 28 28 28 28 …
Item_Identifier : Factor w/ 1559 levels "DRA12","DRA24",..: 1 2 2 3 3 4 4 5 6 7 ... Item_Count : int 9 10 10 10 10 8 8 9 8 10 …
Outlet_Identifier : Factor w/ 10 levels "OUT010","OUT013",..: 6 5 6 5 6 5 6 6 6 5 ... Outlet_Count : int 1559 880 1559 880 1559 880 1559 1559 1559 880 …
Item_Weight : num 12.6 12.6 12.6 12.6 12.6 12.6 12.6 12.6 12.6 12.6 ... Item_Fat_Content : num 0 1 1 1 1 0 0 1 0 0 …
Item_Visibility : num 0.0407 0.0699 0.0397 0.224 0.1273 ... Item_Type : Factor w/ 16 levels “Baking Goods”,…: 15 15 15 15 15 15 15 15 15 15 …
Item_MRP : num 140 163 166 186 187 ... Outlet_Size : Factor w/ 4 levels “”,“High”,“Medium”,…: 3 4 3 4 3 4 3 3 3 4 …
Outlet_Location_Type : Factor w/ 3 levels "Tier 1","Tier 2",..: 3 1 3 1 3 1 3 3 3 1 ... Outlet_Type : Factor w/ 4 levels “Grocery Store”,…: 4 1 4 1 4 1 4 4 4 1 …
Item_Outlet_Sales : num 1 491 4914 555 7034 ... Item_Type_New : chr “DR” “DR” “DR” “DR” …


#6

Did you find a solution for this error message?
Thanks


#7

Try “dummy.data.frame(as.data.frame(dataset), names = …)” if it generate same errors.