当前位置:网站首页>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边栏推荐
- Review questions of anatomy and physiology · VIII blood system
- Taylor series fast Fourier transform (FFT)
- Simple continuous viewing PTA
- In line elements are transformed into block level elements, and display transformation and implicit transformation
- Variable star --- article module (1)
- 【微信小程序】運行機制和更新機制
- Value of APS application in food industry
- Common doubts about the introduction of APS by enterprises
- Distributed ID
- [weekly pit] information encryption + [answer] positive integer factorization prime factor
猜你喜欢
新型数据库、多维表格平台盘点 Notion、FlowUs、Airtable、SeaTable、维格表 Vika、飞书多维表格、黑帕云、织信 Informat、语雀
What programming do children learn?
Laravel笔记-自定义登录中新增登录5次失败锁账户功能(提高系统安全性)
APS taps home appliance industry into new growth points
use. Net drives the OLED display of Jetson nano
Detailed explanation of knowledge map construction process steps
Why do novices often fail to answer questions in the programming community, and even get ridiculed?
Rhcsa Road
2022 portal crane driver registration examination and portal crane driver examination materials
Utilisation de l'écran OLED
随机推荐
使用.Net分析.Net达人挑战赛参与情况
2022 construction electrician (special type of construction work) free test questions and construction electrician (special type of construction work) certificate examination
Entity alignment two of knowledge map
Build your own application based on Google's open source tensorflow object detection API video object recognition system (IV)
What programming do children learn?
Rhcsa Road
1_ Introduction to go language
#yyds干货盘点#重新梳理箭头函数的this
Rhcsa Road
Why do novices often fail to answer questions in the programming community, and even get ridiculed?
No Yum source to install SPuG monitoring
Performance test process and plan
Detailed introduction of distributed pressure measurement system VIII: basic introduction of akka actor model
[wechat applet] operation mechanism and update mechanism
面试官:Redis中有序集合的内部实现方式是什么?
小孩子學什麼編程?
##无yum源安装spug监控
【DSP】【第一篇】开始DSP学习
PG基础篇--逻辑结构管理(事务)
Is it safe to open an account in flush? Which securities company is good at opening an account? Low handling charges