The answer depends on how your cluster information is stored. As this hasn't been specified, I can only offer general guidelines.
For example, is cluster information is saved as a vector of case numbers from a data frame? For example, if cluster_1 = c(32, 95, 104, 215, 307) where "32" means case #32 in the data frame or matrix. In this case, just copy the vector to a new vector with the desired name: x = cluster_1.
Is cluster information saved as a data frame? For example, columns represent the clusters (1, 2, ... k), rows represent cases (1, 2, ... N or 0, 1, ... N - 1) and values are nominal for cluster membership (0/1 or FALSE/TRUE)? In this case, rename the columns with the desired names, e.g., colnames(X) = c('x', 'y', 'z'), where "X" is the target data frame.
Do you mean, within the output of a specific R library function (e.g., hclust)? The answer will depend on the specific function and its restrictions. You can always start with the command, help(name_of_library_function), to access information about that function, e.g., help(hclust).
To change cluster names from numerical labels (e.g., 1, 2, 3) to custom labels (e.g., x, y, z) in RStudio, you can use the factor function. Assuming your data frame is named your_data with a column named cluster containing numerical labels, create a vector of custom labels (e.g., c("x", "y", "z")) and then use the factor function to convert the cluster variable to a factor with these custom labels. This operation ensures that the cluster names are replaced with the desired labels in an efficient manner. Adjust the variable and column names based on your specific data structure.