简体   繁体   English

如何处理错误“错误:所有(长度== 1L |长度== n)不为真”?

[英]How can I handle the error “Error: all(lengths == 1L | lengths == n) is not TRUE”?

I have been trying to solve this problem, but with no success. 我一直试图解决这个问题,但没有成功。 Imagine I have a google worksheet called "database". 想象一下,我有一个名为“数据库”的谷歌工作表。 In this worksheet I have a sheet called "Sheet1". 在这个工作表中,我有一个名为“Sheet1”的工作表。 And in this sheet I have a table (that starts from A1) with column names "a1", "a2", "a3". 在这张表中,我有一个表(从A1开始),列名为“a1”,“a2”,“a3”。

Now, I want to append a new row with values "12", "23", "34". 现在,我想追加一个值为“12”,“23”,“34”的新行。 For this I input this code: 为此,我输入以下代码:

library(googlesheets)

worksheet <- gs_title("database")
gs_add_row(ss=worksheet, ws="Sheet1", input = c("12","23","34"))

But when I do this, I get the following error: 但是当我这样做时,我收到以下错误:

Input is too long. Only first 0 elements will be used.
Error: all(lengths == 1L | lengths == n) is not TRUE

Thanks a lot 非常感谢

gs_add_rows only can add rows once the header is available in the google sheet so you need to create the first row or the header information with gs_edit_cells() before you use add_rows. gs_add_rows只能在Google表格中有标题后添加行,因此您需要在使用add_rows之前使用gs_edit_cells()创建第一行或标题信息。

This is explained in the googlesheets vignette. googlesheets vignette中对此进行了解释

Here is a screenshot of the appropriate code from the Vignette 以下是Vignette中相应代码的屏幕截图

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 KERAS IN R: Error in Summary.factor (c(1L, 1L, 1L, 1L,1L, 1L, 1L, 1L,1L, 1L, 1L, 1L, : &#39;min&#39; 对因子没有意义 - KERAS IN R: Error in Summary.factor (c(1L, 1L, 1L, 1L,1L, 1L, 1L, 1L,1L, 1L, 1L, 1L, : 'min' not meaningful for factors x [-1L]中的错误!= x [-n]:未实现这些类型的比较 - Error in x[-1L] != x[-n] : comparison of these types is not implemented is_corpus_df(corpus) 中的错误:all(names(corpus)[1L:2L] == c(“doc_id”, “text”)) 不是 TRUE - Error in is_corpus_df(corpus) : all(names(corpus)[1L:2L] == c(“doc_id”, “text”)) is not TRUE ggadjustedcurves survminer 错误 if (xi &gt; xj) 1L else -1L - ggadjustedcurves survminer Error in if (xi > xj) 1L else -1L R 中的 MANOVA。 如何解决此错误:“1L 中的错误:object$rank” - MANOVA in R. How do I solve this error: “Error in 1L:object$rank” 尝试完成模型平均时,如何处理 R 中的错​​误消息:“cf[, 1L] 中的错误:维数不正确” - How to handle error message: "Error in cf[, 1L] : incorrect number of dimensions" in R when trying to complete model-averaging R:错误 - rep.int(c(1, numeric(n)), n - 1L) 中的错误:&#39;times&#39; 值无效 - R: ERROR - Error in rep.int(c(1, numeric(n)), n - 1L) : invalid 'times' value 顺序错误(desc(var),by_group = TRUE):参数长度不同? - Error in order(desc(var), by_group = TRUE) : argument lengths differ? 我如何 plot 变量具有不同的长度= - How can I plot variable with different lengths= R: `[.data.table`(out, , `:=`(term_id, 1L:.N), by = list(doc_id)) 中的错误 - R: Error in `[.data.table`(out, , `:=`(term_id, 1L:.N), by = list(doc_id))
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM