### 统计代写|应用统计代写applied statistics代考|SUMMARIZING AND MANIPULATING DATA

statistics-lab™ 为您的留学生涯保驾护航 在代写应用统计applied statistics方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写应用统计applied statistics代写方面经验极为丰富，各种代写应用统计applied statistics相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

## 统计代写|应用统计代写applied statistics代考|SUMMARIZING AND MANIPULATING DATA

There are many tools in $\mathrm{R}$ to help you summarize your data efficiently. I think there are two functions worth knowing about at this stage: aggregate() from base $\mathrm{R}$ and summarize() from the dplyr package.
aggregate() is a very useful function that takes a column of raw data and summarizes it across one or more groups based on some chosen function (e.g., calculate the mean or the standard deviation, etc.). One nice think about using aggregate() is that you code the function of how you want your data summarized in the exact same format that you use for specifying plots or models (which we will cover in Chapter 5). The output of aggregate() is a data frame, which makes it easy to then use for plotting figures or other purposes. aggregate() takes three arguments: 1) the response and predictor variables, 2) the function you want to execute (with the “FUN=” argument), and 3) the data frame where the data can be found. For example, if you want to calculate the mean size of metamorphs at emergence across all combinations of Food and Resource treatments, you can type the following:

The package $d p l y r$ has many useful functions for data wrangling which we will cover in this book. By using some of these in combination, you can easily summarize your data. The utility of this may not be completely evident now, but it will be later, I promise (particularly in Chapter 9). The downside of dplyr is that, much like ggplot2, it has its own lexicon that is fairly distinct from the rest of $R$, meaning that you have to learn a whole

different set of commands. So be it. It’s pretty great once you learn the coding.

By using a few choice functions, such as group_by() and summarize(), we can easily say we want to calculate the means of whatever variable (or variables) we are interested in. Note of course that you can use different functions besides mean(), which is what we will start with here. The other important thing to note in the following code is the use of the pipe command, ‘ $\%>\%$ ‘, which designates the output of one line to be the input of the next.

## 统计代写|应用统计代写applied statistics代考|Introduction to Plotting

Before we get into the meat of how to most efficiently plot your data, it is useful to take a moment to talk about what makes a good figure. What is it that makes a high-quality figure, one that is suitable for publication or use in a presentation? I would argue that judicious use of color, large clear text and labels, and efficient usage of plot space are three hallmarks of a good figure. It is often useful to create multiple panels to show different aspects of your data. These fundamentals are the same whether you are making your figures in $R$ or not or using base graphics or ggplot2. If you are interested in a deeper dive into this topic, please check out the excellent book Fundamentals of Data Visualization by Claus O. Wilke, professor at The University of Texas (UT) Austin. He has written a particularly elegant and useful package called cowplot that provides not only a nice and easy to apply theme for ggplot2 to make

your figures look betterm, but it also contains many other functions which are useful.

There are two main ways to make figures in R: base graphics (i.e., those that are built into the base version of $R$ you downloaded from the Comprehensive R Archive Network (https://cran.r-project.org/) (CRAN) and using the package ggplot2. There are functions in other packages (e.g., the scatterplot() function in the car package, or the barplot2() function in the gplots package), but these all utilize the basic coding of base graphics. While ggplot 2 and base graphics use different coding styles, the fundamentals that make an effective graphic remain the same. Both types of coding allow you to build your graphics piece by piece and really give you control over every aspect of the figure.
Let’s talk about some basic nuts and bolts that are useful to know.

## 统计代写|应用统计代写applied statistics代考|Named colors

R has 657 named colors stored and ready to use. The full list of these can be viewed by typing colors() (or if you prefer, $\operatorname{colours}())$ at the command prompt. Using named colors is nice because you probably have an intuitive sense of what “slate grey” is going to look like, whereas a color defined by its red, green, and blue (RGB) values is less obvious. If you need to know what the exact RGB values of a named color are, simply use the function $\operatorname{col} 2 \mathbf{r g b}()$ and place the name of the color in quotes in the parentheses. For example, “col2rgb (‘yellow’)” would tell you the RGB values for yellow in $\mathrm{R}$.

$R$ allows you to define colors based on their red, green, and blue (RGB) values. This is particularly useful if you have a color scheme you want to match, perhaps for a presentation in MS PowerPoint or Apple Keynote, and thus you can specify the exact RGB color you are looking for (which might have come from that other program). Colors are defined using the rgb() function, which requires 3 arguments (not surprisingly they are the red, green, and blue values) as well as other optional arguments. The default is that all values have a minimum of 0 and a maximum of 1 , but you can set the max value to be 255 if you wish (which is likely how colors are defined in another program of your choosing). Lastly, you can also make an RGB color translucent by adjusting the alpha level (note that alpha is always on the same scale as the RGB values). For example, to set a color that was pure red but was $30 \%$ translucent (or conversely, $70 \%$ opaque), you would type the following.

## 统计代写|应用统计代写applied statistics代考|SUMMARIZING AND MANIPULATING DATA

aggregate() 是一个非常有用的函数，它采用一列原始数据并根据某些选择的函数（例如，计算平均值或标准差等）将其汇总到一个或多个组中。使用aggregate() 的一个很好的想法是，你可以用你用来指定图或模型的完全相同的格式来编码你希望如何汇总数据的函数（我们将在第5章中介绍）。aggregate() 的输出是一个数据框，这使得它很容易用于绘制图形或其他目的。aggregate() 接受三个参数：1) 响应变量和预测变量，2) 您要执行的函数（使用“FUN=”参数），以及 3) 可以找到数据的数据框。例如，如果您想计算所有食物和资源处理组合中出现时变质的平均大小，

## 统计代写|应用统计代写applied statistics代考|Named colors

R 存储了 657 种命名颜色，可供使用。可以通过键入 colors() 来查看这些的完整列表（或者，如果您愿意，颜色⁡())在命令提示符下。使用命名颜色很好，因为您可能对“板岩灰色”的外观有直观的感觉，而由其红色、绿色和蓝色 (RGB) 值定义的颜色则不太明显。如果您需要知道命名颜色的确切 RGB 值是什么，只需使用函数山口⁡2rGb()并将颜色的名称放在括号中的引号中。例如，“col2rgb (‘yellow’)”会告诉你黄色的 RGB 值R.

R允许您根据红色、绿色和蓝色 (RGB) 值定义颜色。如果您有想要匹配的配色方案，这可能特别有用，可能用于 MS PowerPoint 或 Apple Keynote 中的演示文稿，因此您可以指定您正在寻找的确切 RGB 颜色（可能来自其他程序）。颜色是使用 rgb() 函数定义的，它需要 3 个参数（毫不奇怪，它们是红色、绿色和蓝色值）以及其他可选参数。默认情况下，所有值的最小值为 0 ，最大值为 1 ，但您可以根据需要将最大值设置为 255（这可能是您选择的另一个程序中定义颜色的方式）。最后，您还可以通过调整 alpha 级别使 RGB 颜色半透明（请注意，alpha 始终与 RGB 值处于相同的比例）。例如，30%半透明（或相反，70%不透明），您将键入以下内容。

## 有限元方法代写

tatistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。