<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - .NET Core 1.0</title>
<!-- Add local styles, mostly for plugins css file -->
@if (IsSectionDefined("Styles"))
{@RenderSection("Styles", required: false)}
<environment names="Development">
@*<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />*@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="~/lib/font-awesome/css/font-awesome.css" />
<link rel="stylesheet" href="~/lib/metisMenu/dist/metisMenu.css" />
<link rel="stylesheet" href="~/css/animate.css" />
<link rel="stylesheet" href="~/css/style.css" asp-append-version="true" />
</environment>
<environment names="Staging,Production">
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/lib/font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" href="~/lib/metisMenu/dist/metisMenu.min.css" />
<link rel="stylesheet" href="~/css/animate.css" />
<link rel="stylesheet" href="~/css/style.css" asp-append-version="true" />
</environment>
</head>
<body>
<!-- Wrapper-->
<div id="wrapper" class="@Html.PageClass()">
<!-- Main view -->
@RenderBody()
</div>
<!-- End wrapper-->
<environment names="Development">
<script src="~/lib/jquery/dist/jquery.js"></script>
@*<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>*@
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="~/lib/metisMenu/dist/metisMenu.js"></script>
<script src="~/lib/slimScroll/jquery.slimscroll.js"></script>
<script src="~/lib/pace/pace.js"></script>
<script src="~/js/script.js"></script>
<script src="~/lib/angular/angular.js"></script>
</environment>
<environment names="Staging,Production">
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="~/lib/metisMenu/dist/metisMenu.min.js"></script>
<script src="~/lib/pace/pace.min.js"></script>
<script src="~/lib/slimScroll/jquery.slimscroll.min.js"></script>
<script src="~/js/script.js" asp-append-version="true"></script>
</environment>
@RenderSection("scripts", required: false)
</body>
</html>
我有一些列。它们都有数值,但是当我在R中导入它们时,它们似乎是一个字符数据类型。我想将这些字符转换为整数,并从具有它们的列中删除%符号
$Budget(chr)"3,000.00", "2,000.00", "2,000.00"...
$Impressions(int) 0, 0, 0, 0...
$Interactions(int) 0, 0, 0...
$Interaction.Rate(chr) "0.00%", "0.00%", "0.00%"...
$Avg..Cost (dbl) 0, 0, 0, 0, 0, 0, 0...
$Cost(chr) "0", "0", "0", "0"...
$Clicks(int) 0, 0, 0, 0...
$CTR(chr) "0.00%", "0.00%", "0.00%"...
我尝试过这样做,但没有结果却给了我错误:
警告消息:在eval(替换(expr),envir,enclos)中:NAs 强制引入
任何人都可以帮助我解决这个问题
答案 0 :(得分:0)
您可以使用transform
将其转换回numeric
。
transform(mData, Budget= as.numeric(Budget), Interaction.Rate = as.numeric(nteraction.Rate), ...)
要删除,
和%
,请使用gsub
(从here获得想法)
mData$Budget<- as.numeric(gsub("," ,"" ,mData$Budget))