r - how to use gather_ in tidyr with variables -


After

I am using tidyr together and need to use dynamic value in tidyr operation with shiny and therefore. Although I have trouble using the collected (), which I think was designed for such a case. At least the example below:

  Library (tidyr) df & lt; - data.frame (name = letter [1: 5], v1 = 1: 5, v2 = 10: 14, v3 = 7 'quantity' dyn_err & lt; - -; v3) dyn_1 & lt; - 'remedy' dyn_2 & lt 'v1: v3';: 11, stringsAsFactors = false) #works fine df% & gt% (measure, volume, v1 collect dyn_err_1 & lt; - 'v1' dyn_err_2 & lt; - 'V2' #Error df% & gt;% gather_ (dyn_1, dyn_2, dyn_err) #Error df% & gt;% gather_ (dyn_1, dyn_2, dyn_err_1: dyn_err_2)  

something After debug I realized that there was an error in the faulty measurement part of the part, but I do not know how to work with ':'. Please help with the solution and understand a little bit more You can learn more.

After

come You are saying the collected_color column 'v1: v3' to separate column ID not directly into words; dyn_err & lt; - "v1: v 3 ". dyn_err & lt; - Paste (" V ", seq (3) September =" ")

If you type df Have different column names (such as var_a, qtr_b, stg_c), you can either remove those column names or use the paste function for any variable.

  dyn_err & lt; - Colnames (df) [2: 4]  

or

  dyn_err & lt; - Paste (C ("var", "qtr", "stg"), characters [1: 3], sep = "_")  

You will see the columns for the names you want Want and create vector related.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -