I am trying to run a loop in columns and check field type.
for(i in names(SQLQUERYOUTPUT)){
abc<- sapply(SQLQUERYOUTPUT[i], class)
print(abc)
if is.numeric(abc)
{
min(SQLQUERYOUTPUT[i])
}
IF is.character(abc)
max(nchar(SQLQUERYOUTPUT[i]))
}
}
if column is numeric then need lowest value and if its string then value with maximum length.
Its not working. Can anyone please help me on this