The functions cbind and rbind are S3 generic, with methods for data frames. The data frame method will be used if at least one argument is a data frame and the rest are vectors or matrices. There can be other methods; in particular, there is one for time series objects. See the section on ‘Dispatch’ for how the method to be used is selected.
Questions tagged [cbind]
450 questions
0
votes
1 answer
Loop with column binding
I am self-taught useR so please bear with me.
I have something similar the following dataset:
individual value
a 0.917741317
a 0.689673689
a 0.846208486
b 0.439198006
b 0.366260159
b 0.689985484
c 0.703381117
c 0.29467743
c …

user3507584
- 3,246
- 5
- 42
- 66
0
votes
2 answers
R Date / List Problems
I'm having trouble manipulating some data in R. I have a data frame containing info. relating to customer transactions. I extract the minimum date as follows,
hold <- (lapply(with(train_train, split(date,id)),min)) # minimum date
Giving me the…

aspaceo
- 45
- 1
- 3
0
votes
2 answers
How to export data in text file using R in the correct format?
I have 3 data variables created in R with the following information in each
Variable 1: coordinate
x y
0.1 0.1
Variable 2: mz
100.0
100.1
100.2
100.3
....
....
999.9
Variable 3: intensity
4.533154e-01
2.997068e-01
4.542300e-01 …

novicegeek
- 773
- 2
- 9
- 29
0
votes
3 answers
cbind with row names to several files
I would like to use the cbind in a list of files. However each file are splited in a specific chromosome (chr) (k in 1:29), and specific sample (i in 1:777). The files are like:
sample1chr1.txt, sample1chr2.txt ... sample1chr29.txt, sample2chr1.txt…

user3091668
- 2,230
- 6
- 25
- 42
0
votes
2 answers
Merge a list of dataframes together by column value
I have a list of dataframes df_list that looks like this:
head(df_list[[1]])
score name rank
921 9718 aba 921
346 11387 aca 346
head(df_list[[2]]
score name rank
1080 9023 aba 1080
156 12276 aca…

Niek de Klein
- 8,524
- 20
- 72
- 143
0
votes
1 answer
listing files in different directories which have same file naming format [R]
I want to cbind several files together using:
do.call("cbind",lapply(sample_list, FUN=function(files){read.table(files, header=TRUE, sep="\t", stringsAsFactors=FALSE)}))
However, my sample_list files (eg, 1c.QC.dat) are in different directories. …

user2726449
- 607
- 4
- 11
- 23
0
votes
1 answer
Inputing dates in vector on R
When I input dates on R using the code
day1<- as.Date("1999-03-12")
dates<-as.Date(day1+interval)
these codes output a list of dates, however when I use the code
cbind(x, dates)
The dates don't appear as dates, does anyone know how I can put this…

Kate
- 127
- 1
- 4
0
votes
1 answer
If there is the same nrows cbind two datas
How to tell R to cbind two matrix only if they have the same number of rows ?
I know that I can check it manually.

Shaxi Liver
- 1,052
- 3
- 25
- 47
0
votes
1 answer
R return p-value from glm within cbind
Statistics and R noob wondering if there is there a way to add p-values from a glm onto the end of the output resulting from the following command:
exp(cbind(OR = coef(mod1), confint(mod1)))
Perhaps something like:
summary(mod1)$coefficients[,4]
I…

L Tyrone
- 1,268
- 3
- 15
- 24
0
votes
0 answers
want to automate cbind in R
my code:
orders column one of new data frame by column two of previous data frame
matchOrder<- function(x,y){
y[match(x[,2], y[,1]),];
}
orders column one of new data frame by column one of previous data frame
matchOrder1<- function(x,y){
…

Chad
- 149
- 4
- 11
0
votes
3 answers
how to merge stock data from two different sets?
I have two data sets, AAPL and AMZN, that I wish two merge but find it difficult to do so as merge cbind fail to do as I desire it to be. I believe the issues is recognizing the data sets as data.frames but not sure.
The data looks like this:
…

Jason
- 311
- 1
- 4
- 14
0
votes
0 answers
cbind and lapply for dynamic columns appending
I'm trying to add columns to a data frame dinamycally using cbind and lapply
to illustrate a problem I will do it wihtout lapply
> c1 <- c(1,2)
> c2 <- c(3,4)
>
> source = data.frame(c1, c2)
>
> source
c1 c2
1 1 3
2 2 4
>
> names = c("c1",…

Oleg K
- 1
- 1
0
votes
2 answers
Matching one value against all values in a dataframe, in iteration based on criteria
This is a small section of my actual data set.
1 2 3 4 5
57.033 57.0332 57.0333 57.0339 57.03332
57.033 57.033 57.0335 59.0490 59.04901
59.0489 59.048 …

user2698508
- 35
- 8
0
votes
1 answer
combine fields in one list in R
I have a list in R looks like, mylist$a, mylist$b, mylist$c, ..., mylist$z. Is there a easier way to combine all those fields of the list into one variable rather then typing a command like cbind(mylist$a,mylist$b,...,mylist$z)?
P.S. All sub-fields…

lolibility
- 2,187
- 6
- 25
- 45
0
votes
1 answer
How to use a vector of strings to call dataframe columns by its header
In R, I want to use a subset of a dataframe 'RL', by selecting specific headers (eg. 'RL$age01' etc.. I generate the selected headers as a vector of strigs:
v = c('ID', sprintf("sex%02d", seq(1,15)), sprintf("age%02d", seq(1,15)))
and the dataframe…

rlue
- 3
- 2