emp.data <- data.frame( emp_id = c (1:5), emp_name = c("Rick","Dan","Michelle","Ryan","Gary"), salary = c(623.3,515.2,611.0,729.0,843.25), start_date = as.Date(c("2012-01-01", "2013-09-23", "2014-11-15", "2014-05-11", "2015-03-27")), stringsAsFactors = FALSE )
r<-data.frame(cityid=c(1,2,3,4),
city=c("rajkot","ahmedabad","france","new yourk"),year=c(2011,2013,2014,2014),rainfall=c(90,66,30,80))
print("2p")
d<-r[r$year==2014,]
d
d[order(d$rainfall,decreasing=T),]
#[order(r$rainfall),]
r[order(r$rainfall,decreasing=T),][r$year==2014,]
r[r$rainfall>60 & r$rainfall<80,]
r[r$city=="ahmedabad",]
p<-data.frame(
players_id=c(1,2,3,4,5),
playersnm=
c("dhoni","gautam","sachin","virat","kapil"),
test=c("oneday","t20","oneday","t20","t20"),
runs=c(200,7999,6660,300,200),
"100s"=c(1,79,66,2,1),
"50s"=c(2,1,1,2,2)
)
p[order(p$runs,decreasing=T),]
p[p$runs>6000 & p$runs<8000,]
p[p$test=="oneday",]
write.csv(p,"nm")
getwd()
read.csv("nm",sep=",")
Post a Comment