从IC2功能中提取编号 [英] Extract with number from IC2 function

查看:101
本文介绍了从IC2功能中提取编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从calcSConc函数(软件包IC2)中提取一个数字。我可以分两个步骤分别提取我需要的数字:

I trying to extract one number from calcSConc function (package IC2). I can extract number which I require separately in two steps:

#CODE
library(IC2)
library(dplyr)

DATA_REFORM<-rnorm(1000, 3, .25)
DATA_REFORM1<-rnorm(5000, 6, .50)

dn_0<-calcSConc(DATA_REFORM,DATA_REFORM1)
dn_1<-data.frame(dn_0[[1]])
dn_1<-round(dn_1,6)
dn_1

此函数的输出如下:

         index parameter
SConc 0.000115         2

所以我的意图是将这个唯一的数字0.000115放入下面的代码的数据框中:

So my intention is to put this only number 0.000115 into data frame with code below:

INEQ_TOTAL_INCOME_OUTPUT<-data.frame(
  "Concentration coefficient of taxes with respect to pre-tax"= round(IC2::calcSConc(DATA_REFORM,DATA_REFORM1),6)
  check.names = FALSE
)

所以有人可以帮我解决这个问题吗代码并获得结果0.000115,但进入数据框?

So can anybody help me how to fix this code and get result 0.000115 but into data frame ?

推荐答案

n仅从输出中提取 index 部分:

You can extract only the index part from the output :

data.frame("Concentration coefficient of taxes with respect to pre-tax" = 
           round(IC2::calcSConc(DATA_REFORM,DATA_REFORM1)[[1]]$index,6), 
           check.names = FALSE)

#      Concentration coefficient of taxes with respect to pre-tax
#SConc                                                  -0.000252

这篇关于从IC2功能中提取编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆