linear regression in R

I have a question which is perhaps more a statistical query than one related to r directly, however it may be that I am just invoking an r package incorrectly so I will post the question here. I have the following dataset: x<-c(1e-08, 1.1e-08, 1.2e-08, 1.3e-08, 1.4e-08, 1.6e-08, 1.7e-08, 1.9e-08, 2.1e-08, 2.3e-08, 2.6e-08, 2.8e-08, 3.1e-08, 3.5e-08, 4.2e-08, 4.7e-08, 5.2e-08, 5.8e-08, 6.4e

R中的线性回归

我有一个问题,可能更多的是一个统计查询,而不是直接与r相关的问题,但可能是因为我只是错误地调用了一个r软件包,所以我会在这里发布这个问题。 我有以下数据集: x<-c(1e-08, 1.1e-08, 1.2e-08, 1.3e-08, 1.4e-08, 1.6e-08, 1.7e-08, 1.9e-08, 2.1e-08, 2.3e-08, 2.6e-08, 2.8e-08, 3.1e-08, 3.5e-08, 4.2e-08, 4.7e-08, 5.2e-08, 5.8e-08, 6.4e-08, 7.1e-08, 7.9e-08, 8.8e-08, 9.8e-08, 1.1e-07, 1.23e-07, 1.38e-07

The right way to plot multiple y values as separate lines with ggplot2

I often run into an issue where I have a data frame that has a single x variable, one or more facet variables, and multiple different other variables. Sometimes I would like to simultaneously plot different y variables as separate lines. But it is always only a subset I want. I've tried using melt to get "variable" as a column and use that, and it works if I want every single col

用ggplot2将多个y值绘制为单独的行的正确方法

我经常遇到一个问题,我有一个数据框架,其中包含一个x变量,一个或多个方面变量以及多个不同的其他变量。 有时我想同时将不同的y变量绘制为单独的行。 但它始终只是我想要的一个子集。 我已经尝试使用融合来获取“变量”作为列并使用它,并且如果我想要原始数据集中的每一列都有效,它就可以工作。 通常我不会。 现在我一直在做的事情真的迂回感觉。 假设用mtcars我想绘制disp,hp和wt对mpg: ggplot(mtcars, aes(x=mpg))

join from dplyr package produces NA results in the new column

When I produce left_join (left_join from package dplyr) of the below given data frames , the result (ie,)the new column after the join tends to be NA. The columns 'V1','V1_1','V1_2','V1_3' are factors from data frames "df1" and "df2" respectively. By converting them to characters following warning message was removed which had occurred earlie

来自dplyr包的连接在新列中产生NA结果

当我生成以下给定数据帧的left_join(来自包dplyr的left_join)时,结果(即)连接后的新列往往是NA。 列'V1','V1_1','V1_2','V1_3'分别是来自数据帧“df1”和“df2”的因子。 通过将它们转换为字符后警告消息被移除了之前发生的事件。 警告信息: 在left_join_impl(x,y,by $ x,by $ y,后缀$ x,后缀$ y)中:加入字符向量和因子,强制转换为字符向量 然而,在删除警告和清理代码

Controlling alpha in ggparcoord (from GGally package)

I am trying to build from a question similar to mine (and from which I borrowed the self-contained example and title inspiration). I am trying to apply transparency individually to each line of a ggparcoord or somehow add two layers of ggparcoord on top of the other. The detailed description of the problem and format of data I have for the solution to work is provided below. I have a dataset

控制ggparcoord中的alpha(来自GGally包)

我试图从类似于我的问题(我从中借鉴自足的例子和标题灵感)来构建。 我试图将透明度单独应用于ggparcoord的每一行,或者以某种方式将ggparcoord的两层添加到另一行的顶部。 下面提供了解决方案的数据问题和数据格式的详细说明。 我有一个包含数千行的数据集,我们称它为x 。 library(GGally) x = data.frame(a=runif(100,0,1),b=runif(100,0,1),c=runif(100,0,1),d=runif(100,0,1)) 在对这些数据进行聚类后,我还得到一组

Controlling color in ggparcoord (from GGally package)

I am trying to hard-code the desired line color for a particular ggparcoord plot. For instance, when I create my ggparcoord plot below: library(GGally) x = data.frame(a=runif(100,0,1),b=runif(100,0,1),c=runif(100,0,1),d=runif(100,0,1)) x$cluster = "green" x$cluster2 = factor(x$cluster) ggparcoord(x, columns=1:4, groupColumn=5, scale="globalminmax", alphaLines = 0.99) + xlab("Sample") + ylab("lo

控制ggparcoord中的颜色(来自GGally包)

我正在试图为特定的ggparcoord图块硬编码所需的线颜色。 例如,当我在下面创建我的ggparcoord图时: library(GGally) x = data.frame(a=runif(100,0,1),b=runif(100,0,1),c=runif(100,0,1),d=runif(100,0,1)) x$cluster = "green" x$cluster2 = factor(x$cluster) ggparcoord(x, columns=1:4, groupColumn=5, scale="globalminmax", alphaLines = 0.99) + xlab("Sample") + ylab("log(Count)") 即使我尝试指定“绿色”的颜色,

color discrete groups of parallel coordinate plot in GGally package

To create a parallel coordinate plot I wanted to use ggparcoord() function in package GGally . The following codes show a reproducible example. set.seed(3674) k <- rep(1:3, each=30) x <- k + rnorm(mean=10, sd=.2,n=90) y <- -2*k + rnorm(mean=10, sd=.4,n=90) z <- 3*k + rnorm(mean=10, sd=.6,n=90) dat <- data.frame(group=factor(k),x,y,z) library(GGally) ggparcoord(dat,columns=1:4,g

GGally包中的平行坐标图的颜色离散组

要创建一个平行坐标图我想用ggparcoord()函数封装GGally 。 以下代码显示了一个可重复的示例。 set.seed(3674) k <- rep(1:3, each=30) x <- k + rnorm(mean=10, sd=.2,n=90) y <- -2*k + rnorm(mean=10, sd=.4,n=90) z <- 3*k + rnorm(mean=10, sd=.6,n=90) dat <- data.frame(group=factor(k),x,y,z) library(GGally) ggparcoord(dat,columns=1:4,groupColumn = 1) 在图片中注意,即使我将组变量作为一个

Plotting data with Multiple Conditions on a Single Chart

I am attempting to make a plot using ggplot2 with side by side bars generated from certain conditions that can be calculated from the data. I suspect the problem is formatting my data properly so that ggplot will give me what I want. I can't for the life of me get it right though. What I have is data frame filled with rows for each time a student takes a course at a school. The variables

在单个图表上绘制多个条件的数据

我正在尝试使用ggplot2进行绘图,并使用可从数据中计算出来的某些条件生成的并排条。 我怀疑问题是正确地格式化我的数据,这样ggplot会给我我想要的。 尽管如此,我无法为我的生活做好准备。 我所拥有的是每次学生在学校上课的数据框都填充了行。 感兴趣的变量是Student.ID,Course.ID,Session,Fiscal.Year和Facility。 每一行都是学生参加课程的一种情况,并告诉他们所采取的课程,他们接受的课程等等。据我所知,这是

Remove background colour in ggpairs from GGally

I'm plotting all my graphs with theme_bw() in ggplot2, and now i'd like to apply the same (or similar) theme to a ggpairs plot of GGally. I tried it this way, but this seems to have no effect: p <- ggpairs(vars, columns=1:ncol(vars), lower=list(params=c(alpha = 0.5, theme(panel.background = element_blank())))) Is there a way to apply a ggplot2-theme to a ggpairs plot ?

从GGally中删除ggpairs的背景颜色

我在ggplot2中绘制了所有带有theme_bw()的图形,现在我想将相同(或类似)的主题应用于GGally的ggpairs情节。 我试过这种方式,但是这似乎没有效果: p <- ggpairs(vars, columns=1:ncol(vars), lower=list(params=c(alpha = 0.5, theme(panel.background = element_blank())))) 有没有办法将ggplot2主题应用于ggpairs情节?

Parallel Coordinates

Does anyone know if there is a way to add variable labels to the ggparcoord function in GGally? I've tried numerous ways with geom_text , but nothing is yielding results. To be more explicit, I am looking to pass the row.names(mtcars) through geom_text . The only way that I can distinguish the car is passing row.names(mtcars) through the groupColumn argument, but I don't like the way

平行坐标

有没有人知道是否有一种方法可以将变量标签添加到ggparcoord中的ggparcoord函数中? 我用geom_text尝试了很多方法,但没有任何结果。 为了更加明确,我期待通过row.names(mtcars)通过geom_text 。 我能区分汽车的唯一方法是通过groupColumn参数传递row.names(mtcars) ,但我不喜欢这种方式。 不起作用: mtcars$carName <- row.names(mtcars) # This becomes column 12 library(GGally) # Attempt 1 ggparcoord(mtcars,

Plot a smooth graph in R

In RI want to Plot a smooth graph (with its shadowed margin) which contains “age” and “circumference” variables on X and Y-axis for ready Orange data What is “method” of smoothing which ggplot2 uses? I do like this but get erros: x <- Orange[2] y <- Orange[3] lo <- loess(y~x) plot(x,y) lines(predict(lo), col='red', lwd=2) Error(s), warning(s): Error in model.frame.default(formula =

在R中画一个平滑的图

在RI中想绘制一个平滑的图形(其阴影边缘),其中包含X和Y轴上的“年龄”和“圆周”变量,以获得就绪橙色数据 什么是ggplot2使用的平滑的“方法”? 我喜欢这个,但得到erros: x <- Orange[2] y <- Orange[3] lo <- loess(y~x) plot(x,y) lines(predict(lo), col='red', lwd=2) 错误,警告:错误model.frame.default(公式= y〜x):变量'y'的无效类型(列表)调用:黄土 - > eval - > eval - > -