Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paste() problem #23

Open
RobinHankin opened this issue Jul 8, 2021 · 4 comments
Open

paste() problem #23

RobinHankin opened this issue Jul 8, 2021 · 4 comments

Comments

@RobinHankin
Copy link
Owner

Look:

paste(disord(letters),"3",sep="")
 [1] "a3" "b3" "c3" "d3" "e3" "f3" "g3" "h3" "i3" "j3" "k3" "l3" "m3" "n3" "o3"
[16] "p3" "q3" "r3" "s3" "t3" "u3" "v3" "w3" "x3" "y3" "z3"
> 

the output should be a disord object, not a vector.

@RobinHankin
Copy link
Owner Author

Following shows what we want paste() to do:

> l <- disord(letters)
> disord(paste(elements(l),"3",sep="_"),h=hash(l))
A disord object with hash 005ae317c931561a05b53fcfa860d7ac61dfec85 and elements
 [1] "a_3" "b_3" "c_3" "d_3" "e_3" "f_3" "g_3" "h_3" "i_3" "j_3" "k_3" "l_3"
[13] "m_3" "n_3" "o_3" "p_3" "q_3" "r_3" "s_3" "t_3" "u_3" "v_3" "w_3" "x_3"
[25] "y_3" "z_3"
(in some order)
> 

@RobinHankin
Copy link
Owner Author

There is some documentation at ?dotsMethods which might help.

@RobinHankin
Copy link
Owner Author

Look:

paste(disord(letters),disord(LETTERS))
 [1] "a A" "b B" "c C" "d D" "e E" "f F" "g G" "h H" "i I" "j J" "k K" "l L"
[13] "m M" "n N" "o O" "p P" "q Q" "r R" "s S" "t T" "u U" "v V" "w W" "x X"
[25] "y Y" "z Z"
> 

This should (of course) return an error.

@RobinHankin
Copy link
Owner Author

Also:

 paste(letters,collapse="_")
[1] "a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_y_z"
 paste(disord(letters),collapse="_")
[1] "a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_y_z"

The first line is fine (of course), but the second line should return an error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant