a b c a b c a b c a b c a b c a B CLevels:a B C D E> table (d)DA B C D E10 10 10) 0 0> table (d, exclude= "B")DA C D E10 10 0 0
function lapply and function sapply:
Lapply is used in the following format:Lapply (X, fun, ...) The return value of Lapply is a list object with the same length as x, and each element in the list object is applied to each element of the X. where x is a list object (each element of the list is a vector), other
Apply ()Apply (M,dimcode,f,fargs)
M is a matrix.
DimCode is the dimension number, 1 is applied to the row, and 2 is the function for the column.
F is a function
Fargs is an optional parameter set for F
> z > f + x/c(2, 8)+ }> apply(z,1,f) #f函数得到两个元素,则为几行,竖着来的 [,1] [,2] [,3][1,] 0.5 1.000 1.50[2,] 0.5 0.625 0.75Lapply ()Lapply () (on behalf of list apply) is similar to the use of the Apply () function of the matrix, ex
Apply ()Apply (M,dimcode,f,fargs)
M is a matrix.
DimCode is the dimension number, 1 is applied to the row, and 2 is the function for the column.
F is a function
Fargs is an optional parameter set for F
> z > f + x/c(2, 8)+ }> apply(z,1,f) #f函数得到两个元素,则为几行,竖着来的 [,1] [,2] [,3][1,] 0.5 1.000 1.50[2,] 0.5 0.625 0.75Lapply ()Lapply () (on behalf of list apply) is similar to the use of the Apply () function of the matrix, ex
The R language provides a bulk processing function that iterates through all or part of the elements within a collection to simplify operations.
The bottom of these functions is achieved by C, so efficiency is more efficient than manual.The batch processing function has very important apply family function: lapply sapply apply tapply mapply. The Apply family function is one of the methods to realize the computational quantization (vectorization) with
='output.txt', append =TRUE) - ##cat还可以对已有内容的文件加操作---As to why this is not the direct use of output I am also very surprised AboutCat (101:200,sep ='\ n', File ='output.txt', append =TRUE) $ ##读取txt -Input 'output.txt') - input - A ##开始一个新的例子 + ##读取路径 thePath ] - ##改路径下的所有文件夹? $Doc.names dir (path) the Doc.names the ##改变路径 theDoc.path sapply (doc.names,function (names) { thePaste (Path,names,'DESCRIPTION'
Recently participated in a small game where the tapply,sapply (lapply) function can quickly achieve my purpose and effectively reduce the amount of code
F
Description
Tapply (X,F,G)
X is a vector, F is a factor column, G is an action function, and a similar operation with a data frame can be done by using the by function
Sapply (LIST,G)
G is the operatio
When you use the Unlist function to convert a list of date types to vectors, you do not get the desired result, as follows:Datelst datelst[[1]][1] "2015-08-11"datevector DATEVECTOR[1] 16658 The same reason for using sapply (X, fun, ..., simplify = TRUE, use. NAMES = TRUE), if X is a date-type vector, fun returns the date, then the result will not be the expecte
Words and Their frequenciesplot the wordcloud Example 1: tweets via TwitterStep 1:Load all the required packageslibrary(twitteR)library(tm)library(wordcloud)library(RColorBrewer)Step 2:Let's get some tweets in English containing the words "Machine Learning"mach_tweets = searchTwitter("machine learning", n=500, lang="en")Step 3:Extract the text from the tweets in a vectormach_text = sapply(mach_tweets, function(x) x$getText())Step 4:Construct the lexi
ObjectiveAt the beginning of the contact with the R language, you will hear a variety of R language use skills, the most important one is not to use the loop, the efficiency is particularly low, to use vector computing instead of cyclic calculation.So, what is this for? The reason is that R's cyclic operation for and while, are based on the R language itself, and
Label:Vi/vim Use advanced: Use GDB debugging in Vim – use Vimgdb The help entry for the commands used in this section: In the original design of Unix system, there is a very important idea: each program only to achieve a single function, through the pipeline and other ways to connect multiple programs, so that they work together to achieve more powerful function
Directory
Baidu Library solution (I)-Overall Thinking
Baidu Library solution (2) -- use Jacob to call MS Office to convert the document to PDF
Baidu Library solution (3) -- use JCom to call MS Office or Acrobat API to convert the document to PDF
Similar to Baidu Library solution (4) -- use JODConverter to call OpenOffice.org to convert the document to PDF
Baidu L
Analysis on axios's inability to use Vue. use (), axiosvue. use
Preface
I have encountered some problems in using axios recently. I feel it is necessary to share with you the basic knowledge about axios. For details, refer to this article: how to get started with axios, I won't talk much about it below. Let's take a look at the detailed introduction.
Problem
I be
Teach you how to use start uml to draw Use Case Diagrams and uml use cases
I have recently prepared to study volley's source code, but I have read some blogs on the Internet. They all work with the diagram. This looks more intuitive and the analysis logic is also good, what kind of diagrams can clearly analyze the relationships between various types and how to ex
The STS and Virgo environments have been configured above, and the Virgo server can be successfully run. Next we will use STS to build several projects.
We simulate an example of registration. In our actual case, data is sometimes written to the database, written to a file, or written to the memory, which is convenient for different operations. This example may not completely explain the problem, but it is enough to explain how to build a project th
Next we will create a web project. For simplicity, We will directly use the template in Virgo to create a new project. The control layer uses spring MVC 3.Create a WEB Project
Open STS and create a project. Select sprinng template project.
Figure: Create a spring template project
Select spring MVC Project
Figure: Template Selection
Enter the project name and package name.
Figure: Enter the project name and package name
Click Finish. You m
First, JS three ways to use
1, HTML tag embedded JS (do not promote the use of. )2, the HTML page directly using JS:3, reference external JS file:
Ii. three ways to use CSS
1, inline style sheet: Directly in the HTML start tag using style= "" Way reference;Features: The CSS code and HTML code is completely melted together, do
Do I have to use Tomcat to use Jenkins? Can I use only nginx? Used to deploy the php project. Do I have to use Tomcat to use Jenkins? Can I use only nginx? Used to deploy the php project.
Reply content:
Do I have to
How to use the modal pop-up window (basically used) in Yii2, yii2 uses the modal pop-up window. In Yii2, how to use modal pop-up windows (basically used), yii2 uses modal pop-up windows Modal, that is, modal windows. In other words, it is pop-up windows. Is a js plug-in for bootstrap, and the use effect is also very good. How to
Directory
Baidu Library solution (I)-Overall Thinking
Baidu Library solution (2) -- use Jacob to call MS Office to convert the document to PDF
Baidu Library solution (3) -- use JCom to call MS Office or Acrobat API to convert the document to PDF
Similar to Baidu Library solution (4) -- use JODConverter to call OpenOffice.org to convert the document to PDF
Baidu L
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.