当前位置:网站首页>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边栏推荐
- Boder radius has four values, and boder radius exceeds four values
- [DIY]如何制作一款个性的收音机
- 【DSP】【第二篇】了解C6678和创建工程
- recyclerview gridlayout 平分中间空白区域
- Implementation of packaging video into MP4 format and storing it in TF Card
- I've seen many tutorials, but I still can't write a program well. How can I break it?
- Math symbols in lists
- 拼多多败诉,砍价始终差0.9%一案宣判;微信内测同一手机号可注册两个账号功能;2022年度菲尔兹奖公布|极客头条
- [DSP] [Part 1] start DSP learning
- 什么是RDB和AOF
猜你喜欢
随机推荐
I've seen many tutorials, but I still can't write a program well. How can I break it?
##无yum源安装spug监控
Common doubts about the introduction of APS by enterprises
15 millions d'employés sont faciles à gérer et la base de données native du cloud gaussdb rend le Bureau des RH plus efficace
'class file has wrong version 52.0, should be 50.0' - class file has wrong version 52.0, should be 50.0
Kubernetes learning summary (20) -- what is the relationship between kubernetes and microservices and containers?
Leetcode question 283 Move zero
小孩子學什麼編程?
PHP online examination system version 4.0 source code computer + mobile terminal
Value of APS application in food industry
【微信小程序】運行機制和更新機制
Trends of "software" in robotics Engineering
基于STM32单片机设计的红外测温仪(带人脸检测)
Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
Solution to the 38th weekly match of acwing
Reinforcement learning - learning notes 5 | alphago
为什么新手在编程社区提问经常得不到回答,甚至还会被嘲讽?
Review questions of anatomy and physiology · VIII blood system
Xcode6 error: "no matching provisioning profiles found for application"
OAI 5G NR+USRP B210安装搭建