My sample data frame looks like below. I need to split the column into 2 based on a period(.) delimiter if exists, else the same value needs to be retained.
df_col1
server2.rty.com
datasserver
server1.rty.network
datasource
I have used the below code to split. This gives me NA for row 2 and 4 values(as there is no delimiter)
df%>%
extract(df_col1 , into = c("First_col", "Second_col"), "^([^.]+)\\.(.*)")
My expected output is
First_col Second_col
server2 rty.com
datasserver
server1 rty.network
datasource