Transpose some columns in lines

Here is code that performs the transformation you described. Please note how I provide runnable code, including the starting data. use of dput() and or datapasta package supports this as per the reprex guide.

df1 <- data.frame(
  stringsAsFactors = FALSE,
  Id = c(42, 102, 14),
  name = c("james", "cathy", "david"),
  idSale1 = c(698, 574, 450),
  saleAmount1 = c(30, 120, 70),
  idSale2 = c(1002, 708, NA),
  saleAmount2 = c(100, 40, NA)
)

library(tidyverse)
pivot_longer(df1 %>% rename(clientname=name),
             cols = contains("ale"),
             names_pattern = "([A-Za-z]*)(\\d)",
             names_to = c("text","num"),
             names_repair = "unique") %>% 
  pivot_wider(id_cols = c("Id","clientname","num"),
              names_from = "text",
              values_from = "value") %>% select(-num) %>% 
  na.omit()