r 合并范tabellen

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了r 合并范tabellen相关的知识,希望对你有一定的参考价值。

# By using the merge function and its optional parameters:

#Inner join: merge(df1, df2) will work for these examples because R automatically 
#joins the frames by common variable names, but you would most likely want to 
#specify merge(df1, df2, by = "CustomerId") to make sure that you were matching 
#on only the fields you desired. You can also use the by.x and by.y parameters if 
#the matching variables have different names in the different data frames.

Outer join: merge(x = df1, y = df2, by = "CustomerId", all = TRUE)

Left outer: merge(x = df1, y = df2, by = "CustomerId", all.x = TRUE)

Right outer: merge(x = df1, y = df2, by = "CustomerId", all.y = TRUE)

Cross join: merge(x = df1, y = df2, by = NULL)


# Just as with the inner join, you would probably want to explicitly pass 
# "CustomerId" to R as the matching variable. I think it's almost always best to 
# explicitly state the identifiers on which you want to merge; it's safer if the 
# input data.frames change unexpectedly and easier to read later on.

# You can merge on multiple columns by giving by a vector, e.g.,
# by = c("CustomerId", "OrderId").

# If the column names to merge on are not the same, you can specify, e.g., 
# by.x = "CustomerId_in_df1",by.y = "CustomerId_in_df2"whereCustomerId_in_df1is 
# the name of the column in the first data frame and 
# CustomerId_in_df2` is the name of the column in the second data frame. 
# (These can also be vectors if you need to merge on multiple columns.)
# merge two data frames by ID
total <- merge(data frameA,data frameB,by="ID")

# merge two data frames by ID and Country
total <- merge(data frameA,data frameB,by=c("ID","Country"))

以上是关于r 合并范tabellen的主要内容,如果未能解决你的问题,请参考以下文章

sql Tabellen auflisten

向量范数和矩阵范数

矩阵范数

范数的对偶以及几何性质

常见的一些范数及其应用场景,如L0,L1,L2,L∞,Frobenius范数

R语言数据合并-cbind(),rbind