合并值与相应的ID r

时间:2015-11-07 22:40:48

标签: r

我有一个如下所示的数据框:

ID1 Value1  ID2 Value2  ID3 Value3
1   566771  1   566771  1   575619
2   660608  2   660608  3   666272
3   362294  4   362294  4   367169

我希望它看起来像这样:

ID1 Value1 Value2 Value3

如何合并它以便获取与ID1匹配的ID对应的值?

感谢。

1 个答案:

答案 0 :(得分:0)

也许

Post Domain Class

package com.therealdanvega.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.data.annotation.CreatedDate;


@Entity
public class Post {

    @Id @GeneratedValue
    private Long id;
    private String title;

    @Column(columnDefinition = "TEXT")
    private String body;

    @Column(columnDefinition = "TEXT")
    private String teaser;

    private String slug;

    @CreatedDate 
    @Temporal(TemporalType.TIMESTAMP)
    private Date postedOn;

    @ManyToOne
    private Author author;

    @SuppressWarnings("unused")
    private Post(){
    }

    public Post(String title){
        this.setTitle(title);
    }

    // getters & setters
}