i am using the tidyverse package and working with the pipe term "%>%"
how ever after using it on multiple functions i seem to get an error(can not find function ) -.-^and i did not find any info on this on term ("%>%<-") in the net.
#AB1
df_1$AB1<- ifelse(df_1$AB1==1 , 1 ,
ifelse(df_1$AB1== 2, as.integer(-1),
ifelse(df_1$AB1== 3, 0,
ifelse(df_1$AB1== 4,0,NA)))) %>%
#AB2
df_1$AB2<- ifelse(df_1$AB2==1 , 1 ,
ifelse(df_1$AB2== 2, as.integer(-1),
ifelse(df_1$AB2== 3, 0,
ifelse(df_1$AB2== 4,0,NA))))
i have tried canging the dataframe to df_2 f.e. or to remove the seconddf_1$AB2<-
#AB1
df_1$AB1<- ifelse(df_1$AB1==1 , 1 ,
ifelse(df_1$AB1== 2, as.integer(-1),
ifelse(df_1$AB1== 3, 0,
ifelse(df_1$AB1== 4,0,NA)))) %>%
#AB2
ifelse(df_1$AB2==1 , 1 ,
ifelse(df_1$AB2== 2, as.integer(-1),
ifelse(df_1$AB2== 3, 0,
ifelse(df_1$AB2== 4,0,NA))))
seems like i do not realy get the pipe thing. i wanted to make R run both functions after eaach other but it does not seem wo work? Is there a way to save some time since i would like to avoid going "ctrl" +"r" on many diffrent functions each time i want to change my data in this way.
Bests regards and ty for taking looking at this !
question from:
https://stackoverflow.com/questions/66050679/issue-with-using-pipe-for-multiple-ifelse-functions 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…