0

在 RStudio 上使用推荐实验室包。从 .csv 文件中读取表格并命名为 data.frame Sweets。使用命令时出现错误Recommender

Sweets <- read.table(file.choose(), header = FALSE,sep=",", nrows = 17903)

> recommenderRegistry$get_entries(dataType = "realRatingMatrix")
$IBCF_realRatingMatrix
Recommender method: IBCF
Description: Recommender based on item-based collaborative filtering (real data).

> Recommender(Sweets[1:17903], method="IBCF")
Error in Recommender(Sweets[1:17903], method = "IBCF") : 
error in evaluating the argument 'data' in selecting a method for function 'Recommender':           
Error in `[.data.frame`(Sweets, 1:17903) : undefined columns selected

关于数据:

ncol(Sweets)
[1] 3

nrow(Sweets)
[1] 17903

str(Sweets)
'data.frame':   17903 obs. of  3 variables:
$ V1: int  351 57 385 286 126 371 131 116 364 180 ...
$ V2: int  31 9 30 23 16 46 20 17 18 40 ...
$ V3: int  0 3 1 4 3 0 5 3 3 2 ...

head(Sweets)[, 1:3]
V1 V2 V3
1 351 31  0
2  57  9  3
3 385 30  1
4 286 23  4
5 126 16  3
6 371 46  0

如果我能提供更多信息,请告诉我。

4

0 回答 0