R- Convert data into matrix format same as other matrix -


I have data in Excel:

  Terms range weight email TV 1.00 acccount email 12.0 Accept phone 3.00   

I have other metrics and its format is:

  Terms TV Email Phone Contact Information Help ..... 1 Do it. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>  

Now I want to convert the above data into the format like That

  Rule Tv Email Support to contact the phone email ..... email 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   

I want to do that any help in R will be appreciated. thank you in advanced.

You have to resize your data. If you do not already have it, then install the package "reshape2"

There is a code here to deny your data again

  is needed (reshape2) Df.reshape & lt; -melt (Df, id.var = c ("conditions", "category")) # where DF is your data. To repeat the string, use the # two words and classes to create the id variable # df.wide and lt; -Document (df.reshape, terms ~ category)   

Note that this will give you NA for the pair that does not exist in your data.

If you want you can easily change with zero

and reshape2 here to use a good Tutorial is

Comments

Popular posts from this blog

asp.net - Procedure or function "Procedure name" expects a parameter "Param name" which was not supplied occurs rarely -

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -

sql server ce - Is there some way to make sqlce3.5 and 4.0 co-exist in the C# project -