Indexing and Slicing Data Frames - English
- subtitles off
- captions off
- English
- Questions posted on Forums
- R Tutorials - English
-
Indexing and extracting data
Dear Team ,What should be the syntax when we apply 2 conditions at a time like >20 matches played and less than 14 matches lost ?On writing below commands-print(subData)subData<-subset(Newcaptaincy,played>20,lost<14,select=c("names","played","lost"))print(subData)Answer isprint(subData) names played won1 Dhoni 45 222 Sourav 47 203 Azhar 40 20
11-12M 0-10S Joohi
Answer last updated on: Dec. 14, 2020, 1:26 p.m.
-
data frame slicing
in the assignment my code is subdata <- subset(captaincy,played>20&&lost<14,select =c("names","played","won","lost"))print(subdata)result is names played won lost1 Mahi 45 22 122 Sourav 49 21 133 Azhar 47 14 144 Sunny 47 9 85 Pataudi 40 9 196 Dravid 25 8 6in lost column we have 19 but it should be less than 14 know.
01-02M 0-10S bsankari2007@rediffmail.com
Answer last updated on: July 11, 2020, 12:34 p.m.
-
Subset
Can create a two subset at one syntax ? will it disturb all contents of captaincy data frames?Suppose i created as>SubData<-subset(captaincy,played>25,matches<40,select("names","played","lost"))ctrl+sprint(SubData)ctrl+sctrel+enteri have did but unexpected error.
10-11M 20-30S shiksha_saxena
Answer last updated on: June 17, 2020, 1:20 p.m.
-
Assignment
In the assignment i have worked out got the solution but with an error. Kindly help sirsubData <- subset(captaincy,played>20,lost<14, select = c("names","played","lost")) Error in `[.data.frame`(x, r, vars, drop = drop) : object 'lost' not found > print(subData) names played won 1 Mahi 45 22 2 Sourav 49 21 6 Dravid 25 8
12-13M 30-40S Alamu
Answer last updated on: May 15, 2020, 8:38 p.m.
-
Got an error on Assignment problem
I am trying to do the assignment but every time I got an error. Please provide me some useful solutionmy code is - subData <- subset(captaincy,played>20,lost<14, select = c("names","played","lost"))print(subData)My ans - names played lost Mahi 45 12 Sourav 49 13 Azhar 47 14 Sunny 47 8 Pataudi 40 19 Dravid 25 6
12-13M 30-40S sumankr545
Answer last updated on: April 29, 2020, 9:42 p.m.
-
Subset of a Dataset
subdata1<-subset(capataincy,played>20&&lost<14,select = c("names","played","won","lost"))In above query for large dataset can we have another option other than concatenating names of all columns manually?
10-11M 20-30S archanamagare2
Answer last updated on: Nov. 9, 2019, 2:50 p.m.
-
assignment Operator
Why "<-" operator is more preferred to "=" operator in case of assignment?
07-08M 0-10S judynair
Answer last updated on: Oct. 12, 2019, 4:22 p.m.
-
1Overview of R and RStudio
-
2Installing R and RStudio on Linux
-
3Installing R and RStudio on Windows
-
4Introduction to basics of R
-
5Introduction to Data Frames in R
-
6Introduction to RStudio
-
7Introduction to R script
-
8Working directories in RStudio
-
Indexing and Slicing Data Frames
-
10Creating Matrices using Data Frames
-
11Operations on Matrices and Data Frames
-
12Merging and Importing Data
-
13Data types and Factors
-
14Lists and its Operations
-
15Plotting Histograms and Pie Chart
-
16Plotting Bar Charts and Scatter Plot
-
17Introduction to ggplot2
-
18Aesthetic Mapping in ggplot2
-
19Data Manipulation using dplyr Package
-
20More Functions in dplyr Package
-
21Pipe Operator
-
22Conditional Statements
-
23Functions in R
Questions posted on ST Forums:
21587 visits
Outline:
Shortcut key for assignment operator (<-) How to perform numeric indexing How to extract a row or column from a data frame How to retrieve multiple rows from a data frame How to combine objects to form a vector How to perform logical indexing on a data frame How to perform name indexing on a data frame How to slice a data frame using subset function How to select required columns (by name) from a data frame How to retrieve data using double square brackets
Width: | 812 | Height: | 608 |
---|---|---|---|
Duration: | 00:13:31 | Size: | 6.7 MB |
Show video info