简体   繁体   English

R - 我可以有一个行列数不同的矩阵吗?

[英]R - Can I have a matrix with different number of columns for rows?

This might be a stupid question.这可能是一个愚蠢的问题。 I have some 'NA' in a matrix, I need to put this matrix into jags model, but I want to remove those NA.我在矩阵中有一些“NA”,我需要将此矩阵放入锯齿 model 中,但我想删除那些 NA。 Can I remove only NA but keep the rest of the data?我可以只删除 NA 但保留数据的 rest 吗?

My data looked like the picture below.我的数据如下图所示。 Can I have rows with different column numbers?我可以有不同列号的行吗?

在此处输入图像描述

You cannot.你不能。

You need to impute these missing values or remote either the column or the row entirely.您需要估算这些缺失值或完全远程化列或行。

Imputing missing values is as complicated as you want it to be.估算缺失值与您希望的一样复杂。 You'd be best of looking into the first few google searches on the topic or just using the mean value of the column.您最好查看有关该主题的前几次 google 搜索,或者仅使用该列的平均值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM