# To select rows in dataframe
# that contains both positive and negative values
# Creating dataset
# creating fisrs column
first <- c(-74,-89,34,-82,-64,92,-67)
# creating second column
second <- c(88,52,-28,-19,39,86,-31)
# creating third column
third <- c(39,37,-39,-64,-93,44,38)
# creating fourth column
fourth <- c(-64,-26,-54,-33,-43,23,63)
# creating fifth column
fifth <- c(-83,-39,-53,-20,-31,82,-17)
# creating dataframe
x <- data.frame(temp_1=first,
temp_2=second,temp_3=third,
temp_4=fourth,temp_5=fifth)
# checking if there exist a row with
# both positive and negative values
subset(x,(rowSums(sign(x)<0)>0) & (rowSums(sign(x)>0)>0))