n = read.csv("Student_data (1).csv")
n = n[,-c(29:38)]
length(n)
nrow(n)
#BE
for (i in 1:length(n))
{
for(j in 1:nrow(n))
{
x=c("B.E","Bachelor of Engineering","BACHELOR OF ENGINEERING","B.E.")
if( n[i][[j]] %in% x)
n[i][[j]] = "BE"
}
}
I am tying to clean a data frame that has different factors of same kind but with different names and presentation say like Bachelors in Engineering and B.E. means the same thing which is "BE", so I am trying to convert all such factors inside qualifications and specialization columns simultaneously using "for" loop as BE,similarly for others but it gives me an error as
Error in .subset2(x, i, exact = exact) : subscript out of bounds In addition: Warning message: In if (n[i][[j]] %in% x) n[i][[j]] = "BE" : the condition has length > 1 and only the first element will be used Can anyone help me out with this Also an better and efficient way than this is always welcomed! I have also linked my .csv file in here