Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the table parsing of some RTF (SAS-generated?) #22

Closed
kota7 opened this issue Aug 9, 2023 · 1 comment
Closed

Fix the table parsing of some RTF (SAS-generated?) #22

kota7 opened this issue Aug 9, 2023 · 1 comment

Comments

@kota7
Copy link
Owner

kota7 commented Aug 9, 2023

The table in this document (the same as provided in #20) is not precisely parsed.

The table should have five columns 姓名, 性别, 年龄, 身高(英寸), 体重(磅).

read_rtf("tests/testthat/chinese-sas.rtf")
 [1] "SAS "                       "系统"                       ""                           ""                          
 [5] "*| 姓名"                    "*|  | "                     "*| 性别"                    "*|  | "                    
 [9] "*| 年龄"                    "*|  | "                     "*| 身高(英寸)"            "*|  | "                    
[13] "*| 体重(磅)"              "*|  | "                     "*| 阿尔弗雷德"              "*|  | "                    
[17] "*| 男"                      "*|  | 14 | 69 | 112.5 | "   "*| 爱丽丝"                  "*|  | "                    
[21] "*| 女"                      "*|  | 13 | 56.5 | 84 | "    "*| 芭芭拉"                  "*|  | "                    
[25] "*| 女"                      "*|  | 13 | 65.3 | 98 | "    "*| 凯露"                    "*|  | "                    
[29] "*| 女"                      "*|  | 14 | 62.8 | 102.5 | " "*| 亨利"                    "*|  | "                    
[33] "*| 男"                      "*|  | 14 | 63.5 | 102.5 | " "*| 詹姆斯"                  "*|  | "                    
[37] "*| 男"                      "*|  | 12 | 57.3 | 83 | "    "*| 简"                      "*|  | "                    
[41] "*| 女"                      "*|  | 12 | 59.8 | 84.5 | "  "*| 雅妮特"                  "*|  | "                    
[45] "*| 女"                      "*|  | 15 | 62.5 | 112.5 | " "*| 杰弗瑞"                  "*|  | "                    
[49] "*| 男"                      "*|  | 13 | 62.5 | 84 | "    "*| 约翰"                    "*|  | "                    
[53] "*| 男"                      "*|  | 12 | 59 | 99.5 | "    "*| 乔伊斯"                  "*|  | "                    
[57] "*| 女"                      "*|  | 11 | 51.3 | 50.5 | "  "*| 茱迪"                    "*|  | "                    
[61] "*| 女"                      "*|  | 14 | 64.3 | 90 | "    "*| 罗伊斯"                  "*|  | "                    
[65] "*| 女"                      "*|  | 12 | 56.3 | 77 | "    "*| 玛丽"                    "*|  | "                    
[69] "*| 女"                      "*|  | 15 | 66.5 | 112 | "   "*| 菲利普"                  "*|  | "                    
[73] "*| 男"                      "*|  | 16 | 72 | 150 | "     "*| 罗伯特"                  "*|  | "                    
[77] "*| 男"                      "*|  | 12 | 64.8 | 128 | "   "*| 罗纳德"                  "*|  | "                    
[81] "*| 男"                      "*|  | 15 | 67 | 133 | "     "*| 托马斯"                  "*|  | "                    
[85] "*| 男"                      "*|  | 11 | 57.5 | 85 | "    "*| 威廉"                    "*|  | "                    
[89] "*| 男"                      "*|  | 15 | 66.5 | 112 | "   ""                           ""           

test_cn.zip

kota7 added a commit that referenced this issue Aug 9, 2023
kota7 added a commit that referenced this issue Aug 9, 2023
@kota7
Copy link
Owner Author

kota7 commented Aug 9, 2023

Fixed by #23.

read_rtf("tests/testthat/chinese-sas.rtf")
 [1] "SAS 系统"                                             ""                                                    
 [3] "*| 姓名 | 性别 | 年龄 | 身高(英寸) | 体重(磅) | " "*| 阿尔弗雷德 | 男 | 14 | 69 | 112.5 | "             
 [5] "*| 爱丽丝 | 女 | 13 | 56.5 | 84 | "                   "*| 芭芭拉 | 女 | 13 | 65.3 | 98 | "                  
 [7] "*| 凯露 | 女 | 14 | 62.8 | 102.5 | "                  "*| 亨利 | 男 | 14 | 63.5 | 102.5 | "                 
 [9] "*| 詹姆斯 | 男 | 12 | 57.3 | 83 | "                   "*| 简 | 女 | 12 | 59.8 | 84.5 | "                    
[11] "*| 雅妮特 | 女 | 15 | 62.5 | 112.5 | "                "*| 杰弗瑞 | 男 | 13 | 62.5 | 84 | "                  
[13] "*| 约翰 | 男 | 12 | 59 | 99.5 | "                     "*| 乔伊斯 | 女 | 11 | 51.3 | 50.5 | "                
[15] "*| 茱迪 | 女 | 14 | 64.3 | 90 | "                     "*| 罗伊斯 | 女 | 12 | 56.3 | 77 | "                  
[17] "*| 玛丽 | 女 | 15 | 66.5 | 112 | "                    "*| 菲利普 | 男 | 16 | 72 | 150 | "                   
[19] "*| 罗伯特 | 男 | 12 | 64.8 | 128 | "                  "*| 罗纳德 | 男 | 15 | 67 | 133 | "                   
[21] "*| 托马斯 | 男 | 11 | 57.5 | 85 | "                   "*| 威廉 | 男 | 15 | 66.5 | 112 | "                   
[23] ""                                                     ""    

@kota7 kota7 closed this as completed Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant