r - Computing histogram of particular column variable in R
问题描述
So I'm interested in making a histogram of values just for the "NV" variable (the column contains either "NV" or "VV".) How can I extract just these particular values?
解决方案
由于您没有提供可重现的示例:
虚拟数据
df <- data.frame(id=c(rep("NV",15),rep("VV",15)),value=sample(x = 1:100,size = 30,replace = TRUE))
通过对所需值进行子集化来创建直方图
hist(df[df$id=="NV",]$value)
或者
hist(df[df$id=="NV",2])
推荐阅读
- oracle - 按表优先级连接具有部分相同列值的多个表(获取所有表 A,连接所有不在 A 中的表,连接所有不在 A 或 B 中的表 C)
- symfony - Symfony 3.4 中的奏鸣曲管理包
- python-3.x - 使用 Python 从文件中复制文本后追加行
- linq - 字符串替换所有与字符串列表匹配的子字符串 C# LINQ
- sql - 根据不同的条件对不同表的列进行计数,并通过公共列连接 (SQL) 进行分组
- c++ - 函数采用指向方法的指针,而不考虑 constness
- javascript - ReactJS how do i save input file multiple image base64
- node.js - 在这种情况下,以下 npm 文档中的“全局运行 npm 包”是什么意思?
- log4j2 - 带有控制台的 log4j2 xml 配置
- c - 使用 O_CREAT O_WRONLY :如何获取文件中的当前位置并在末尾附加数据?