Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • collapse string vector to scalar x[1]+" "+x[2]+" "+...+" "+x[length(x)]

    I am trying to construct a local from a mata vector of strings. Unfortunately, st_local(lname,lvalue) demands a scalar for both arguments. That's why I'm looking to perform the operation in the title.

    I know that I can construct the object in the title in a loop, but am wondering if there is a built-in analogue to Reduce(binary_function, vector) available in other languages...? (That's the exact syntax for the function in R, but I think Reduce comes from elsewhere in computer science.)

  • #2
    Code:
    st_local(lname, invtokens(lvalue))
    Last edited by Jeff Pitblado (StataCorp); 12 Mar 2015, 11:24.

    Comment


    • #3
      Cool, thank you Jeff; I'll use that. Is there no general approach that behaves like Reduce() (other than a loop), then?

      Comment

      Working...
      X