Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

201903100110041

# R program reading a text file

# Read a text file using read.delim()
myData = read.delim("breast-cancer-wisconsin.data", header = FALSE)
print(myData)
VIEWDATA<-read.csv("breast-cancer-wisconsin.data", header = FALSE, sep = ",")
ENTERDATA=data.frame(VIEWDATA)
print(ENTERDATA)
#result =  ENTERDATA[c(2,0:4),c(3,0:4)]
result =  ENTERDATA[c(1,3),]#print the 1 and 3 record 
print(result)
if(ENTERDATA[,6]>2 && ENTERDATA[,6]<4 ){
  print(ENTERDATA)
}else{
  print("not founnd")
}
data_frame_mod <- ENTERDATA[which(ENTERDATA$V6 >4 & ENTERDATA$V6<8),]#filter based on condition
data_frame_mod <- ENTERDATA[which(ENTERDATA$V6 == 4 ),]#print only V4 has a 4 digit
using_subset=subset(ENTERDATA,ENTERDATA$V5==9 & ENTERDATA$V5!="?")
print("---------USING SUBSET METHOD-------------")
print(using_subset)
print("---------END USING SUBSET METHOD-------------")
print("---------USING wHICH METHOD-------------")
print(data_frame_mod)
print("---------END USING wHICH METHOD-------------")
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
6+3 =