Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6715177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:35:00+00:00 2026-05-26T08:35:00+00:00

I need to create a pivot table in R that will have text values

  • 0

I need to create a pivot table in R that will have text values instead of aggregated SUM or AVERAGE functions. Something like in the example below:

Original table (in a dataframe with fields User, Field, Text):

User | Field | Text

Group1 | Field 1 | Text content A
Group1 | Field 2 | Text content B
Group2 | Field 1 | Text content C
Group2 | Field 2 | Text content D
Group3 | Field 1 | Text content E

The result that I need in R using cross tabulation:

User | Field 1 | Field 2

Group1 | Text content A | Text content B
Group2 | Text content C |Text content D
Group3 | Text content E |NA
I would then need to save the result as CSV… but that’s the easy part:)

Is there any way of achieving this?

Many thanks,
MA

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:35:01+00:00Added an answer on May 26, 2026 at 8:35 am

    This is what reshape (going from ‘long’ format to ‘wide’ format). Other people prefer the reshape package, but both will do for this simple case.

    Here’s a solution with the base function:

    tmp<-data.frame(user=c("G1", "G1", "G2", "G2", "G3"), field=c("F1", "F2", "F1", "F2", "F1"), txt=c("A", "B", "C", "D", "E"))
    reshape(data=tmp, direction="wide", timevar="field", idvar="user")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create an XML schema that looks something like this: <xs:element name=wrapperElement>
Is it any separated Control for create something like Pivot header? I need horizontal
I need populate with dummy values a table. I need create a random generated
Need to create a custom DNS name server using C which will check against
I need to create a backup of a SQL Server 2005 Database that's only
I need create a table to store Black listed IP address in case of
I have several *.sql files with script to create table and sprocs for a
Using Django 1.1, how could I create a crosstab (pivot table) SQL query using
I tried to create a pivot table created from a table in Oracle 10g.
I need to create a random array of int and have it sorted by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.