1
我是生物學家,我正在嘗試使用R來分析我的數據。比較2個數據幀與任意數量的列和輸出在R
我有我的盤子,我在賽坦的位置上生長了我的細菌。所以我有兩個表格,我指出我的細菌正在增長(1)或不(0)。
# plate1
# K is a control column, A - E sample`s positions
K <- c(1, 0, 1, NA)
A <- c(1, 0, 1, 0)
B <- c(1, 0, 0, 1)
C <- c(0, 1, 0, 1)
D <- c(1, 0, 0, 1)
E <- c(1, 0, 0, 1)
plate1 <- data.frame(K, A, B, C, D, E) # creating a dataframe with all observations for the first plate
# plate2
K <- c(0, 0, 1, NA)
A <- c(1, 0, 0, 1)
B <- c(0, 1, 1, 0)
C <- c(1, 0, 1, 0)
D <- c(1, 0, 1, 0)
E <- c(0, 1, 0, 1)
plate2 <- data.frame(K, A, B, C, D, E) # creating a dataframe with all observations for the second plate.
我想問v提供兩種東西:
1)列的所有變量比較AE兩塊板(dataframes)
2)給我的輸出,其中我有位置1
(增長)plate1
和位置0
(無增長)爲plate2
。我希望它像一個新的dataframe
在那裏我有TRUE
和FALSE
取決於如果兩個位置符合我的條件
我相信,解決方案應該是很簡單,但我試圖超越但那裏的人建議使用merge
功能quiestions或不同的循環,並沒有成功。你能幫我完成這個任務嗎?我可以使用多個數據框嗎?
爲什麼選擇mapply? 'plate1 == plate2'? – zx8754
好問題:) – lukeA
哦,是的,這很簡單。我只是通過搜索答案而感到困惑。非常感謝! – makkreker