R:让dplyr和摘要显示多于3位数字

问题描述

这失败。我需要小数点右边的3位数字。

require("dplyr")
options(digits = 10)
group_by(MyData,Type_1,Type_2) %>%
  summarise(
  count = n(),mean = mean(Rate,na.rm = TRUE),sd = sd(Rate,na.rm = TRUE)
)

# A tibble: 4 x 5
# Groups:   Type_1 [2]
  Type_1  Type_2 count  mean    sd
  <fct>  <fct> <int> <dbl> <dbl>
1 A      X        8  1203. 120. 
2 A      Y        8  1324. 99.1
3 B      X        8  1162. 106. 
4 B      Y        8  1639. 118. 

我也尝试过

options(pillar.sigfigs=10)

我正在寻找一个答案。我用什么替换上面的数字设置?

感谢您的帮助。

解决方法

问题是我曾经说过要使用的参考

{% extends 'store/main.html' %}
{% load static %}
{% block content %}
    <div class="row justify-content-center">
    {% for product in products %}
        <div class="col-xs-12">
            <img class="thumbnail" src="{{ product.imageURL }}">
            <div class="box-element product">
                <div class="container">
                    <div class="row">
                        <div class="col">
                            <h4><strong>{{ product.name }}</strong></h4>
                        </div>
                        {% if product.print %}
                            <div class="col" id="size-info">
                                <h4 style="display: inline-block; float: right">
                                    <strong>size: {{ product.print.size }}</strong></h4>
                            </div>
                        {% endif %}
                    </div>
                </div>
                <hr>
                <div class="container">
                    <div class="row">
                        <div class="col-xs-2">
                            <div class="row">
                                {% if product.shirt %}
                                    <div class="col select-outline">
                                        <select id="size-selector" class="browser-default custom-select">
                                            <option value="" disabled>Size</option>
                                            {% for value,text in product.shirt.available_sizes %}
                                                <option value="{{ text }}">{{ text }}</option>
                                            {% endfor %}
                                        </select>
                                    </div>
                                {% endif %}
                            </div>
                        </div>
                        <div class="col-8">
                            <button data-product="{{ product.id }}" data-action="add" data-size="{{ text }}"
                                    class="btn btn-outline-secondary add-btn update-cart">Add to Cart
                            </button>
                            <a class="btn btn-outline-success" href="#">View</a>
                        </div>
                        <div class="col">
                            <h4 style="display: inline-block; float: right"><strong>${{ product.price }}</strong>
                            </h4>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    {% endfor %}
{% endblock content %}
</div>

何时需要使用

options(pillar.sigfigs=7)

R并没有给您一个错误,说明它不知道options(pillar.sigfig=7) 是什么意思。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...