multiple knitr kables by group - knitr

for a given dataset, I want to print group-wise kables with group names as caption in an rmarkdown.
say this is my_document:
library(magrittr)
library(dplyr)
library(knitr)
iris %>%
group_by(Species) %>%
slice(1:10) %>%
do(kables = kable(., caption = .$Species[1])) %$%
kables %>%
lapply(print)
i call rmarkdown::render("my_document.R") to generate the markdown output.
the problem now is that my kables appear in comments, but not as rendered kables:
## Table: setosa
##
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## ------------- ------------ ------------- ------------ --------
## 5.1 3.5 1.4 0.2 setosa
## 4.9 3.0 1.4 0.2 setosa
## 4.7 3.2 1.3 0.2 setosa
## 4.6 3.1 1.5 0.2 setosa
## 5.0 3.6 1.4 0.2 setosa
## 5.4 3.9 1.7 0.4 setosa
## 4.6 3.4 1.4 0.3 setosa
## 5.0 3.4 1.5 0.2 setosa
## 4.4 2.9 1.4 0.2 setosa
## 4.9 3.1 1.5 0.1 setosa
##
##
## Table: versicolor
##
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## ------------- ------------ ------------- ------------ -----------
## 7.0 3.2 4.7 1.4 versicolor
## 6.4 3.2 4.5 1.5 versicolor
## 6.9 3.1 4.9 1.5 versicolor
## 5.5 2.3 4.0 1.3 versicolor
## 6.5 2.8 4.6 1.5 versicolor
## 5.7 2.8 4.5 1.3 versicolor
## 6.3 3.3 4.7 1.6 versicolor
## 4.9 2.4 3.3 1.0 versicolor
## 6.6 2.9 4.6 1.3 versicolor
## 5.2 2.7 3.9 1.4 versicolor
##
##
## Table: virginica
##
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## ------------- ------------ ------------- ------------ ----------
## 6.3 3.3 6.0 2.5 virginica
## 5.8 2.7 5.1 1.9 virginica
## 7.1 3.0 5.9 2.1 virginica
## 6.3 2.9 5.6 1.8 virginica
## 6.5 3.0 5.8 2.2 virginica
## 7.6 3.0 6.6 2.1 virginica
## 4.9 2.5 4.5 1.7 virginica
## 7.3 2.9 6.3 1.8 virginica
## 6.7 2.5 5.8 1.8 virginica
## 7.2 3.6 6.1 2.5 virginica
so how do i get rendered kables by group in my markdown document?

You need to specify results="asis" in the chunk options. Have a read of http://yihui.name/knitr/options/#chunk_options as you may also want to use echo=FALSE to hide your code and/or message=FALSE to hide any messages that arise from loading packages.
E.g., if I don't specify message=FALSE I get:
Attaching package: ‘dplyr’
The following object is masked from ‘package:stats’:
filter
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
in the final output after loading dplyr.

Related

Flutter Gradle generating signed bundle

I have this error :
A Generating signed Bundle requires you to update the Android Gradle plugin to version 3.2.0 or higher.
But i have enter image description here
And :
Android Studio Electric Eel | 2022.1.1
Build #AI-221.6008.13.2211.9477386, built on January 11, 2023
Runtime version: 11.0.15+0-b2043.56-8887301 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 12
Registry:
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false
Non-Bundled Plugins:
Dart (221.6096)
io.flutter (71.2.4)
Some Idea ?
i'm on win 11

How to find the peakpoint in z direction after fitting a 3D surface in matlab

I have fitted the 3D surface and just want to know how to find the max value of z direction after fitting, not the max value that I gave, it would be just noise. The code can be seen as followed.
x=[0 6.8 18.6 21.3 3 12.5 13 20.7 17.7 20.8 1.1 6.3 13.2 3.4 3.5 18.9 11.3 13.1];
y=[1.7 1.1 0.8 1.2 3.1 3 3.1 4.2 4.1 5.8 6.4 5.8 7.4 5.3 5.9 9.7 7.6 10.7];
z=[0.59 0.58 0.53 1.25 1.26 0.2 0.18 0.14 0.64 0. 1.06 0.73 0.15 0.15 0.1 0.08 0.17 0.8];
scatter3(x,y,z)
x=x';
y=y';
z=z';
hold on
Z=[ones(length(x),1),x,y,x.^2,x.*y,y.^2,x.^3,x.^2.*y,x.*y.^2,y.^3];
A=Z\z;
X=min(x)-1:0.2:max(x)+1;
Y=min(y)-1:(max(y)-min(y)+2)/(length(X)+1):max(y)+1;
[x y]=meshgrid(X,Y);
z=A(1)+A(2)*x+A(3)*y+A(4)*x.^2+A(5)*x.*y+A(6)*y.^2+A(7)*x.^3+A(8)*x.^2.*y+A(9)*x.*y.^2+A(10)*y.^3;
mesh(x,y,z)

Entering a group of numbers sequentially in specific positions in a matrix using Matlab

I have a matrix and I want to enter a group of numbers in this matrix sequentially. Here is an example:
Suppose that:
x = [1 2 3 4 5 6 7] % Group of numbers
A = % The matrix
1.1 2.2 3.1 4.1 5.3 1.2 1.3
3.1 4.2 1.1 7.4 5.6 2.2 1.3
1.4 5.2 4.3 2.2 4.3 3.2 1.3
1.6 3.2 6.3 2.1 2.6 7.2 1.3
6.1 1.3 9.4 4.2 3.3 1.2 1.3
2.5 4.2 3.2 5.1 6.7 1.2 1.3
What I am trying to do is to find a way using loops to enter the group of numbers stored in x to be in the following way:
A = % The matrix
1.1 2.2 3.1 4.1 5.3 1.2 1.3 1.1 2.2 3.1 4.1 5.3 1.2 1.3 1.1 2.2 3.1 4.1 5.3 1.2 1.3
1.0 2.0 3.0 4.0 5.0 6.0 7.0 3.1 4.2 1.1 7.4 5.6 2.2 1.3 3.1 4.2 1.1 7.4 5.6 2.2 1.3
1.4 5.2 4.3 2.2 4.3 3.2 1.3 1.0 2.0 3.0 4.0 5.0 6.0 7.0 1.4 5.2 4.3 2.2 4.3 3.2 1.3
1.6 3.2 6.3 2.1 2.6 7.2 1.3 1.6 3.2 6.3 2.1 2.6 7.2 1.3 1.0 2.0 3.0 4.0 5.0 6.0 7.0
6.1 1.3 9.4 4.2 3.3 1.2 1.3 6.1 1.3 9.4 4.2 3.3 1.2 1.3 6.1 1.3 9.4 4.2 3.3 1.2 1.3
2.5 4.2 3.2 5.1 6.7 1.2 1.3 2.5 4.2 3.2 5.1 6.7 1.2 1.3 2.5 4.2 3.2 5.1 6.7 1.2 1.3
As you can notice the group of numbers (from 1.0 to 7.0) moves down (row by row) till the end of the matrix. At each move the matrix dimension increases as well. I believe that I should define the matrix dimension first.
To do so, I found that multiplying the matrix columns by the number of rows
I will get the new matrix dimension which in this case will be 7 (rows) x 49 (columns).
I need to know how to create such a matrix automatically using for loop or any other possible way.
Thanks in advance.
Use repmat in order to concat 3 copies of your matrix horizontally.
Use the Matlab's assignment syntax: A(row,col:col+length(x)-1) in order to copy x into the desired row and col.
Code example:
outA = repmat(A,1,3); %replicate A
outA(2,1:length(x)) = x; %inserts x into the beginning of the 2nd row
outA(4,size(outA,2)-length(x)+1:end) = x; %inserts x into the end of the 4th row
Results:
outA =
1.1 2.2 3.1 4.1 5.3 1.2 1.3 1.1 2.2 3.1 4.1 5.3 1.2 1.3 1.1 2.2 3.1 4.1 5.3 1.2 1.3
1.0 2.0 3.0 4.0 5.0 6.0 7.0 3.1 4.2 1.1 7.4 5.6 2.2 1.3 3.1 4.2 1.1 7.4 5.6 2.2 1.3
1.4 5.2 4.3 2.2 4.3 3.2 1.3 1.4 5.2 4.3 2.2 4.3 3.2 1.3 1.4 5.2 4.3 2.2 4.3 3.2 1.3
1.6 3.2 6.3 2.1 2.6 7.2 1.3 1.6 3.2 6.3 2.1 2.6 7.2 1.3 1.0 2.0 3.0 4.0 5.0 6.0 7.0
6.1 1.3 9.4 4.2 3.3 1.2 1.3 6.1 1.3 9.4 4.2 3.3 1.2 1.3 6.1 1.3 9.4 4.2 3.3 1.2 1.3
2.5 4.2 3.2 5.1 6.7 1.2 1.3 2.5 4.2 3.2 5.1 6.7 1.2 1.3 2.5 4.2 3.2 5.1 6.7 1.2 1.3

MATLAB compiler not working - build fail

I am trying to make my final.m file standalone, but MATLAB will not proceed with the ccompilation and it gets stuck every time:
ant:
<ant>
<mkdir dir="C:\Users\TG\Desktop\updated\final\for_redistribution" />
<mkdir dir="C:\Users\TG\Desktop\updated\final\for_testing" />
</ant>
mcc -C -o final -W WinMain:final -T link:exe -d C:\Users\TG\Desktop\updated\final\for_testing -v C:\Users\TG\Desktop\updated\final.m
Test checkout of feature 'Compiler' failed.
mcc failed.
When I type ver, I get this:
MATLAB Version: 8.3.0.532 (R2014a)
Operating System: Microsoft Windows 7 Ultimate Version 6.1 (Build 7600)
Java Version: Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) Client VM mixed mode
---------------------------------------------------------------------------------------------
MATLAB Version 8.3 (R2014a)
Simulink Version 8.3 (R2014a)
Aerospace Blockset Version 3.13 (R2014a)
Aerospace Toolbox Version 2.13 (R2014a)
Bioinformatics Toolbox Version 4.4 (R2014a)
Communications System Toolbox Version 5.6 (R2014a)
Computer Vision System Toolbox Version 6.0 (R2014a)
Control System Toolbox Version 9.7 (R2014a)
Curve Fitting Toolbox Version 3.4.1 (R2014a)
DO Qualification Kit Version 2.3 (R2014a)
DSP System Toolbox Version 8.6 (R2014a)
Data Acquisition Toolbox Version 3.5 (R2014a)
Database Toolbox Version 5.1 (R2014a)
Datafeed Toolbox Version 4.7 (R2014a)
Econometrics Toolbox Version 3.0 (R2014a)
Embedded Coder Version 6.6 (R2014a)
Filter Design HDL Coder Version 2.9.5 (R2014a)
Financial Instruments Toolbox Version 1.3 (R2014a)
Financial Toolbox Version 5.3 (R2014a)
Fixed-Point Designer Version 4.2 (R2014a)
Fuzzy Logic Toolbox Version 2.2.19 (R2014a)
Gauges Blockset Version 2.0.9 (R2014a)
Global Optimization Toolbox Version 3.2.5 (R2014a)
HDL Coder Version 3.4 (R2014a)
HDL Verifier Version 4.4 (R2014a)
IEC Certification Kit Version 3.3 (R2014a)
Image Acquisition Toolbox Version 4.7 (R2014a)
Image Processing Toolbox Version 9.0 (R2014a)
Instrument Control Toolbox Version 3.5 (R2014a)
LTE System Toolbox Version 1.1 (R2014a)
MATLAB Builder EX Version 2.5 (R2014a)
MATLAB Builder JA Version 2.3.1 (R2014a)
MATLAB Builder NE Version 4.2.1 (R2014a)
MATLAB Coder Version 2.6 (R2014a)
MATLAB Compiler Version 5.1 (R2014a)
MATLAB Report Generator Version 3.16 (R2014a)
Mapping Toolbox Version 4.0.1 (R2014a)
Model Predictive Control Toolbox Version 4.2 (R2014a)
Model-Based Calibration Toolbox Version 4.7 (R2014a)
Neural Network Toolbox Version 8.2 (R2014a)
OPC Toolbox Version 3.3.1 (R2014a)
Optimization Toolbox Version 7.0 (R2014a)
Parallel Computing Toolbox Version 6.4 (R2014a)
Partial Differential Equation Toolbox Version 1.4 (R2014a)
Phased Array System Toolbox Version 2.2 (R2014a)
Polyspace Bug Finder Version 1.1 (R2014a)
Polyspace Code Prover Version 9.1 (R2014a)
RF Toolbox Version 2.14 (R2014a)
Real-Time Windows Target Version 4.4 (R2014a)
Robust Control Toolbox Version 5.1 (R2014a)
Signal Processing Toolbox Version 6.21 (R2014a)
SimBiology Version 5.0 (R2014a)
SimDriveline Version 2.6 (R2014a)
SimElectronics Version 2.5 (R2014a)
SimEvents Version 4.3.2 (R2014a)
SimHydraulics Version 1.14 (R2014a)
SimMechanics Version 4.4 (R2014a)
SimPowerSystems Version 6.1 (R2014a)
SimRF Version 4.2 (R2014a)
Simscape Version 3.11 (R2014a)
Simulink 3D Animation Version 7.1 (R2014a)
Simulink Code Inspector Version 2.1 (R2014a)
Simulink Coder Version 8.6 (R2014a)
Simulink Control Design Version 4.0 (R2014a)
Simulink Design Optimization Version 2.5 (R2014a)
Simulink Design Verifier Version 2.6 (R2014a)
Simulink PLC Coder Version 1.7 (R2014a)
Simulink Real-Time Version 6.0 (R2014a)
Simulink Report Generator Version 3.16 (R2014a)
Simulink Verification and Validation Version 3.7 (R2014a)
Spreadsheet Link EX Version 3.2.1 (R2014a)
Stateflow Version 8.3 (R2014a)
Statistics Toolbox Version 9.0 (R2014a)
Symbolic Math Toolbox Version 6.0 (R2014a)
System Identification Toolbox Version 9.0 (R2014a)
SystemTest Version 2.6.7 (R2014a)
Trading Toolbox Version 2.1 (R2014a)
Vehicle Network Toolbox Version 2.2 (R2014a)
Wavelet Toolbox
Version 4.13 (R2014a)
tried to execute it in the windows cmd
C:\Users\TG>mcc
Error: Could not check out a Compiler license:
SIGN= keyword required but missing from the license certificate.
This is probably because the license is older than the application
You need to obtain a SIGN= version of this license from your vendor.
Feature: Compiler
Missing: SIGN1=
License path: C:\Users\TG\AppData\Roaming\MathWorks\MATLAB\R2014a_licenses;G:\M
ATLAB\R2014a\licenses\license.dat;G:\MATLAB\R2014a\licenses\license.lic;G:\MATLA
B\R2014a\licenses\license_TG-PC_271282_R2014a.lic;
FlexNet Licensing error:-114,582
For further information, refer to the FlexNet Licensing documentation,
available at "www.flexerasoftware.com"..

Unicode version supported by Java 6

Anyone know the answer? According to http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp, it's 4.0 for 5. Has it been upgraded in 6? Link to reference would be much appreciated as well.
According to the ICU (International Components for Unicode), Java 6 is Unicode 4
I needed to know the Unicode version supported by a particular Java version for several times, why not answer one of these questions to make it easier for the next time. So, a 7 YEARS LATER answer:
From Unicode Versions Supported in Java-History, last updated in 2012:
Java version Release date Unicode version
JDK 1.0 January 23, 1996 Unicode 1.1.5
JDK 1.1 February 19, 1997 Unicode 2.0
JDK 1.1.7 September 12, 1997 Unicode 2.1
J2SE 1.2 December 8, 1998 Unicode 2.1
J2SE 1.3 May 8, 2000 Unicode 2.1
J2SE 1.4 February 6, 2002 Unicode 3.0
J2SE 5.0 September 30, 2004 Unicode 4.0
Java SE 6 December 11, 2006 Unicode 4.0
Java SE 7 July 28, 2011 Unicode 6.0
JEPs
The OpenJDK project publishes a JEP document for each version incrementing Unicode.
JEP 128: Unicode BCP 47 Locale Matching in Java SE 8.
JEP 133 adds support for Unicode 6.2 in Java 8.See also: Internationalization Enhancements in JDK 8.
JEP 227 for adding Unicode 7 support in Java SE 9.JEP 267 adds support for Unicode 8 in Java SE 9 as well.
JEP 314: Additional Unicode Language-Tag Extensions in Java SE 10. (Tags for currency type, the first day of the week, region override and time zone will now be supported.)
JEP 327 adds Unicode 10 support in Java SE 11.
Release Note: Support for Unicode 11 explains support for Unicode 11 in Java 12.
Listing.
Java version Release date Unicode version
Java SE 8 2014-03 Unicode 6.2.0
Java SE 9 2017-09 Unicode 7.0
& 8.0
Java SE 11 2018-09 Unicode 10.0
Java SE 12 2019-03 Unicode 11.0
Java SE 13.0.2 Unicode 12.1
See Java 13.0.2 Release Notes.
Unicode 5.1 is on the planned features list for Java in JDK 7. In Java 6 it remains Unicode 4.0.
IDNA standard, see here.