将多个不完整的列“汇总”为1个汇总列

时间:2019-03-05 10:55:45

标签: r r-base

我正在尝试使用R来合并来自不同数据集的数据,方法是:

System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed. at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine) at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine) at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller) at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at SMTP.Contact.btnSubmit_Click(Object sender, EventArgs e) 

合并之后,我显然拥有完整的ID列,而其他列则充满了NA。

一般来说这很好,但是这次我需要生成另一个列,该列保留前面3列中分析的每个值。

  MailMessage mailMessage = new MailMessage();
            mailMessage.From = new MailAddress("abc@abc.com");
            mailMessage.To.Add("abc@abc.com");
            mailMessage.Subject = "TEST";

            mailMessage.Body = "Testing";
            mailMessage.IsBodyHtml = true;

            SmtpClient smtpClient = new SmtpClient("123.123.123", 25);
            smtpClient.Send(mailMessage);
            lblResult.Text = "Your message was sent!";

我要搜索的输出是:

merge(x,y, all=T, by="ID")

执行此操作的最佳策略是什么?我可以用其他方式合并它们吗?

如果解决方案足够简单,我想保留它,并停留在R基中。

编辑:

documentation帖子有类似的问题,我尝试应用此解决方案:

    Findings.x  Findings.y
1         <NA> Decreases
2   Increases       <NA>
3         <NA> Decreases 
4   Increases       <NA>
5         <NA> Increases 
6   Increases       <NA>
7         <NA> Decreases 

但是我的行不是数字行,所以行不通。

编辑2

同一帖子的此解决方案解决了该问题:

Findings.summary
1   Decreases
2   Increases
3   Decreases
4   Increases
5   Increases
6   Increases
7   Decreases

如果您有更好的解决方案,请告诉我。

0 个答案:

没有答案