У меня есть этот сценарий в оболочке:
R -q -e "library(knitr);data<- read.table('dados.txt', header = T);siregid.table<- as.data.frame(table(unlist(data$siregid))); a=data.frame(unclass(summary(siregid.table$Freq)), check.names = FALSE, stringsAsFactors = FALSE);a$names<-rownames(a);a$names<-as.character(a$names);b<- a[ , order(names(a))];c <- setNames(data.frame(t(b[,-1])), b[,1]); kable(head(c), format = 'rst', row.names = FALSE);"
, но возникает эта ошибка:
Error in order(names(a)) : argument 1 is not a vector
Execution halted
, но тот же сценарий отлично работает при запуске в RStudio. В чем дело?
обновление: Мой стол a
в оболочке (терминал) ![enter image description here](https://i.stack.imgur.com/Y6mko.png)
и Мой стол a
в RStudio: ![enter image description here](https://i.stack.imgur.com/F4wMY.png)