小编bar*_*317的帖子

如何在数据框中完成缺失因子水平?

让我假装我有这样的事情:

df <- data.frame(
      PERSON = c("Peter", "Peter", "Marcel" , "Lisa", "Lisa"),        
      FRUIT = c("Apple", "Peach","Apple", "Apple", "Peach" ), 
      A = c(100, 200, 100, 200, 300), 
      B=c(1,2,3,4,5) )
df$PERSON <- as.factor(df$Person)
df$FRUIT <- factor(df$FRUIT, levels = c("Apple", "Peach", "Coconut"))
Run Code Online (Sandbox Code Playgroud)

结果如何

str(df): 'data.frame':  5 obs. of  4 variables:
$ PERSON: Factor w/ 3 levels "Lisa","Marcel",..: 3 3 2 1 1
$ FRUIT : Factor w/ 3 levels "Apple","Peach",..: 1 2 1 1 2
$ A     : num  100 200 100 200 …
Run Code Online (Sandbox Code Playgroud)

r dataframe

6
推荐指数
1
解决办法
2306
查看次数

Intellij 2017.2无法扩展

更新至2017.2后,Intellij IDEA无法在Dell Ultrasharp U2415b上正确扩展.图标非常大,工作空间非常小.

我已经检查过,Intellij用HiDPI支持改变了一些东西.

有人遇到同样的问题吗?

intellij-idea hidpi

5
推荐指数
1
解决办法
3177
查看次数

Azure Function-App 未记录到控制台或 AppInsights

我有一个带有 AzureFunctionVersion v3 的 Azure Function,一段时间以来,我在 Application Insights 或 Rider Console 中看不到任何未记录在 FunctionTrigger 本身中的日志。


[FunctionName("test")]
public IActionResult Test([HttpTrigger(AuthorizationLevel.Function, "delete", Route = BasePath + "/{roomId}")] HttpRequest req,
            ILogger log)
{
   log.LogInformation("Log is shown");

   myservice.DoIt();
}
Run Code Online (Sandbox Code Playgroud)
namespace MyApp.Test.Service {
   public MyService(ILoggerFactory loggerFactory)
   {       
     _log = loggerFactory.CreateLogger(GetType().Namespace);
   }

   public void DoIt() {
      _log.LogInformation("Log is not shown");
   }
}
Run Code Online (Sandbox Code Playgroud)

我的 host.json 看起来像:

"logging": {
        "applicationInsights": {
            "samplingExcludedTypes": "Request",
            "samplingSettings": {
                "isEnabled": false
            }
        },
        "logLevel": {
            "MyApp.*": "Information"
        }
    }
Run Code Online (Sandbox Code Playgroud)

logging azure azure-application-insights azure-functions

3
推荐指数
1
解决办法
2052
查看次数

echo 和 print_r 的奇怪输出

我发现了一些奇怪的行为,无法解释发生了什么:

$e = 3;
echo "with array " . print_r($e);
Run Code Online (Sandbox Code Playgroud)

给出:

3with array 1
Run Code Online (Sandbox Code Playgroud)

为什么?

php

-3
推荐指数
1
解决办法
199
查看次数