Sheet1 XpositionYpositionZpositionTime StepID 142.76998.647101.811001110 169.472203.963103.32611002112 261.373191.473106.18111003113 102.487259.923107.06611004114...

1 answer below »
Make the following coding shorter from 109 lines to 60 lines or less by using for loop. Do not copy and paste the same codings in one line. Use for loop from the beginning to the end.


Sheet1 XpositionYpositionZpositionTime StepID 142.76998.647101.811001110 169.472203.963103.32611002112 261.373191.473106.18111003113 102.487259.923107.06611004114 43.1146307.178113.75511005119 446.81435.1064103.25411006123 622.728236.292102.82911007125 330.804317.066101.02411008126 405.472209.677106.27211009130 522.96225.651104.83911010131 516.545313.613106.96811011133 820.223107.746102.27911012152 947.83124.849102.51511013155 846.538247.822103.58311014157 729.786267.726105.87811015162 761.28238.089108.75811016166 807.053217.442124.10111017170 118.724427.571110.90911018185 205.482533.752108.75311019187 129.492461.46112.1411020188 147.583516.718112.12311021189 159.428619.891117.32111022192 278.201629.596125.44111023195 422.281495.796103.62511024202 342.226534.414105.79311025205 534.033529.789109.07311026207 894.713515.54592.255911027212 745.204623.13894.720411028214 900.804389.645104.03711029218 759.974520.554107.0911030219 698.275541.254108.25711031221 745.356357.359113.45511032222 269.569777.331101.16411033229 86.5101645.935118.34211034237 155.756734.642127.41311035238 520.556716.88791.077211036239 460.665641.72194.010711037240 492.111653.42793.036311038241 349.116704.30793.726111039242 401.193773.5992.280611040244 522.242684.34699.254511041245 344.758638.968102.12711042247 441.098837.601102.95111043248 513.554858.238104.8311044250 399.839828.478111.59911045251 763.659805.12887.896511046257 845.602837.23288.540611047259 741.285657.861123.4211048267 977.265787.4391.655111049271 968.397670.641106.76111050273 16.7061292.295145.07511051300 757.636166.183134.15211052310 905.464193.947147.16911053315 214.589360.986138.65811054330 213.428623.051144.55511055331 7.70986364.949166.65111056334 648.408383.908139.35511057340 124.854655.693148.77311058352 476.199641.478156.9111059357 607.704419.64899.52651106014004 739.976417.792109.8381106114010 517.858155.815120.3311106214019 534.424426.964941107215501 526.425442.9581261107015524 546.626425.51795.25621107315537 528.644440.3641061107415549 517.695481.6311021107515570 199.19552.7451101106515605 372.502841.1151141106915627 2.8678383.09126.0621107615637 855.611662.0111301107715660 849.415654.2381221107815683 694.982476.902981106315706 569.288431.996981106715724 116.05103.41899.05261108015726 890.371723.4931261108315766 866.576725.312981108115789 866.289711.4251181108215790 927.655641.051941108415815 139.93297.720596.76432100114024 168.791206.63398.0882100214025 260.559190.922100.2052100314026 100.401261.272101.462100414027 44.1278305.558108.4142100514028 454.57125.914699.18692100614029 626.358238.29397.72762100714030 330.919318.35696.05992100814031 407.965207.041102.0392100914032 523.583224.52100.1362101014033 514.652308.713101.5592101114034 815.992107.39196.61442101214035 943.938128.10996.1682101314036 845.829246.05197.8132101414037 757.695235.783103.9052101614038 725.89267.797102.1552101514039 804.556216.957119.2572101714040 209.754531.897103.3022101914041 120.09427.514105.7762101814042 130.452459.549106.4922102014043 152.007517.787107.6592102114044 161.28617.755110.3952102214045 275.74626.934121.6112102314046 458.497635.76690.76972103714047 421.563494.36498.53182102414048 346.655638.61298.01872104214049 532.767528.321103.8782102614050 341.173534.047101.4672102514051 888.721515.4287.28742102714053 744.327619.77789.82042102814054 689.056462.41897.90712106314055 900.833389.923101.4222102914056 760.824517.753101.6242103014057 699.644537.262102.9992103114058 744.489356.923108.6432103214059 268.37776.75296.1072103314060 185.685789.18898.31122106414061 77.2644654.245112.4192103414062 157.921727.525123.7532103514063 519.137714.16386.20282103614064 396.035771.69886.93472104014065 498.166654.56188.67482103814066 356.553696.10190.97322103914067 527.185682.58494.98782104114068 435.98836.75498.30172104314069 511.47854.76998.76612104414070 398.322826.143105.8552104514071 762.365805.26382.48312104614072 837.553834.00183.40972104714073 741.03655.997117.1342104814075 982.059789.34885.81432104914076 967.854668.773101.092105014077 12.6094290.249141.3652105114078 755.142165.966128.7532105214079 905.05190.991142.0032105314080 214.483361.308133.5142105414081 215.19620.962138.7922105514082 11.1929363.416161.8432105614083 647.235381.914135.0822105714084 124.508653.872143.7952105814085 473.229638.953151.8092105914086 610.199425.01797.41642106014088 725.002423.10798.01732106114089 517.858156.803115.7122106214090 532.258426.091902107215502 527.863438.4551142107015525 550.9418.0395.52592107315538 527.426440.4531022107415550 519.744477.593982107515571 194.479552.771022106515606 369.157838.8111022106915628 1.76135383.09109.3362107615638 854.93660.0951182107715661 845.259654.1891062107815684 558.87434.401942106715725 118.546104.12196.35122108015727 863.3719.434982108115750 896.941718.8911222108315767 862.399709.0441142108215791 935.319642.794862108415816 140.08395.627392.73213100114092 170.516205.67194.16543100214093 102.54261.63894.84863100414094 260.105192.49896.60663100314095 41.7991306.452105.0163100514096 335.991313.29491.92323100814097 455.05521.241294.85063100614098 523.023224.23995.74393101014099 627.616240.22893.41123100714100 407.22206.70298.52243100914101 514.949309.2297.31623101114102 814.052106.89791.95713101214103 939.598137.57694.11563101314104 845.041249.25994.1483101414105 756.606233.12899.59293101614106 723.313267.40297.83653101514107 803.492215.008115.6883101714108 753.889166.837124.5113105214109 215.006526.62198.95293101914110 195.199564.02898.05273106514111 121.078424.466101.0583101814112 133.155457.772102.4883102014113 156.963546.737102.6983106614114 154.463516.145104.0313102114115 159.936619.083105.7843102214116 271.797627.76116.4983102314117 457.109635.92585.49173103714118 563.575429.36293.26063106714119 423.678493.75193.46313102414120 345.674637.16293.06013104214121 533.974527.21498.36783102614122 338.571533.96296.26573102514123 887.322514.53384.25263102714125 740.1621.63285.54143102814126 693.535461.96995.42213106314127 899.715387.58796.97853102914128 759.722515.81498.0823103014129 699.241537.52899.05883103114130 748.495353.631102.2353103214131 267.755777.23791.92063103314132 179.654792.89893.13363106414133 72.6034661.144107.3433103414134 161.188724.45120.7493103514135 496.185650.90182.01833103814136 362.873698.65883.46573103914137 520.061714.04881.56993103614138 397.323773.09582.34113104014139 529.264684.14888.75723104114140 431.867837.60994.46473104314141 510.271854.61894.65413104414142 397.64826.281101.6253104514143 760.982803.73278.09653104614144 838.211835.15878.91553104714145 741.893657.128113.1333104814147 982.059788.12181.89823104914148 968668.84296.54923105014149 12.5135289.966137.4083105114150 904.685190.661137.4943105314151 214.101360.379129.2943105414152 214.375621.212134.673105514153 8.11742363.196157.6533105614154 647.074382.579131.43105714155 124.101655.061138.6613105814156 472.906639.857147.1083105914157 612.695420.93694.39783106014159 727.497421.39794.5673106114160 512.867149.842116.5333106214161 530.301428.856903107215503 524.746441.621143107015526 550.732413.03994.28563107315539 529.36440.422983107415551 519.282480.511903107515572 366.768832.264983106915629 3.44788370.61298.09523107615639 855.08661.3021063107715662 849.996653.9911143107815685 123.537101.5899.25933108015728 865.458718.908943108115751 890.819728.1161103108315768 862.399709.0441143108215792 935.399638.986863108415817 141.76697.125390.11754100114163 167.399208.15190.50574100214164 99.8863263.59190.52914100414165 254.672196.46994.10954100314166 37.8868307.298101.9244100514167 458.02120.580291.05574100614168 524.213224.93490.84854101014169 630.416243.71790.68054100714170 336.984313.38388.83744100814171 399.427209.08394.16384100914172 514.707309.72193.4484101114173 501.085142.903113.1914106214174 815.073108.24889.16914101214175 845.61248.14391.44444101414176 940.503148.46194.35574101314177 722.008268.79795.43394101514178 752.333230.0196.95874101614179 800.785212.835112.5784101714180 755.737167.362122.4654105214181 214.55521.17195.38774101914182 125.848425.50798.74774101814183 133.412456.38299.5664102014184 161.03551.49399.88914106614185 187.584574.52796.38524106514186 154.171516.484102.2624102114187 159.674620.31103.4034102214188 274.543627.701114.4454102314189 212.566360.106125.9854105414190 455.636635.25182.67134103714191 567.523429.31289.90834106714192 421.122494.03990.96314102414193 344.909638.04690.25834104214194 532.733527.19495.32644102614195 336.699535.60192.98284102514196 889.971513.11281.19324102714198 740.426622.78981.73474102814199 891.755386.73493.34264102914200 689.244450.30593.98184106314201 759.196514.26394.99384103014202 698.54537.73494.97794103114203 744.692347.98898.11754103214204 267.013777.16788.59634103314205 183.524793.02390.3384106414206 65.7634671.21106.144103414207 155.811736.446113.144106814208 166.896718.302121.3594103514209 495.288650.96179.49384103814210 520.948713.26978.93624103614211 397.905772.1779.26644104014212 365.229693.43380.95394103914213 530.846685.25384.87624104114214 431.916837.1391.11024104314215 510.767853.64291.13094104414216 397.732825.25999.15144104514217 756.287803.87575.01654104614218 841.85837.32275.56214104714219 740.661657.99109.0454104814220 982.059788.0678.64334104914222 968.778667.51293.97374105014223 14.2808290.913134.4044105114224 901.055191.455134.0814105314225 212.116624.11131.4974105514226 6.76659363.081155.064105614227 645.384383.035129.2654105714228 125.348653.443136.1514105814229 476.372640.513145.3834105914230 632.661426.15988.27724106014232 727.497420.69891.22564106114233 526.961424.691864107215504 525.227440.7211104107015527 550.178413.03988.75624107315540 529.02441.1461024107415552 521.583481.68824107515573 369.155833.802904106915630 2.53796368.116105.6914107615640 857.202661.5441104107715663 851.266655.2281104107815686 121.042103.80989.19464108015729 887.366723.0941104108315769 857.081709.8581064108215794 870.116725.096984108115795 936.652643.279784108415818 138.12298.351586.56175100114235 166.229206.99187.75115100214236 96.2245265.29987.83945100414237 249.85199.58690.32565100314238 34.5731310.8299.47365100514239 461.68220.855186.97015100614240 336.618317.81586.40555100814241 405.412208.45790.75015100914242 523.013223.6588.31455101014243 631.406245.2788.24285100714244 516.448311.88790.4845101114245 498.864147.435109.4285106214246 815.504107.21386.95795101214247 845.638249.37189.64525101414248 941.196150.29593.87835101314249 746.668224.24794.59555101614250 721.669269.20192.96945101514251 797.826211.34111.6815101714252 760.088170.193121.2015105214253 214.258514.3392.14325101914254 125.594426.19397.05725101814255 133.954456.13597.98815102014256 165.383549.08398.75945106614257 197.906578.91196.38985106514258 153.368516.596101.7245102114259 162.55617.394101.9495102214260 275.079627.123113.0595102314261 211.189360.484124.2655105414262 458.442636.82180.32245103714263 343.769637.8887.94845104214264 570.92431.37688.91915106714265 420.401494.59288.86615102414266 332.588535.53491.01395102514267 532.982527.9292.82785102614269 895.372512.97278.67775102714271 739.622622.43378.94625102814272 894.128383.99791.33565102914273 693.695457.69591.32435106314274 760.131515.17795.48875103014275 700.842535.46493.19785103114276 743.435348.78597.535103214277 647.322382.615126.6875105714278 269.161778.30686.54175103314279 183.205794.9488.98565106414280 68.9893679.832102.8625103414281 158.96737.998110.9515106814282 168.575719.028121.2555103514283 488.939648.27976.73125103814284 350.898685.14578.78095103914285 520.013714.39777.09975103614286 398.691773.16977.60635104014287 532.397686.08383.17095104114288 427.219838.46290.29425104314289 509.766854.91789.55035104414290 397.879826.50798.60675104514291 755.608805.60872.69825104614292 841.964838.17773.40455104714293 740.879658.489106.2585104814294 982.059786.77676.93325104914296 968.834667.34691.66435105014297 13.2823291.416131.9765105114298 900.127191.445131.6215105314299 214.582623.021129.0635105514300 8.03457362.667153.0015105614301 124.31653.971134.1325105814302 479.24641.923141.5875105914303 635.156429.12295.8545106014305 727.497418.51792.63855106114306 528.685428.002865107215505 529443.5361025107015528 547.686410.54387.3235107315541 538.972449.4841185107415553 519.929485.573825107515574 368.267833.405905106915631 1.94373380.595100.6425107615641 857.933655.9231185107715664 846.522655.4411025107815687 118.546103.22685.94585108015730 856.788715.082945108215753 888.635719.9261145108315770 868.167730.564865108115796 931.118635.739825108415819 137.61497.586484.976100114308 166.089208.57387.68676100214309 94.0816264.3985.32016100414310 246.695199.29988.64556100314311 31.5823310.68597.24226100514312 458.96218.771185.71456100614313 523.801224.76185.19256101014314 630.068241.76185.24276100714315 338.034316.25784.24066100814316 404.637204.8988.89956100914317 518.459313.33988.32636101114318 502.536148.975107.8446106214319 815.479107.47586.17736101214320 846.387254.01987.14636101414321 724.914271.03590.82276101514322 943.079149.89993.19266101314323 748.094225.86692.50276101614324 799.535210.288109.3926101714325 764.498170.905120.3936105214326 227.034511.61987.41726101914327 127.136425.38994.85956101814328 134.522456.37995.7986102014329 165.147516.32194.15626102114330 199.833577.82495.53916106514331 166.748551.21396.54536106614332 164.092617.12100.3196102214333 272.954628.916109.8826102314334 209.971360.426122.3316105414335 458.809637.2979.37676103714336 582.487429.42687.66876106714337 420.873495.39387.19616102414338 532.802528.52391.7326102614339 331.076537.54989.29186102514340 898.137513.06176.64016102714342 739.227625.1576.89766102814343 692.488466.31586.17796106314344 894.859381.64688.65026102914345 701.125537.42491.70896103114346 760.542516.26692.8886103014347 742.157348.87196.11956103214348 645.079382.977125.7016105714349 270.979777.22485.56086103314350 183.403795.30789.58736106414351 60.8569685.829100.9156103414352 166.035736.984110.666106814353 173.837717.691123.0196103514354 491.063651.54276.46576103814355 357.526676.93277.59076103914356 521.655713.14677.00576103614357 401.845771.77476.45116104014358 537.216689.26682.2146104114359 344.693639.10886.2586104214360 424.423838.05689.9316104314361 508.559854.59789.44086104414362 396.13826.27798.11086104514363 753.415806.82771.30226104614364 847.433839.71971.43296104714365 740.718659.81105.0256104814367 982.059787.97473.91656104914369 968.976667.03890.09996105014370 11.5369290.597130.5146105114371 899.817192.097128.5966105314372 214.283624.459128.0876105514373 5.34221364.584150.8576105614374 124.544655.193132.6796105814375 479.648643.425139.3886105914376 635.156428.01775.95266106014377 722.506424.22186.70956106114378 532.476429.278786107215506 529.846443.7721066107015529 545.223410.54389.51546107315542 539.866446.6471186107415554 518.593490.375826107515575 359.839830.69906106915632 3.18384373.108106.726107615642 854.894663.7771026107715665 850.972654.1711106107815688 113.554105.71289.05716108015731 850.52709.915906108215754 885.03719.6691066108315771 867.775730.932906108115797 928.693634.62866108415820 136.25398.376383.98747100114380 246.427201.97387.78157100314381 92.129266.24584.447100414382 31.5834311.55196.42087100514383 336.755316.9483.4277100814384 461.06422.919484.70647100614385 522.918224.57384.35417101014386 629.894239.96984.46247100714387 519.094314.75787.10677101114388 396.531204.87788.73277100914389 499.453146.39104.7397106214390 815.552107.69285.26987101214391 846.714254.39585.66177101414392 744.049223.98491.24747101614393 722.63271.02689.61327101514394 944.552150.47694.48567101314395 797.51208.605109.5357101714396 231.749518.91287.63477101914397 130.18424.98693.93797101814398 135.461455.595.05097102014399 162.87510.12895.07797102114400 164.821554.75294.86817106614401 200.275578.47695.18767106514402 165.824615.31599.61997102214403 273.486628.143108.2977102314404 207.895359.487121.5977105414405 215.154623.577127.1267105514406 457.899635.37777.60097103714407 580.176429.11986.51587106714408 419.523495.27585.99067102414409 325.858539.68887.89877102514410 532
Answered 1 days AfterMar 30, 2022

Answer To: Sheet1 XpositionYpositionZpositionTime StepID 142.76998.647101.811001110...

Mohd answered on Apr 01 2022
106 Votes
-
-
Diego
4/01/2022
Importing dataset
library(readxl)
library(magrittr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':

##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(rmarkdown)
matrix2highcollagenconcentration <- read_excel("New folder (2)/matrix2highcollagenconcentration.xlsx")
## New names:
## * `` -> ...6
matrix1lowcollagenconcentration <- read_excel("New folder (2)/matrix1lowcollagenconcentration.xlsx")
1. How many cancer cells were analyzed in each matrix? Write a program to answer this question.
cases_low<-matrix1lowcollagenconcentration%>%
count(ID)
dim(cases_low)
## [1] 247 2
cases_high<-matrix2highcollagenconcentration%>%
count(ID)
dim(cases_high)
## [1] 219 2
247 cancer cells were analyzed in Low collegne level matrix. 219 cancer cells were analyzed in high collegne level matrix.
max(matrix1lowcollagenconcentration$`Time Step`)
## [1] 18
max(matrix2highcollagenconcentration$`Time Step`)
## [1] 24
1. How many cells have a full track of migration? Write a program to answer this question.
matrix1lowcollagenconcentration%>%
filter(`Time Step`==18)
## # A tibble: 231 x 5
## Xposition Yposition Zposition `Time Step` ID
##
## 1 489. 234. 168. 18 1021
## 2 481. 303. 169. 18 1012
## 3 609. 308. 169. 18 1011
## 4 827. 249. 170. 18 1044
## 5 743. 262. 169. 18 1014
## 6 146. 561. 154. 18 1017
## 7 112. 553. 168. 18 1018
## 8 630. 481. 142. 18 1037
## 9 469. 478. ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here