A Assignments
A.1 Assignment 1
첨부한 concUnitConv-test.R과 유사한 R script를 실행하였을 때, concUnitConv-test.Rout과 유사한 결과나 나오는 concUnitConv.R 파일을 작성하시오.
- 제출기한: 2017-05-10 18:00
- 제출방법: R scirpt와 output을 k@acr.kr, shan@acp.kr, sec@acp.kr 로 제출
A.1.1 concUnitConv-test.R
source("D:/G/Desk/R/concUnitConv.R")
concUnitConv() # Wrong input
concUnitConv("kg/L", "g/L") # Wrong input
concUnitConv("g/kL", "g/L") # Wrong input
concUnitConv("mg/L", "ug/mL")
Theoph$conc * concUnitConv("mg/L", "ug/L")
Theoph$conc * concUnitConv("mg/L", "mg/mL")
Theoph$conc * concUnitConv("mg/L", "mmol/L") # Wrong input
Theoph$conc * concUnitConv("mg/L", "mmol/L", MW=-100) # Wrong input
Theoph$conc * concUnitConv("mg/L", "mM", MW=180.164) # Wrong input
Theoph$conc * concUnitConv("mg/L", "mmol/L", MW=180.164)
Theoph$mM = Theoph$conc * concUnitConv("mg/L", "mmol/L", MW=180.164)
Theoph$mM * concUnitConv("mmol/L", "ug/L", MW=180.164)
Theoph$mM * concUnitConv("mmol/L", "ug/mL", MW=180.164)
A.1.2 concUnitConv-test.Rout
> source("D:/G/Desk/R/concUnitConv.R")
>
> concUnitConv() # Wrong input
Error in concUnitConv() : Source concentration unit is not valid.
> concUnitConv("kg/L", "g/L") # Wrong input
Error in concUnitConv("kg/L", "g/L") : Source amount is not supported.
> concUnitConv("g/kL", "g/L") # Wrong input
Error in concUnitConv("g/kL", "g/L") : Volume unit is not supported.
>
> concUnitConv("mg/L", "ug/mL")
1
> Theoph$conc * concUnitConv("mg/L", "ug/L")
[1] 740 2840 6570 10500 9660 8580 8360 7470 6890 5940 3280 0 1720 7910 8310 8330 6850 6080 5400 4550 3010 900 0 4400 6900 8200 7800
[28] 7500 6200 5300 4900 3700 1050 0 1890 4600 8600 8380 7540 6880 5780 5330 4190 1150 0 2020 5630 11400 9330 8740 7560 7090 5900 4370
[55] 1570 0 1290 3080 6440 6320 5530 4940 4020 3460 2780 920 150 850 2350 5020 6580 7090 6660 5250 4390 3530 1150 0 3050 3050 7310
[82] 7560 6590 5880 4730 4570 3000 1250 0 7370 9030 7140 6330 5660 5670 4240 4110 3160 1120 240 2890 5220 6410 7830 10210 9180 8020 7140
[109] 5680 2420 0 4860 7240 8000 6810 5870 5220 4450 3620 2690 860 0 1250 3960 7820 9720 9750 8570 6590 6110 4570 1170
> Theoph$conc * concUnitConv("mg/L", "mg/mL")
[1] 0.00074 0.00284 0.00657 0.01050 0.00966 0.00858 0.00836 0.00747 0.00689 0.00594 0.00328 0.00000 0.00172 0.00791 0.00831 0.00833 0.00685 0.00608 0.00540 0.00455
[21] 0.00301 0.00090 0.00000 0.00440 0.00690 0.00820 0.00780 0.00750 0.00620 0.00530 0.00490 0.00370 0.00105 0.00000 0.00189 0.00460 0.00860 0.00838 0.00754 0.00688
[41] 0.00578 0.00533 0.00419 0.00115 0.00000 0.00202 0.00563 0.01140 0.00933 0.00874 0.00756 0.00709 0.00590 0.00437 0.00157 0.00000 0.00129 0.00308 0.00644 0.00632
[61] 0.00553 0.00494 0.00402 0.00346 0.00278 0.00092 0.00015 0.00085 0.00235 0.00502 0.00658 0.00709 0.00666 0.00525 0.00439 0.00353 0.00115 0.00000 0.00305 0.00305
[81] 0.00731 0.00756 0.00659 0.00588 0.00473 0.00457 0.00300 0.00125 0.00000 0.00737 0.00903 0.00714 0.00633 0.00566 0.00567 0.00424 0.00411 0.00316 0.00112 0.00024
[101] 0.00289 0.00522 0.00641 0.00783 0.01021 0.00918 0.00802 0.00714 0.00568 0.00242 0.00000 0.00486 0.00724 0.00800 0.00681 0.00587 0.00522 0.00445 0.00362 0.00269
[121] 0.00086 0.00000 0.00125 0.00396 0.00782 0.00972 0.00975 0.00857 0.00659 0.00611 0.00457 0.00117
> Theoph$conc * concUnitConv("mg/L", "mmol/L") # Wrong input
Error in concUnitConv("mg/L", "mmol/L") :
Positive molecular weight should be given.
> Theoph$conc * concUnitConv("mg/L", "mmol/L", MW=-100) # Wrong input
Error in concUnitConv("mg/L", "mmol/L", MW = -100) :
Positive molecular weight should be given.
> Theoph$conc * concUnitConv("mg/L", "mM", MW=180.164) # Wrong input
Error in concUnitConv("mg/L", "mM", MW = 180.164) :
Target concentration unit is not valid.
> Theoph$conc * concUnitConv("mg/L", "mmol/L", MW=180.164)
[1] 0.0041073688 0.0157634156 0.0364667747 0.0582802336 0.0536178149 0.0476232766 0.0464021669 0.0414622233 0.0382429342 0.0329699607 0.0182056349 0.0000000000
[13] 0.0095468573 0.0439044426 0.0461246420 0.0462356520 0.0380209143 0.0337470305 0.0299726915 0.0252547679 0.0167070003 0.0049954486 0.0000000000 0.0244221931
[25] 0.0382984392 0.0455140872 0.0432938878 0.0416287383 0.0344130903 0.0294176417 0.0271974423 0.0205368442 0.0058280234 0.0000000000 0.0104904420 0.0255322928
[37] 0.0477342865 0.0465131769 0.0418507582 0.0381874292 0.0320818810 0.0295841567 0.0232565884 0.0063830732 0.0000000000 0.0112120068 0.0312493062 0.0632756822
[49] 0.0517861504 0.0485113563 0.0419617682 0.0393530339 0.0327479408 0.0242556782 0.0087142825 0.0000000000 0.0071601430 0.0170955352 0.0357452099 0.0350791501
[61] 0.0306942563 0.0274194623 0.0223130037 0.0192047246 0.0154303856 0.0051064586 0.0008325748 0.0047179237 0.0130436713 0.0278635021 0.0365222797 0.0393530339
[73] 0.0369663196 0.0291401168 0.0243666881 0.0195932595 0.0063830732 0.0000000000 0.0169290202 0.0169290202 0.0405741436 0.0419617682 0.0365777847 0.0326369308
[85] 0.0262538576 0.0253657778 0.0166514953 0.0069381230 0.0000000000 0.0409071735 0.0501210009 0.0396305588 0.0351346551 0.0314158211 0.0314713261 0.0235341134
[97] 0.0228125486 0.0175395751 0.0062165582 0.0013321196 0.0160409405 0.0289736018 0.0355786950 0.0434604027 0.0566705890 0.0509535756 0.0445149974 0.0396305588
[109] 0.0315268311 0.0134322062 0.0000000000 0.0269754224 0.0401856087 0.0444039875 0.0377988943 0.0325814258 0.0289736018 0.0246997180 0.0200928043 0.0149308408
[121] 0.0047734287 0.0000000000 0.0069381230 0.0219799738 0.0434048978 0.0539508448 0.0541173597 0.0475677716 0.0365777847 0.0339135454 0.0253657778 0.0064940832
> Theoph$mM = Theoph$conc * concUnitConv("mg/L", "mmol/L", MW=180.164)
> Theoph$mM * concUnitConv("mmol/L", "ug/L", MW=180.164)
[1] 740 2840 6570 10500 9660 8580 8360 7470 6890 5940 3280 0 1720 7910 8310 8330 6850 6080 5400 4550 3010 900 0 4400 6900 8200 7800
[28] 7500 6200 5300 4900 3700 1050 0 1890 4600 8600 8380 7540 6880 5780 5330 4190 1150 0 2020 5630 11400 9330 8740 7560 7090 5900 4370
[55] 1570 0 1290 3080 6440 6320 5530 4940 4020 3460 2780 920 150 850 2350 5020 6580 7090 6660 5250 4390 3530 1150 0 3050 3050 7310
[82] 7560 6590 5880 4730 4570 3000 1250 0 7370 9030 7140 6330 5660 5670 4240 4110 3160 1120 240 2890 5220 6410 7830 10210 9180 8020 7140
[109] 5680 2420 0 4860 7240 8000 6810 5870 5220 4450 3620 2690 860 0 1250 3960 7820 9720 9750 8570 6590 6110 4570 1170
> Theoph$mM * concUnitConv("mmol/L", "ug/mL", MW=180.164)
[1] 0.74 2.84 6.57 10.50 9.66 8.58 8.36 7.47 6.89 5.94 3.28 0.00 1.72 7.91 8.31 8.33 6.85 6.08 5.40 4.55 3.01 0.90 0.00 4.40 6.90 8.20 7.80
[28] 7.50 6.20 5.30 4.90 3.70 1.05 0.00 1.89 4.60 8.60 8.38 7.54 6.88 5.78 5.33 4.19 1.15 0.00 2.02 5.63 11.40 9.33 8.74 7.56 7.09 5.90 4.37
[55] 1.57 0.00 1.29 3.08 6.44 6.32 5.53 4.94 4.02 3.46 2.78 0.92 0.15 0.85 2.35 5.02 6.58 7.09 6.66 5.25 4.39 3.53 1.15 0.00 3.05 3.05 7.31
[82] 7.56 6.59 5.88 4.73 4.57 3.00 1.25 0.00 7.37 9.03 7.14 6.33 5.66 5.67 4.24 4.11 3.16 1.12 0.24 2.89 5.22 6.41 7.83 10.21 9.18 8.02 7.14
[109] 5.68 2.42 0.00 4.86 7.24 8.00 6.81 5.87 5.22 4.45 3.62 2.69 0.86 0.00 1.25 3.96 7.82 9.72 9.75 8.57 6.59 6.11 4.57 1.17
>
>
A.2 Assignment 2
자신이 직접 R package를 만드는 것이 과제 2입니다.
- 제출기한: 2017-06-21 18:00
- 제출방법: R package를 shan@acp.kr과 ksbae@acp.kr 메일로 보내십시오. CRAN에 올리면 더 좋습니다.