是否有对此R函数merge()错误的解释?

时间:2019-05-03 14:03:12

标签: r dataframe

我正在尝试使用R merge函数来合并两个data.frame,但是始终出现以下错误:

  

fix.by(by.y,y)中的错误:“ by”必须指定唯一有效的列

我不确定此错误的含义或解决方法。

到目前为止,我的代码如下:


movies <- read_csv("movies.csv")

firsts = vector(length = nrow(movies))
for (i in 1:nrow(movies)) {
  firsts[i] = movies$director[i] %>% str_split(" ", n = 2) %>% unlist %>% .[1]
}

movies$firsts = firsts

movies <- movies[-c(137, 147, 211, 312, 428, 439, 481, 555, 602, 830, 850, 1045, 1080, 1082, 1085, 1096, 1255, 1258, 1286, 1293, 1318, 1382, 1441, 1456, 1494, 1509, 1703, 1719, 1735, 1944, 1968, 1974, 1977, 2098, 2197, 2409, 2516, 2546, 2722, 2751, 2988, 3191,
3227, 3270, 3283, 3285, 3286, 3292, 3413, 3423, 3470, 3480, 3511, 3676, 3698, 3826, 3915, 3923, 3954, 4165, 4381, 4385, 4390, 4397, 4573, 4711, 4729, 4774, 4813, 4967, 4974, 5018, 5056, 5258, 5331, 5405, 5450, 5469, 5481, 4573, 5708, 5715, 5786, 5886, 5888, 5933, 5934, 6052, 6091, 6201, 6234, 6236, 6511, 6544, 6551, 6562, 6803, 4052, 4121, 4326),]
movies <- movies[-c(4521,5846),]

g <- gender_df(movies, name_col = "firsts", year_col = "year", method = c("ssa"))

merge(movies, g, by = c("firsts", "name"), all = FALSE)

1 个答案:

答案 0 :(得分:0)

我认为您正在尝试为java.lang.SecurityException: JCE cannot authenticate the provider BC javax.crypto.Cipher.getInstance(DashoA13*..) org.bouncycastle.jcajce.util.ProviderJcaJceHelper.createCipher(Unknown Source) org.bouncycastle.tls.crypto.impl.jcajce.JcaTlsCrypto.hasEncryptionAlgorithm(Unknown Source) org.bouncycastle.tls.TlsUtils.isSupportedCipherSuite(Unknown Source) org.bouncycastle.tls.TlsUtils.getSupportedCipherSuites(Unknown Source) org.bouncycastle.jsse.provider.ProvTlsClient.getSupportedCipherSuites(Unknown Source) org.bouncycastle.tls.AbstractTlsClient.init(Unknown Source) org.bouncycastle.tls.TlsClientProtocol.connect(Unknown Source) org.bouncycastle.jsse.provider.ProvSSLSocketDirect.startHandshake(Unknown Source) org.bouncycastle.jsse.provider.ProvSSLSocketDirect.startHandshake(Unknown Source) sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434) sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:167) sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1031) sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230) org.jasig.cas.client.validation.Saml11TicketValidator.retrieveResponseFromServer(Saml11TicketValidator.java:216) Caused by: java.util.jar.JarException: Cannot parse jar:file:/opt/jboss-5.1.0.GA/server/default/deploy/myapp.war/WEB-INF/lib/bcprov-jdk15on-1.61.jar!/ javax.crypto.SunJCE_c.a(DashoA13*..) javax.crypto.SunJCE_b.b(DashoA13*..) javax.crypto.SunJCE_b.a(DashoA13*..) javax.crypto.Cipher.getInstance(DashoA13*..) org.bouncycastle.jcajce.util.ProviderJcaJceHelper.createCipher(Unknown Source) org.bouncycastle.tls.crypto.impl.jcajce.JcaTlsCrypto.hasEncryptionAlgorithm(Unknown Source) org.bouncycastle.tls.TlsUtils.isSupportedCipherSuite(Unknown Source) org.bouncycastle.tls.TlsUtils.getSupportedCipherSuites(Unknown Source) org.bouncycastle.jsse.provider.ProvTlsClient.getSupportedCipherSuites(Unknown Source) org.bouncycastle.tls.AbstractTlsClient.init(Unknown Source) org.bouncycastle.tls.TlsClientProtocol.connect(Unknown Source) org.bouncycastle.jsse.provider.ProvSSLSocketDirect.startHandshake(Unknown Source) org.bouncycastle.jsse.provider.ProvSSLSocketDirect.startHandshake(Unknown Source) sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434) sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:167) sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1031) sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230) org.jasig.cas.client.validation.Saml11TicketValidator.retrieveResponseFromServer(Saml11TicketValidator.java:216) 参数提供无效的值。确实,该文档告诉您:

  

默认情况下,数据框在列上合并,其名称为   都有,但是可以通过   x和x。两个数据框中与行上匹配的行   提取指定的列,并将其连接在一起。如果还有更多   一场比赛之外,所有可能的比赛各贡献一行。为了   “匹配”的确切含义,请参见匹配。

对于您而言,您应尝试以下操作:

by