R can have a bit of a learning curve... There are several ways to achieve your goal - depending on what you want: test_df <- data.frame(Movie = letters, some.value = rnorm(26)) test_df$Movie[1:10] test_df$Movie[sample(c(1:26), 10)] test_df[sample(c(1:26), 10), ] Do read a tutorial or two on R - "Introduction to R" as suggested by David or something else - so you can explain the code above to yourself. HTH Ulrik On Sun, 5 Nov 2017 at 19:38 David Winsemius <dwinsemius at comcast.net> wrote:> > > On Nov 5, 2017, at 9:28 AM, Ahsan Zahir via R-help <r-help at r-project.org> > wrote: > > > > > > Hey, > > > > I am a beginner in R. > > > > How do I read last 10 values from column- Movie, from a dataset? > > Some questions are so simple that they strongly suggest no prior effort at > self-leanrning. In such cases the usual recommendation given at Rhelp is > that you read an introductory text. Many of us used the "Introduction to R" > that is shipped with every copy of R: > > https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf > > > > > > Pls help. > > > > Sent from my iPhone > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > David Winsemius > Alameda, CA, USA > > 'Any technology distinguishable from magic is insufficiently advanced.' > -Gehm's Corollary to Clarke's Third Law > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Hello, Also tail(test_df$Movie, 10) Hope this helps, Rui Barradas Em 05-11-2017 19:18, Ulrik Stervbo escreveu:> R can have a bit of a learning curve... There are several ways to achieve > your goal - depending on what you want: > > test_df <- data.frame(Movie = letters, some.value = rnorm(26)) > > test_df$Movie[1:10] > > test_df$Movie[sample(c(1:26), 10)] > > test_df[sample(c(1:26), 10), ] > > Do read a tutorial or two on R - "Introduction to R" as suggested by David > or something else - so you can explain the code above to yourself. > > HTH > Ulrik > > On Sun, 5 Nov 2017 at 19:38 David Winsemius <dwinsemius at comcast.net> wrote: > >> >>> On Nov 5, 2017, at 9:28 AM, Ahsan Zahir via R-help <r-help at r-project.org> >> wrote: >>> >>> >>> Hey, >>> >>> I am a beginner in R. >>> >>> How do I read last 10 values from column- Movie, from a dataset? >> >> Some questions are so simple that they strongly suggest no prior effort at >> self-leanrning. In such cases the usual recommendation given at Rhelp is >> that you read an introductory text. Many of us used the "Introduction to R" >> that is shipped with every copy of R: >> >> https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf >> >> >>> >>> Pls help. >>> >>> Sent from my iPhone >>> >>> ______________________________________________ >>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >> >> David Winsemius >> Alameda, CA, USA >> >> 'Any technology distinguishable from magic is insufficiently advanced.' >> -Gehm's Corollary to Clarke's Third Law >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
And head(test_df$Movie, 10) For function completeness :-) Rui Barradas <ruipbarradas at sapo.pt> schrieb am So., 5. Nov. 2017, 20:56:> Hello, > > Also > > tail(test_df$Movie, 10) > > Hope this helps, > > Rui Barradas > > Em 05-11-2017 19:18, Ulrik Stervbo escreveu: > > R can have a bit of a learning curve... There are several ways to achieve > > your goal - depending on what you want: > > > > test_df <- data.frame(Movie = letters, some.value = rnorm(26)) > > > > test_df$Movie[1:10] > > > > test_df$Movie[sample(c(1:26), 10)] > > > > test_df[sample(c(1:26), 10), ] > > > > Do read a tutorial or two on R - "Introduction to R" as suggested by > David > > or something else - so you can explain the code above to yourself. > > > > HTH > > Ulrik > > > > On Sun, 5 Nov 2017 at 19:38 David Winsemius <dwinsemius at comcast.net> > wrote: > > > >> > >>> On Nov 5, 2017, at 9:28 AM, Ahsan Zahir via R-help < > r-help at r-project.org> > >> wrote: > >>> > >>> > >>> Hey, > >>> > >>> I am a beginner in R. > >>> > >>> How do I read last 10 values from column- Movie, from a dataset? > >> > >> Some questions are so simple that they strongly suggest no prior effort > at > >> self-leanrning. In such cases the usual recommendation given at Rhelp is > >> that you read an introductory text. Many of us used the "Introduction > to R" > >> that is shipped with every copy of R: > >> > >> https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf > >> > >> > >>> > >>> Pls help. > >>> > >>> Sent from my iPhone > >>> > >>> ______________________________________________ > >>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > >>> https://stat.ethz.ch/mailman/listinfo/r-help > >>> PLEASE do read the posting guide > >> http://www.R-project.org/posting-guide.html > >>> and provide commented, minimal, self-contained, reproducible code. > >> > >> David Winsemius > >> Alameda, CA, USA > >> > >> 'Any technology distinguishable from magic is insufficiently advanced.' > >> -Gehm's Corollary to Clarke's Third Law > >> > >> ______________________________________________ > >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide > >> http://www.R-project.org/posting-guide.html > >> and provide commented, minimal, self-contained, reproducible code. > >> > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > >[[alternative HTML version deleted]]