Using R
Use the dataset “Food Nutrition”, and answer the following questions:
(25 Marks)• Set the working directory for your work• Import the dataset in the console in the .xls format• View the top 10 rows of the data• View the last 20 rows of the data• Show the summary of the data• Create a vector “test” using the top 10 values of Protein Variable• Select the top 5 rows of initial 5 variables in a matrix format• What is the class of the Sodium_(mg) variable present?• Create a new variable “EPW” by dividing Energ_Kcal with the Water value• What is the updated dimension of the new dataset?
Note: Solutions to be provided in (.docx) format. I will run it at my end and question is from Data Visualization
Sheet1 NDB_NoShrt_DescWater_(g)Energ_KcalProtein_(g)Lipid_Tot_(g)Ash_(g)Carbohydrt_(g)Fiber_TD_(g)Sugar_Tot_(g)Calcium_(mg)Iron_(mg)Magnesium_(mg)Phosphorus_(mg)Potassium_(mg)Sodium_(mg)Zinc_(mg)Copper_mg)Manganese_(mg)Selenium_(µg) 01001BUTTER,WITH SALT15.877170.8581.112.110.0600.06240.02224246430.09001 01002BUTTER,WHIPPED,W/ SALT16.727180.4978.31.622.8700.06230.05124415830.050.010.0010 01003BUTTER OIL,ANHYDROUS0.248760.2899.4800004003520.010.00100 01004CHEESE,BLUE42.4135321.428.745.112.3400.55280.312338725611462.660.040.00914.5 01005CHEESE,BRICK41.1137123.2429.683.182.7900.516740.43244511365602.60.0240.01214.5 01006CHEESE,BRIE48.4233420.7527.682.70.4500.451840.5201881526292.380.0190.03414.5 01007CHEESE,CAMEMBERT51.830019.824.263.680.4600.463880.33203471878422.380.0210.03814.5 01008CHEESE,CARAWAY39.2837625.1829.23.283.06006730.6422490936902.940.0240.02114.5 01009CHEESE,CHEDDAR37.0240422.8733.313.713.0900.487100.1427455766533.640.030.02728.5 01010CHEESE,CHESHIRE37.6538723.3730.63.64.78006430.2121464957002.790.0420.01214.5 01011CHEESE,COLBY38.239423.7632.113.362.5700.526850.76264571276043.070.0420.01214.5 01012CHEESE,COTTAGE,CRMD,LRG OR SML CURD79.799811.124.31.413.3802.67830.0781591043640.40.0290.0029.7 01013CHEESE,COTTAGE,CRMD,W/FRUIT79.649710.693.851.24.610.22.38530.167113903440.330.040.0037.7 01014CHEESE,COTTAGE,NONFAT,UNCRMD,DRY,LRG OR SML CURD81.017210.340.291.716.6601.85860.15111901373720.470.030.0229.4 01015CHEESE,COTTAGE,LOWFAT,2% MILKFAT81.248110.452.271.274.76041110.1391501253080.510.0330.01511.9 01016CHEESE,COTTAGE,LOWFAT,1% MILKFAT82.487212.391.021.392.7202.72610.145134864060.380.0280.0039 01017CHEESE,CREAM52.623506.1534.441.275.5203.76970.1191071323140.50.0180.0118.6 01018CHEESE,EDAM41.5635724.9927.84.221.4301.437310.44305361888123.750.0360.01114.5 01019CHEESE,FETA55.2226414.2121.285.24.0904.094930.6519337629172.880.0320.02815 01020CHEESE,FONTINA37.9238925.631.143.791.5501.555500.2314346648003.50.0250.01414.5 01021CHEESE,GJETOST13.444669.6529.514.7542.65004000.527044414096001.140.080.0414.5 01022CHEESE,GOUDA41.4635624.9427.443.942.2202.227000.24295461218193.90.0360.01114.5 01023CHEESE,GRUYERE33.1941329.8132.344.30.3600.3610110.1736605817143.90.0320.01714.5 01024CHEESE,LIMBURGER48.4232720.0527.253.790.4900.494970.13213931288002.10.0210.03814.5 01025CHEESE,MONTEREY41.0137324.4830.283.550.6800.57460.72274448160030.0320.01114.5 01026CHEESE,MOZZARELLA,WHL MILK50.0130022.1722.353.282.1901.035050.4420354766272.920.0110.0317 01027CHEESE,MOZZARELLA,WHL MILK,LO MOIST48.3831821.624.642.912.4701.015750.221412757102.460.0220.00916.1 01028CHEESE,MOZZARELLA,PART SKIM MILK53.7825424.2615.923.272.7701.137820.2223463846192.760.0250.0114.4 01029CHEESE,MOZZARELLA,LO MOIST,PART-SKIM47.0729523.7519.783.835.5801.96970.22275481886663.620.0330.03927.6 01030CHEESE,MUENSTER41.7736823.4130.043.661.1201.127170.41274681346282.810.0310.00814.5 01031CHEESE,NEUFCHATEL63.112539.1522.781.373.5903.191170.13101381523340.820.0270.0113 01032CHEESE,PARMESAN,GRATED22.6542028.4227.847.1813.9100.078530.493462718018044.20.040.07134.4 01033CHEESE,PARMESAN,HARD29.1639235.7525.836.043.2200.811840.82446949213762.750.0320.0222.5 01034CHEESE,PORT DE SALUT45.4535223.7828.220.5700.576500.43243601365342.60.0220.01114.5 01035CHEESE,PROVOLONE40.9535125.5826.624.712.1400.567560.52284961388763.230.0260.0114.5 01036CHEESE,RICOTTA,WHOLE MILK71.717411.2612.981.023.0400.272070.3811158105841.160.0210.00614.5 01037CHEESE,RICOTTA,PART SKIM MILK74.4113811.397.911.155.1400.312720.4415183125991.340.0340.0116.7 01038CHEESE,ROMANO30.9138731.826.946.723.6300.7310640.77417608614332.580.030.0214.5 01039CHEESE,ROQUEFORT39.3836921.5430.646.442006620.56303929118092.080.0340.0314.5 01040CHEESE,SWISS37.6339326.9630.992.971.44008900.1333574721874.370.0470.02630 01041CHEESE,TILSIT42.8634024.4125.984.871.88007000.2313500657533.50.0260.01314.5 01042CHEESE,PAST PROCESS,AMERICAN,FORT W/ VITAMIN D39.6136618.1330.716.784.7802.2610450.632664113216712.490.0460.04120.2 01043CHEESE,PAST PROCESS,PIMENTO39.0837522.1331.25.841.730.10.626140.42227441629152.980.0330.01614.5 01044CHEESE,PAST PROCESS,SWISS42.3133424.7325.015.852.101.237720.612976221613703.610.0270.01415.9 01045CHEESE FD,COLD PK,AMERICAN43.1233119.6624.464.448.32004970.84304003639663.010.030.0116.2 01046CHEESE FD,PAST PROCESS,AMERICAN,VITAMIN D FORT4433016.8625.634.968.5605.596820.262743825512842.310.0340.02519.6 01047CHEESE FD,PAST PROCESS,SWISS43.6732321.9224.145.774.5007230.62852628415523.550.030.0116.1 01048CHEESE SPRD,PAST PROCESS,AMERICAN47.6529016.4121.235.988.7307.325620.332987524216252.590.0330.0211.3 01049CREAM,FLUID,HALF AND HALF81.241233.1310.390.514.7304.131070.051095132610.390.0090.0053.2 01050CREAM,FLUID,LT (COFFEE CRM OR TABLE CRM)74.511912.9619.10.612.8203.67910.05992136720.320.0120.0054.6 01052CREAM,FLUID,LT WHIPPING63.52922.1730.910.462.9602.96690.0376197340.250.0070.0010.5 01053CREAM,FLUID,HVY WHIPPING57.813402.8436.080.532.7402.92660.175895270.240.0110.0063 01054CREAM,WHIPPED,CRM TOPPING,PRESSURIZED61.332573.222.220.7612.49081010.05118914780.370.010.0011.4 01055CREAM,SOUR,RED FAT,CULTURED80.141352.94120.664.2600.161040.071095129890.50.0160.0032.1 01056CREAM,SOUR,CULTURED73.071982.4419.350.514.6303.411010.071076125310.330.0180.0153.7 01057EGGNOG82.54884.554.190.678.0508.051300.219109165540.460.0130.0054.2 01058SOUR DRSNG,NON-BUTTERFAT,CULTURED,FILLED CREAM-TYPE74.791783.2516.570.714.6804.681130.031087162480.370.010.0022.3 01059MILK,FILLED,FLUID,W/BLEND OF HYDR VEG OILS87.67633.333.460.84.74001280.051397139570.360.010.0022 01060MILK,FILLED,FLUID,W/LAURIC ACID OIL87.73633.333.40.84.7404.741280.051397139570.360.010.0022 01061CHEESE,AMERICAN,NONFAT OR FAT FREE65.4712621.0502.9510.5305.26789011531639313164.110.5590.67714.6 01067CREAM SUB,LIQ,W/HYDR VEG OIL&SOY PROT77.2713619.970.3811.38011.3890.03064191670.02001.1 01068CREAM SUB,LIQ,W/LAURIC ACID OIL&NA CASEINATE77.2713619.970.3811.380090.03064191790.020.0250.041.1 01069CREAM SUBSTITUTE,POWDERED2.985292.4832.922.3459.2907.7720.2612886691240.070.0180.0110 01070DESSERT TOPPING,POWDERED1.475774.939.921.1752.54052.54170.037741661220.080.1180.2250.6 01071DESSERT TOPPING,PDR,1.5 OZ PREP W/1/2 CUP MILK65.741943.6112.720.817.13017.13900.041086151660.270.0120.0054.8 01072DESSERT TOPPING,PRESSURIZED60.372640.9822.30.2816.07016.0750.0211819620.010.0240.0451.5 01073DESSERT TOPPING,SEMI SOLID,FRZ50.213181.2525.310.1823.05023.0560.122818250.030.030.0582.1 01074SOUR CRM,IMITN,CULTURED71.152082.419.520.36.6306.6330.396451611021.180.0580.112.5 01076MILK SUBSTITUTES,FLUID,W/LAURIC ACID OIL88.18611.753.410.56.1600330.39674114781.180.0510.0971.9 01077MILK,WHL,3.25% MILKFAT,W/ ADDED VITAMIN D88.13613.153.250.674.805.051130.031084132430.370.0250.0043.7 01078MILK,PRODUCER,FLUID,3.7% MILKFAT87.69643.283.660.724.65001190.051393151490.380.010.0042 01079MILK,RED FAT,FLUID,2% MILKFAT,W/ ADDED VIT A & VITAMIN D89.21503.31.980.714.805.061200.021192140470.480.0060.0142.5 01080MILK,RED FAT,FLUID,2% MILKFAT,W/ ADDED NFMS, VIT A & VIT D88.86513.481.920.774.97001280.0514100162520.40.0080.0022.3 01081MILK,RED FAT,FLUID,2% MILKFAT,PROT FORT,W/ ADDED VIT A & D87.71563.951.980.875.4905.261430.0616112182590.450.0080.0022.6 01082MILK,LOWFAT,FLUID,1% MILKFAT,W/ ADDED VIT A & VITAMIN D89.92423.370.970.754.9905.21250.031195150440.420.010.0033.3 01083MILK,LOWFAT,FLUID,1% MILKFAT,W/ ADD NONFAT MILK SOL,VIT A/ D89.81433.480.970.774.97001280.0514100162520.40.010.0022.3 01084MILK,LOWFAT,FLUID,1% MILKFAT,PROT FORT,W/ ADDED VIT A & D88.74483.931.170.865.52001420.0616111180580.450.010.0022.5 01085MILK,NONFAT,FLUID,W/ ADDED VIT A & VIT D (FAT FREE OR SKIM)90.84343.370.080.754.9605.091220.0311101156420.420.0130.0033.1 01086MILK,NONFAT,FLUID,W/ ADDED NONFAT MILK SOL,VIT A & VIT D90.38373.570.250.785.0205.021290.0515104171530.410.0110.0022.2 01087MILK,NONFAT,FLUID,PROT FORT,W/ ADD VIT A & D (FAT FREE/SKIM)89.36413.960.250.875.56001430.0616112182590.450.0110.0022.4 01088MILK,BTTRMLK,FLUID,CULTURED,LOWFAT90.13403.310.880.894.7904.791160.0511891511900.420.0110.0022 01089MILK,LO NA,FLUID88.2613.13.460.784.4604.461010.0558625330.380.010.0042 01090MILK,DRY,WHL,W/ ADDED VITAMIN D2.4749626.3226.716.0838.42038.429120.478577613303713.340.080.0416.3 01091MILK,DRY,NONFAT,REG,WO/ ADDED VIT A & VITAMIN D3.1636236.160.777.9351.98051.9812570.3211096817945354.080.0410.0227.3 01092MILK,DRY,NONFAT,INST,W/ ADDED VIT A & VITAMIN D3.9635835.10.728.0352.19052.1912310.3111798517055494.410.0410.0227.3 01093MILK,DRY,NONFAT,CA RED4.935435.50.27.651.8002800.3260101168022804.030.0160.00827.3 01094MILK,BUTTERMILK,DRIED2.9738734.35.787.954904911840.311093315925174.020.1110.02320.3 01095MILK,CND,COND,SWTND27.163217.918.71.8354.4054.42840.19262533711270.940.0150.00614.8 01096MILK,CND,EVAP,W/ ADDED VITAMIN D & WO/ ADDED VIT A74.041346.817.561.5510.04010.042610.19242033031060.770.0160.0062.3 01097MILK,CND,EVAP,NONFAT,W/ ADDED VIT A & VITAMIN D79.4787.550.21.511.35011.352900.29271953321150.90.0160.0062.5 01102MILK,CHOC,FLUID,COMM,WHL,W/ ADDED VIT A & VITAMIN D82.3833.173.390.810.340.89.541120.2413101167600.410.0650.0771.9 01103MILK,CHOC,FLUID,COMM,RED FAT82.17762.991.90.8112.130.79.551090.2414102169660.390.0750.0623.4 01104MILK,CHOC,LOWFAT,W/ ADDED VIT A & VITAMIN D84.91623.4610.789.860.19.941290.231396172650.430.0280.031.9 01105MILK,CHOC BEV,HOT COCOA,HOMEMADE82.45773.522.340.6510.7419.661140.4223105197440.630.1030.0132.7 01106MILK,GOAT,FLUID,W/ ADDED VITAMIN D87.03693.564.140.824.4504.451340.0514111204500.30.0460.0181.4 01107MILK,HUMAN,MATURE,FLUID87.5701.034.380.26.8906.89320.0331451170.170.0520.0261.8 01108MILK,INDIAN BUFFALO,FLUID83.39973.756.890.795.18001690.1231117178520.220.0460.01843.4 01109MILK,SHEEP,FLUID80.71085.9870.965.36001930.118158137440.540.0460.0181.7 01110MILK SHAKES,THICK CHOC72.21193.052.70.921.150.320.851320.31161262241110.480.0650.0391.9 01111MILK SHAKES,THICK VANILLA74.451123.863.030.9117.75017.751460.112115183950.390.0510.0142.3 01112WHEY,ACID,FLUID93.42240.760.090.615.1205.121030.081078143480.430.0030.0021.8 01113WHEY,ACID,DRIED3.5133911.730.5410.7773.45073.4520541.24199134922899686.310.050.01527.3 01114WHEY,SWEET,FLUID93.12270.850.360.535.1405.14470.06846161540.130.0040.0011.9 01115WHEY,SWEET,DRIED3.1935312.931.078.3574.46074.467960.88176932208010791.970.070.00927.2 01116YOGURT,PLN,WHL MILK,8 GRAMS PROT PER 8 OZ87.9613.473.250.724.6604.661210.051295155460.590.0090.0042.2 01117YOGURT,PLN,LOFAT,12 GRAMS PROT PER 8 OZ85.07635.251.551.097.0407.041830.0817144234700.890.0130.0043.3 01118YOGURT,PLN,SKIM MILK,13 GRAMS PROT PER 8 OZ85.23565.730.181.187.6807.681990.0919157255770.970.0150.0053.6 01119YOGURT,VANILLA,LOFAT,11 GRAMS PROT PER 8 OZ79854.931.251.0213.8013.81710.0716135219660.830.0130.0044.9 01120YOGURT,FRUIT,LOFAT,9 GRAMS PROT PER 8 OZ75.3993.981.150.9318.64018.641380.0613109177530.670.0790.0642.8 01121YOGURT,FRUIT,LOFAT,10 GRAMS PROT PER 8 OZ74.481024.371.081.0219.05019.051520.0715119195580.740.080.0653.1 01122YOGURT,FRUIT,LOFAT,11 GRAMS PROT PER 8 OZ74.11054.861.411.0318.6001690.0716133216650.820.080.0653.1 01123EGG,WHL,RAW,FRSH76.1514312.569.511.060.7200.37561.75121981381421.290.0720.02830.7 01124EGG,WHITE,RAW,FRESH87.575210.90.170.630.7300.7170.0811151631660.030.0230.01120 01125EGG,YOLK,RAW,FRSH52.3132215.8626.541.713.5900.561292.735390109482.30.0770.05556 01126EGG,YOLK,RAW,FRZ,PAST56.4429615.5325.61.620.8100.161344.5511420121673.1700.07856.4 01127EGG,YOLK,RAW,FRZ,SUGARED,PAST51.2330713.8722.821.1310.95010.31243.710404105703.060.0120.0853.5 01128EGG,WHL,CKD,FRIED69.4719613.6114.841.260.8300.4621.89132151522071.390.0780.0333.1 01129EGG,WHL,CKD,HARD-BOILED74.6215512.5810.611.081.1201.12501.19101721261241.050.0130.02630.8 01130EGG,WHOLE,COOKED,OMELET76.1315410.5711.661.010.6400.31481.48111671171551.090.0630.02425.8 01131EGG,WHL,CKD,POACHED75.8514312.519.471.460.7100.37561.75121971382971.290.0720.02830.6 01132EGG,WHL,CKD,SCRMBLD76.41499.9910.981.011.6101.39661.31111651321451.040.0590.02223.5 01133EGG,WHL,DRIED2.7859248.0543.94.131.1300.562447.2346295404763.150.2030.058164.7 01134EGG,WHL,DRIED,STABILIZED,GLUCOSE RED1.8761548.1743.953.632.38002228.28497155155485.710.270.15121.1 01135EGG,WHITE,DRIED,FLAKES,STABILIZED,GLUCOSE RED14.6235176.920.044.254.1700830.236783104211560.150.230.07116.8 01136EGG,WHITE,DRIED,PDR,STABILIZED,GLUCOSE RED8.5437682.40.044.554.4700890.247289111612380.160