Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- JMP User Community
- :
- Discussions
- :
- Re: duplicating elements in list

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Created:
Sep 10, 2020 1:30 PM
| Last Modified: Sep 10, 2020 1:31 PM
(212 views)

What's the easiest way to duplicate elements in a list

```
myListA = {"y"};
//Result I need:
myList = {"y", "y"};
// This should work with an arbitrary number of elements in the list
myListB = {"y1", "y2", "y3"};
//Results
myList = {"y1", "y2", "y3","y1", "y2", "y3"};
```

2 ACCEPTED SOLUTIONS

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Is this what you are looking for?

```
myListA={"y"};
myList = myListA || myListA;
```

Jim

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Another way:

```
Names Default to Here( 1 );
list = { "a", "b", "c" };
Repeat( list, 3 );
```

Learn it once, use it forever!

3 REPLIES 3

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Is this what you are looking for?

```
myListA={"y"};
myList = myListA || myListA;
```

Jim

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: duplicating elements in list

Yes, it was a workaround in my script to deal with this bug.

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Another way:

```
Names Default to Here( 1 );
list = { "a", "b", "c" };
Repeat( list, 3 );
```

Learn it once, use it forever!