如何将不同长度的向量存储到R中的矩阵中?

时间:2015-10-09 22:47:04

标签: r

假设我有一个不同长度的矢量列表,例如:

listToMatrix <- list(c(1,2,3,4),c(2,15,6),c(9,1,4,6,2,5))

问题是如何将此列表放入矩阵中(可以将空格保留为零),因为我想稍后对计算进行矢量化。

1 个答案:

答案 0 :(得分:0)

我们可以使用Session.OpenRequest openRequest = new Session.OpenRequest(Login.this); openRequest.setPermissions(Arrays.asList("email", "user_birthday")); openRequest.setCallback(new Session.StatusCallback() { // callback when session changes state @Override public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { // make request to the /me API Request request = Request.newMeRequest(session, new Request.GraphUserCallback() { // callback after Graph API response with user // object @Override public void onCompleted(GraphUser gUser, Response response) { if (gUser != null) { String email = gUser.getProperty("email").toString(); String firstName = gUser.getFirstName(); String lastName = gUser.getLastName(); String username = gUser.getUsername(); String birthday = gUser.getBirthday(); } } }); request.executeAsync(); } } } ); 中的stri_list2matrix。我们将输出转换为library(stringi)并将尺寸更改为输出矩阵(&#39; m1&#39;)。

numeric