Hi i am passing arguments in R.when i passing the string value i am getting the following error.
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied only to factors with 2 or more levels
In addition: Warning message:
In read.table(file = file, header = header, sep = sep, quote = quote, :
incomplete final line found by readTableHeader on 'addresstest.txt'
this is my code
input <- function(CITY,ADDRESS)
{
delhi <- read.delim("addresstest.txt", na.strings = "")
delhi$lnprice <- log(delhi$PRIMARY_PRICE) # creating log price variable
uidel = lm (lnprice ~ CITY+AREA_SQFT+BEDS+BATHS+ADDRESS,data = delhi)
model <- predict (uidel,data.frame(CITY=CITY,ADDRESS=ADDRESS), na.rm = TRUE)
model
}
passing the values by
input(CITY=NCR,ADDRESS=Sector78)
any help will be appreciated.