如何检测“删除线"? R中xlsx文件的样式 [英] How to detect "strikethrough" style from xlsx file in R

查看:103
本文介绍了如何检测“删除线"? R中xlsx文件的样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在R中导入excel文件时,我必须检查包含"删除线"格式的数据

I have to check the data which contain "strikethrough" format when importing excel file in R

我们有什么方法可以检测到它们吗? 欢迎使用R和Python方法

Do we have any method to detect them ? Welcome for both R and Python approach

推荐答案

R解决方案

tidyxl-软件包可以帮助您...

R-solution

the tidyxl-package can help you...

示例test.xlsx,数据在第一张纸的A1:A4上.以下是一个excel屏幕截图:

example test.xlsx, with data on A1:A4 of the first sheet. Below is an excel-screenshot:

library(tidyxl)

formats <- xlsx_formats( "temp.xlsx" )
cells <- xlsx_cells( "temp.xlsx" )

strike <- which( formats$local$font$strike )
cells[ cells$local_format_id %in% strike, 2 ]

# A tibble: 2 x 1
#   address
#   <chr>  
# 1 A2     
# 2 A4   

这篇关于如何检测“删除线"? R中xlsx文件的样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆