当前位置:网站首页>Select data Column subset in table R [duplicate] - select subset of columns in data table R [duplicate]
Select data Column subset in table R [duplicate] - select subset of columns in data table R [duplicate]
2022-07-06 20:51:00 【Rich in starch】
problem :
I have a data table with a bunch of columns, eg: I have a data table with a bunch of columns , for example :
dt<-data.table(matrix(runif(10*10),10,10))I want to perform some operation on the data table, such as producing a correlation matrix ( cor(dt) ). I want to perform some operations on the data table , For example, generate correlation matrix ( cor(dt) ).In order to do this, I want to remove a few columns that contain non-numeric values or values outside a certain range. So , I want to delete some columns that contain non numeric values or values outside a specific range .
Let's say I want to find the correlation matrix excluding V1, V2, V3 and V5. Suppose I want to find something that doesn't include V1、V2、V3 and V5 The correlation matrix of .
Here is my current approach: This is my current method :
cols<-!(colnames(dt)=="V1" | colnames(dt)=="V2" | colnames(dt)=="V3" | colnames(dt)=="V5")new_dt<-subset(dt,,cols)cor(new_dt)I find this pretty cumbersome, considering data.table syntax is usually so elegant. I think it's troublesome , because data.table Grammar is usually very elegant .Is there a better method of doing this? There is no better way to do this ?
Solution :
Reference resources : https://stackoom.com/en/question/1tshR边栏推荐
- 强化学习-学习笔记5 | AlphaGo
- Minimum cut edge set of undirected graph
- New database, multidimensional table platform inventory note, flowus, airtable, seatable, Vig table Vika, Feishu multidimensional table, heipayun, Zhixin information, YuQue
- 面试官:Redis中有序集合的内部实现方式是什么?
- Mtcnn face detection
- 【每周一坑】正整数分解质因数 +【解答】计算100以内质数之和
- 1500萬員工輕松管理,雲原生數據庫GaussDB讓HR辦公更高效
- Leetcode question 283 Move zero
- Force deduction brush question - 98 Validate binary search tree
- 小孩子學什麼編程?
猜你喜欢

【每周一坑】正整数分解质因数 +【解答】计算100以内质数之和

Leetcode question 283 Move zero

拼多多败诉,砍价始终差0.9%一案宣判;微信内测同一手机号可注册两个账号功能;2022年度菲尔兹奖公布|极客头条

【DSP】【第二篇】了解C6678和创建工程

Variable star --- article module (1)

OLED屏幕的使用

APS taps home appliance industry into new growth points

Comment faire une radio personnalisée

Hardware development notes (10): basic process of hardware development, making a USB to RS232 module (9): create ch340g/max232 package library sop-16 and associate principle primitive devices

Reinforcement learning - learning notes 5 | alphago
随机推荐
Comment faire une radio personnalisée
Build your own application based on Google's open source tensorflow object detection API video object recognition system (IV)
Review questions of anatomy and physiology · VIII blood system
Taylor series fast Fourier transform (FFT)
Xcode6 error: "no matching provisioning profiles found for application"
R语言可视化两个以上的分类(类别)变量之间的关系、使用vcd包中的Mosaic函数创建马赛克图( Mosaic plots)、分别可视化两个、三个、四个分类变量的关系的马赛克图
Basic knowledge of lists
(work record) March 11, 2020 to March 15, 2021
自定义限流注解
What are RDB and AOF
15million employees are easy to manage, and the cloud native database gaussdb makes HR office more efficient
为什么新手在编程社区提问经常得不到回答,甚至还会被嘲讽?
Web开发小妙招:巧用ThreadLocal规避层层传值
Leetcode hot topic Hot 100 day 32: "minimum coverage substring"
小孩子学什么编程?
【每周一坑】计算100以内质数之和 +【解答】输出三角形
Event center parameter transfer, peer component value transfer method, brother component value transfer
SSO single sign on
Detailed introduction of distributed pressure measurement system VIII: basic introduction of akka actor model
[diy] how to make a personalized radio