Hi, Not sure about your expected result. If you need a logical index as the new variable: ##check str(Food) Food[,-1] <- lapply(Food[,-1],function(x) as.numeric(as.character(x)))
str(Food) Food1 <- within(Food,Healthy.food <- GRASSI < 20) HFood <- Food1[Food1$Healthy.food,-7] dim(HFood) #[1] 152 6 A.K. Hello, I have a table: > library(XML) > u='http://www.ininternet.org/calorie.htm' > tables = readHTMLTable(u) > Food=tables[[9]] > View(Food) And now I don't know how to create a new variable named Healthy.food, in which would be all foods which fat(GRASSI) is lower than 20. Please help me Nina ______________________________________________ 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.