(对我来说)很奇怪,下面的代码取决于/* Build binns */
%let var_list = MSRP Invoice;
%macro group_var_in_bins(source_table);
data WITH_BINNS;
set &source_table.;
run;
%let loop_count = %sysfunc(countw(&var_list));
%do i=1 %to &loop_count.;
* list of variables to use;
%let variable = %scan(&var_list, &i);
%let rank_column = &variable._bins_rank;
proc rank data=WITH_BINNS out=WITH_BINNS groups=10 ties=low;
var &variable.;
ranks &rank_column.;
run;
* sort the table by this variable;
proc sort data=WITH_BINNS out=WITH_BINNS;
by &variable.;
run;
* Build start and end observation of particular bin;
data WITH_BINNS;
set WITH_BINNS;
by &rank_column.;
*this is just to check if first.&rank_column works;
first_&rank_column. = first.&rank_column.;
last_&rank_column. = last.&rank_column.;
%if first.&rank_column. = 1 %then %do;
/* here %if first.&rank_column. %then %do erros so something is wrong with argument statement*/
Start_bin = &variable.;
%end;
%else %do;
Start_bin = .;
%end;
%if last.&rank_column. = 1 %then %do;
End_bin = &variable.;
%end;
%else %do;
End_bin = .;
%end;
run;
%end;
* some more code which amends WITH_BINNS table;
%mend group_var_in_bins;
%group_var_in_bins(sashelp.cars);
参数,从根本上改变了y轴。
accuracy = _
如果我以三种不同的方式改变library(tidyverse)
mtcars %>%
count(cyl) %>%
mutate(prop = n / sum(n)) %>%
ggplot(aes(x = cyl, y = prop)) +
geom_point() +
scale_y_continuous(labels = scales::percent_format(accuracy = 5))
,例如accuracy =
,accuracy = 5
和accuracy = 6
,我将得到以下三个图。请注意,y轴遍布整个地图。在最坏的情况下,它会两次绘制accuracy = 10
?显然应该是40%
。
我怀疑这是有数学原因的,我看不到,而且可以。那是什么这类行为是否应该有R控制台警告?