R:如何在grid.table中使用等宽(固定宽度)字体?

时间:2018-11-02 10:05:15

标签: r gridextra monospace

我想以等距(固定宽度)字体显示grid.table。

该如何指定?是要使用的任何特定字体还是其他参数?

谢谢

1 个答案:

答案 0 :(得分:2)

with from_thru as (
                      select
                        min (checktime)::date as from_date, 
                        max (checktime)::date as thru_date
                      from attendance_FHLHR
                    ),
                    users as (
                      select distinct userid, name, emp_id from attendance_FHLHR
                    )
                    select
                      gs.date::date, u.userid, u.name, to_char(gs.date::date, 'day') days,
                      min (a.checktime) as TimeIn,
                      max (a.checktime) as TimeOut,
                      extract (epoch from max (a.checktime) - min (a.checktime))/3600 as Hours,
                      case
                    when uso.off_days = 'monday' and min (a.checktime) is null  then 'Off Day'
                    when uso.off_days = 'tuesday' and min (a.checktime) is null  then 'Off Day'
                    when uso.off_days = 'wednesday' and min (a.checktime) is null  then 'Off Day'
                    when uso.off_days = 'wednesday' and min (a.checktime) is null  then 'Off Day'
                    when uso.off_days = 'thursday' and min (a.checktime) is null  then 'Off Day'
                    when uso.off_days = 'friday' and min (a.checktime) is null  then 'Off Day'
                    when uso.off_days = 'saturday' and min (a.checktime) is null  then 'Off Day'
                    when uso.off_days = 'sunday' and min (a.checktime) is null  then 'Off Day'
                        when   max(a.checktime) is null  then 'ABsent'
                        when count (1) = 1 then 'Half Day' 
                        else 'Present'
                      end as status
                    from
                      from_thru
                      cross join generate_series (from_date, thru_date, interval '1 day') gs (date)
                      cross join users u
                      left join attendance_FHLHR a on
                        a.checktime::date = gs.date and
                        a.userid = u.userid
                       left join users_staffuser us on u.emp_id::varchar = us.emp_id 
                       left join users_staffuseroffdays uso on uso.staff_user_id = us.id
                      -- and uso.off_days = to_char(gs.date::date, 'day')
                    and us.emp_id is not null
                    and uso.off_days = trim(to_char(gs.date::date, 'day'))
                    group by
                      gs.date, u.userid, u.name, uso.off_days
                    order by u.name ASC """)

iris

这将使用您的系统等宽字体,在我的情况下为Cousine。随意更改它。