# Error in sort.list(y) ?

#### t.wang21@yahoo.com.au

##### Member
https://archive.ics.uci.edu/ml/datasets/human+activity+recognition+using+smartphones

This is what I did in R, but got an error after i typed in the code use.train. what shall i do to deal with the error? Thanks very much.

use.train <- cbind(use.train.x, Outcome = factor(use.train.y))
Error in sort.list(y) : 'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?

#### Dason

Using factor on a table/data.frame is what is giving you the error. Is use.train.y a single column? If so coerce it to a vector before calling factor on it.

#### t.wang21@yahoo.com.au

##### Member
Thanks very much. yes I think this is the reason. How to convert a single column (use.train.y) into a vector? Thanks a lot.

#### bryangoodrich

##### Probably A Mammal
https://archive.ics.uci.edu/ml/datasets/human+activity+recognition+using+smartphones

This is what I did in R, but got an error after i typed in the code use.train. what shall i do to deal with the error? Thanks very much.

use.train <- cbind(use.train.x, Outcome = factor(use.train.y))
Error in sort.list(y) : 'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?
I hope you're not doing file.choose repeatedly like that in your usable code.

If so, it is better to store that in a variable; if you have to rerun the code, you don't have to manually choose the file each time

Code:
# Run once
train.x.src <- file.choose()  # select the training x set
foo <- file.choose()  # another file
bar <- file.choose()  # another file
...

# Run many
bar.x <- read.table(bar)