apply() Function in R (R Tutorial 1.14)

Learn how to use the “apply()” function in R, to apply a function to all rows or columns of a data frame. The apply function essentially is a specialized loop function, although it is more efficient than a simple for-loop. You will also learn the use of the “ColMeans”, “ColSums”, “RowMeans”, and “RowSums” functions.
This video is a tutorial for programming in R Statistical Software for Statistics and Data Science beginners, using RStudio.

You can access the dataset (Stock Example Data) and R script (Apply Function) here:
(https://bit.ly/2rOfgEJ)

Comments

mao rui says:

Intuitive!

케이오튜브 KOTUBE says:

I love MarinStatsLectures. It has been a great help for me to prepare for my grad school thesis. Thank you for your effort and I am a big fan of you Marin!

Hiren Kakkad says:

When I am using apply command then I am getting following error.

apply(X=StockData, MARGIN = 2, FUN = mean)
X Stock1 Stock2 Stock3 Stock4
NA NA NA NA NA
Warning messages:
1: In mean.default(newX[, i], …) :
argument is not numeric or logical: returning NA
2: In mean.default(newX[, i], …) :
argument is not numeric or logical: returning NA
3: In mean.default(newX[, i], …) :
argument is not numeric or logical: returning NA
4: In mean.default(newX[, i], …) :
argument is not numeric or logical: returning NA
5: In mean.default(newX[, i], …) :
argument is not numeric or logical: returning NA

LEIYUE RAN says:

Hi guys, anyone happen to have the same problem of points not showing on the graph?

Green Cat says:

Tapply and lapply would also be cool to see here :)

Sho Islam says:

This is a great video, especially as I’m still very new in R!!

Hossam Mohamed says:

When i try to generate plots using apply function it only gives one plot , not a separate plot for each column ??

suman das says:

i don’t want to sum of all variables…i want to sum some variables..how do i write it??? rowsum

Limin Jin says:

Thanks so much! This is the best R tutorial i’ve ever seen!!! But the problem is that the dataset is not avaliable now, since the web link is invalide now. could you please post a new link consisting the dataset?

Stefan says:

Thanks for your amazing video series! I profit a lot from them.
In RStudio under the files, plots, packages pane. Shows the section packages the already installed packages? And when you activate them then you loaded the library of the package?

Paul Elliot says:

Thanks very much for this video. I have a doubt. What should I do if I want to boxplot stock1, stock2, stock 3 and stock 4, for Day1, Day2… Day10. So 6 boxplots for each of the days, with stock1-4 in each of those boxplots. Hope I’m making sense. Many thanks!

Jesus Rojas says:

Dude, I’ll send you a copy of my master’s once is done, you deserve at least 20% of it, thanks so much for your videos!!! @MarinStatsLectures-R Programming & Statistics

MeiKimchi says:

I tried to use RowSums and apply, but im getting different result ?

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles   Show Cars   Motorbikes   Scooters   Bicycles   Rims & Tires   Luxury BoatsFashion   Sunglasses   Luxury Watches   Luxury Purses   Jeans Wear   High Heels   Kinis Swimwear   Perfumes   Jewellery   Cosmetics   Shaving Helpers   Fashion Hats   Modeling TipsFooding   Chef Club   Fooding Helpers   Coktails & LiquorsSports   Sport Shoes   Fitness & Detox   Golf Gear   Racquets   Hiking & Trek Gear   Diving Equipment   Ski Gear   Snowboards   Surf Boards   Rollers & SkatesEntertainment   DIY Guides   Zik Instruments   Published Books   Music Albums   Cine Movies   Trading Helpers   Make Money   Fishing Equipment   Paintball Supplies   Trading Card Games   Telescopes   Knives   Vapes   GameplaysHigh Tech   Flat Screens   Tech Devices   Camera Lenses   Audio HiFi   Printers   USB Devices   PC Hardware   Network Gear   Cloud Servers   Software Helpers   Programmer Helpers   Mobile Apps   Hearing AidsHome   Home Furniture   Home Appliances   Tools Workshop   Beddings   Floor Layings   Barbecues   Aquarium Gear   Safe Boxes   Office Supplies   Security Locks   Cleaning ProductsKids   Baby Strollers   Child Car Seats   Remote ControlledTravel   Luggages & Bags   Airlines Seats   Hotel Rooms   Fun Trips   Cruise Ships   Mexico Tours