R error: "invalid type (NULL) for variable"

I'm currently working with data from a questionnaire where answers have been added up to find before and after scores and subsequently subtracted to find differences. I am trying to run a Mann-Witney U test to test if there is a difference between the difference scores after viewing different educational interventions. The data is arranged so one column is the differences from the first edu

R错误:“变量的无效类型(NULL)

我目前正在使用调查问卷中的数据,其中的答案已添加到分数前后查找,然后减去以找出差异。 我试图运行Mann-Witney U测试来测试观看不同教育干预后差异分数之间是否存在差异。 数据的排列方式使得一列是与第一次教育干预的差异,第二列是与第二次教育干预的差异。 当我运行代码时: wilcox.test(formula=opinion$video~opinion$writtenpiece) 我得到这个错误: model.frame.default(formula = views $ video〜opinion $ w

axis with facets

Seems that this topic has not been covered this since the ggplot2.2.2 update where old solutions like this one and this one no longer apply. Fortunately, the process is far simpler than before. One line of code and you have a secondary Y-axis (as shown here). But I cannot get a secondary X-axis on my plots... I am comparing a depth profile of metal concentrations along the sediment core. I

轴与小平面

似乎自ggplot2.2.2更新以来没有涵盖这个主题,其中旧的解决方案像这个和这个不再适用。 幸运的是,这个过程比以前简单得多。 一行代码,你有一个辅助的Y轴(如图所示)。 但我无法在我的地块上获得第二个X轴... 我正在比较沿沉积物核心的金属浓度的深度剖面。 我想将碳和磷酸盐浓度显示为金属浓度背后的geom_area 。 问题是碳和磷酸盐的浓度都不和金属相同。 因此我需要第二个轴。 主题如下(摘自本网站): theme_ne

R, ggplot — customize my barplot

This is my datastructure: Accession Source Name NucSource Order color Counts Normalized 1 Str1 Our Str1 ch 1 #1C9099 66827 2.318683e-01 2 Str1_plasmid Our Str1 pl 2 #1C9099 26 9.021169e-05 3 Str2 Our Str2 ch 3 #1C9099 288211 1.000000e+00 4 Str2_plasmid Our Str2 pl 4 #1C9099 71858 2.493243e-01 5

R,ggplot - 自定义我的barplot

这是我的数据结构: Accession Source Name NucSource Order color Counts Normalized 1 Str1 Our Str1 ch 1 #1C9099 66827 2.318683e-01 2 Str1_plasmid Our Str1 pl 2 #1C9099 26 9.021169e-05 3 Str2 Our Str2 ch 3 #1C9099 288211 1.000000e+00 4 Str2_plasmid Our Str2 pl 4 #1C9099 71858 2.493243e-01 5

"minimum count is not zero" error for zero inflated model

Here is the data of my regression : y is the number of passengers at platform of the train station in each 2 minutes period while A1 to A17 are the number of passengers at 17 study areas on concourse. Time lag has already between considered by shifting the Xs. Since sometimes, there will be no one waiting in the study areas on concourse, so excess zero occurs. I am planing to use zero inflat

零膨胀模型的“最小计数不为零”错误

以下是我的回归数据: y是火车站平台每2分钟的乘客人数,而A1到A17分别是17个研究区的乘客人数。 时间差已经通过移动X来考虑。 由于有时在大厅的研究区域内不会有人在等待,因此会出现超零。 我打算使用零膨胀模型。 我已经尝试过如下所示的代码,但它说“最小计数不是零”这是什么意思,我该如何解决它? 我已经完成了泊松,没关系,但是没有膨胀就行不通。 > setwd('C:/Users/zuzymelody/Desktop') > try<-r

Looping subsets in plm

I'm trying to program something quite simple (I think) in R, but I can't seem to get it right. I have a dataset of 50 countries (1 to 50) for 15 years each and about 20 variables per country. For now I am only testing one variable ( OS ) on my dependent variable ( SMD ). I would like to do this with a loop country by country so I would get the output for each country in stead of the ov

在plm中循环子集

我正在尝试在R中编写一些非常简单的(我认为)的东西,但我似乎无法做到。 我有一个包含50个国家(1至50)的数据集,每个国家15年,每个国家约20个变量。 现在我只在我的因变量( SMD )上测试一个变量( OS )。 我想按照国家的循环国家来做这件事,这样我就能得到每个国家的产量而不是总产量。 我认为首先创建一个子集是明智的(首先能够看到国家1,之后我的循环应该增加国家和测试国家2的数量)。 我相信我在页面底部的

Is there a

I am running rolling regressions in R, using with the data stored in a data.table . I have a working version, however it feels like a hack -- I am really using what i know from the zoo package, and none of the magic in data.table ... thus, it feels slower than it ought to be. Incorporating Joshua's suggestion - below - there is a speedup of ~12x by using lm.fit rather than lm . (revised

有没有

我在R中运行滚动回归,使用存储在data.table的数据。 我有一个工作版本,但它感觉像一个黑客 - 我真的使用我从zoo包中知道的,并没有data.table中的魔法......因此,它感觉比它应该慢。 结合约书亚的建议(见下文),通过使用lm.fit而不是lm来加速约12倍。 (修改)示例代码: require(zoo) require(data.table) require(rbenchmark) set.seed(1) tt <- seq(as.Date("2011-01-01"), as.Date("2012-01-01"), by="day")

R Sweave output error

I'm using RStudio v0.96.331 with pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian). I have a R project in the '/home/operacao/Myprojs/projName', which is my working directory. Now, if i create a folder called 'reports' in '/home/operacao/Myprojs/projName/reports', and inside the sweave file (which is in the reports folder) use the code setwd('/home/operaca

R Sweave输出错误

我使用pdfTeX版本3.1415926-1.40.10(TeX Live 2009 / Debian)使用RStudio v0.96.331。 我在'/ home / operacao / Myprojs / projName'中有一个R项目,这是我的工作目录。 现在,如果我在'/ home / operacao / Myprojs / projName / reports'中创建一个名为'reports'的文件夹,并且在sweave文件(它位于reports文件夹中)中使用代码 setwd('/home/operacao/Myprojs/projName') 加载一些包后,我

Options for caching / memoization / hashing in R

I am trying to find a simple way to use something like Perl's hash functions in R (essentially caching), as I intended to do both Perl-style hashing and write my own memoisation of calculations. However, others have beaten me to the punch and have packages for memoisation. The more I dig, the more I find, eg memoise and R.cache , but differences aren't readily clear. In addition, it

R中的缓存/记忆/散列选项

我试图找到一种简单的方法来在R中使用类似Perl的哈希函数(本质上是缓存),因为我打算同时执行Perl风格的哈希和编写自己的计算记忆。 然而,其他人已经打了我一拳,并有包裹为memoisation。 我挖的越多,我发现的越多,例如memoise和R.cache ,但差异不是很清楚。 此外,还不清楚除了使用hash包之外,还有其他人可以获得Perl风格的哈希(或Python风格的词典)并编写自己的记忆,这似乎并不支持这两个记忆包。 由于我找不到

How to check if a word exists in the Wordnet database

Objective: I have a document with many words. I need to figure out which words have spelling mistakes. I have installed WordNet 3.0 for this. With the below command, I can check if the word actually exists in the wordnet database but this needs me to specify the POS ie NOUN, PRONOUN,etc. which I might not know in advance filter <- getTermFilter("ExactMatchFilter", "car", TRUE) terms <

如何检查Wordnet数据库中是否存在单词

目标:我有一个文字很多的单词。 我需要弄清楚哪些单词有拼写错误。 我为此安装了WordNet 3.0。 使用下面的命令,我可以检查wordnet是否真的存在于wordnet数据库中,但这需要我指定POS,即NOUN,PRONOUN等。 事先我可能不知道 filter <- getTermFilter("ExactMatchFilter", "car", TRUE) terms <- getIndexTerms("NOUN", 5, filter) 请让我知道一种方法来解决我在R中的问题 一种方法: library(wordnet) inWord

mode to structure an analysis

I am trying to make better use of org-mode for my projects. I think literate programming is especially applicable to the realm of data analysis and org-mode lets us do some pretty awesome literate programming. I think most of you will agree with me that the workflow for writing an analysis is different than most other types of programming. I don't just write a program, I explore the data.

模式来构建分析

我正在尝试更好地使用组织模式来处理我的项目。 我认为文学编程特别适用于数据分析领域,组织模式让我们可以做一些非常棒的文学编程。 我想大多数人会同意我的观点,写分析的工作流程与大多数其他类型的编程不同。 我不只是写一个程序,我会探索这些数据。 而且,虽然这些探索中的很多都是死路一条,但我不想完全删除/忽略它们。 我只是不想在每次执行组织文件时重新运行它们。 我也倾向于找到或开发有用的代码块,我希望