All - firstly apology if this is a very basic question but i tried myself and could not find a satisfied answer.
I know that i can subset a dataframe using dataframe[row,column] and if i give dataframe[row,] that specific row is provided and similarly i can do dataframe[,column] to get the entire column. what i don't understand is that if i do dataframe[<conditional expression>]and don't provide the 'comma' what is being returned e.g. i have the below code: manager <- c(1, 2, 3, 4, 5) date <- c("10/24/08", "10/28/08", "10/1/08", "10/12/08", "5/1/09") country <- c("US", "US", "UK", "UK", "UK") gender <- c("M", "F", "F", "M", "F") age <- c(32, 45, 25, 39, 99) q1 <- c(5, 3, 3, 3, 2) q2 <- c(4, 5, 5, 3, 2) q3 <- c(5, 2, 5, 4, 1) q4 <- c(5, 5, 5, NA, 2) q5 <- c(5, 5, 2, NA, 1) leadership <- data.frame(manager, date, country, gender, age, q1, q2, q3, q4, q5, stringsAsFactors=FALSE) now if i do leadership[leadership$country == "US",] two row are being returned as managerID JoinDate country gender age q1 q2 q3 q4 q5 agecat 1 1 10/24/08 US M 32 5 4 5 5 5 Young 2 2 10/28/08 US F 45 3 5 2 5 5 Young but if i do leadership[leadership$country == "US"] to get the entire data frame where country is US i am getting below managerID JoinDate q1 q2 agecat 1 1 10/24/08 5 4 Young 2 2 10/28/08 3 5 Young 3 3 10/1/08 3 5 Young 4 4 10/12/08 3 3 Young 5 5 5/1/09 2 2 <NA> Please guide me what am i doing wrong. Thanks [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list 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.