我正在编写一个函数,将其合并到闪亮的应用程序中,该应用程序可以从一组预定义的文件中预测下一个单词。当我创建使用 ngram 预测下一个单词的函数时,
我遇到了这个错误
x object of type 'closure' is not subsettable
i Input ..1 is top_n_rank(1, n).
Run rlang::last_error() to see where the error occurred.
In addition: Warning message:
In is.na(x) : is.na() applied to non-(list or vector) of type 'closure'
Run Code Online (Sandbox Code Playgroud)
这是我的 R 程序。我已经在另一个 R 脚本中创建了二元三元和四元词,并将其保存为我在此处使用的 rds 文件
library(tidyverse)
library(stringr)
library(dplyr)
library(ngram)
library(tidyr)
bi_words <- readRDS("./bi_words.rds")
tri_words <- readRDS("./tri_words.rds")
quad_words <- readRDS("./quad_words.rds")
bigram <- function(input_words){
num <- length(input_words)
dplyr::filter(bi_words,
word1==input_words[num]) %>%
top_n(1, n) %>%
filter(row_number() == 1L) %>%
select(num_range("word", …Run Code Online (Sandbox Code Playgroud) 我得到 ** Uncaught (in promise) TypeError: Cannot use 'in' operator to search for 'validateStatus' in 5f8425a33a14f026f80133ed** 其中 5f8425a33a14f026f80133ed 是传递给 axios url 的 id
我想根据用户 ID 显示服务。我的 url 在邮递员中工作得很好,但是当我从 veux 商店访问它时,它给出了一个错误。
services.js(商店)
import axios from 'axios';
const state = {
services : {},
status: '',
error: null
};
const getters = {
services : state => { return state.services }
};
const actions = {
async fetchServices({commit}, userId) {
let res = await axios.get('http://localhost:5000/api/services/displayUser' , userId)
commit('setProducts', res.data)
return res;
} …Run Code Online (Sandbox Code Playgroud)