Pls help me with the code

r

#1

i want to perform if any cell in my data frame with characters(lowercase,uppercase),or any word then need to execute the below code .

lapply(data27,lookup,key.match=data23)

above code has to execute if any cell with single characters or word or string…if any number present function need not to apply.
pls help me


#2

Hi @saisaranv

It is not clear what you are trying to do with this code. So please reframe your query, and also try to share a reproducible code.


#3

thanks for the response and i have the large data frame(data27) with numbers in one column and 112 columns having characters , now i have another data frame(data23) with characters in one column and another column with numbers.

so my idea is to replace a dataframe characters with numbers related to dataframe b.

just let me know if any ref needed.


#4

As far as i can understood yuo want to replace values into one data frame from another.I have two data frames feat_df and mapping_tbl_df. i have done similar using below code, hope it helps:

AddCodesQuality<-function(xval)
{
library(sqldf)
val<-NULL
df=sqldf(paste(‘select Code from mapping_tbl_df where Quality=’’,xval,’’’,sep=""))
print(‘df in AddCodesQuality’)
val <- as.character((df$Code))
print(val)
return (val)
}
feat_df$Codes<-lapply(feat_df$Feautres,AddCodesQuality)


#6

May be you can loop over the data frame row by row and then by cell of that row and check when value of cell starts NA. This way you can achieve.


#7

thank u prakash but i am new to the coding part also…even no idea about the functions …so seeking for the help.