Matrix returns NAs instead of numerical values

The following chunk gave me an error and I noticed that my matrix had all NAs instead of numerical values. When I changed ebay[, 1] <- as.factor( ebay[, 1]) to ebay <- lapply(ebay[, 1], as.factor) and did the same for the 2nd column then it worked and I was able to generate the graph. Why is it that some have no issue using the original code as.factor(x) but it would not work for me and I had to use lapply(x, as.factor) instead.

Thank you