Questions tagged [cbind]

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.

450 questions
0
votes
1 answer

How to remove row of intercepts/only include the coefficients in a cbind of lm data by indexing? Why does it work?

I managed to remove the first row of the matrix from what I learned from digging around this website, but apparently there's an easier way to do it. This is what I currently have: > prestige.income <- lm(prestige ~ log2(income), data=Prestige) >…
0
votes
3 answers

R dataframe create

I have a data frame in R, say f1. I want to create another data frame f2 which has the column names(header) in f1 as f2's row names. I know there are 300 names in f1, and want to assign color "#ff0000" to the first 200 and color "#0000ff" to the…
lolibility
  • 2,187
  • 6
  • 25
  • 45
0
votes
1 answer

cbind in R - putting values, getting level indices

I think my question is somewhat similar to this one. cbind is changing the values of the vector I am using (or using references to the values) I am basically getting data from a data frame and then organizing them in columns according to a certain…
0
votes
0 answers

Merging/cbinding .xts objects gives misaligned NAs

It seems this issue's not been solved yet, isn't it? Reproducible code: install.packages('quantmod') install.packages('rugarch') require(quantmod) getSymbols('GLD', from = '1950-01-01') dx <- na.omit(ClCl(to.weekly(GLD))) require(rugarch) spec <-…
Lisa Ann
  • 3,345
  • 6
  • 31
  • 42
-1
votes
1 answer

Keep one column after cbind two dataframe

These are my two data frames dput(head(C1_com)) structure(list(Term = c("GO:0030198", "GO:0043062", "GO:0001944", "GO:0072358", "GO:0001568", "GO:0048514"), LogP = c(-17.4296193682, -16.3090192653, -17.0759726333, -17.0759726333, -15.9170353092,…
PesKchan
  • 868
  • 6
  • 14
-1
votes
2 answers

I would like to add a date column to my data frame. The date column needs to populate automatically for the full length of the column

I would like to add a date column to a data frame. The date column needs to populate automatically for the full length of the column. See example below: enter image description here Data frame: df = structure(list(Name = c("Joe", "Sanj", "Rob"), …
-1
votes
1 answer

I want to see study name but it gave me numbers instead?

I am doing meta-analysis between 2 arms using meta package and used subset if number of events are available in all comparison arms but I got weird results (NA in some cells) then I tried to investigate the cause using the following…
Mohamed Rahouma
  • 1,084
  • 9
  • 20
-1
votes
1 answer

How to fill all combinations from a matrix to two columns

I'm doing this: data.2<- rbind( cbind(data[,1], data[,2]), cbind(data[,1], data[,3]), cbind(data[,1], data[,4]), cbind(data[,1], data[,5]), cbind(data[,1], data[,6]), cbind(data[,1], data[,7]), cbind(data[,1], data[,8]), cbind(data[,1],…
Chris
  • 156
  • 1
  • 1
  • 9
-1
votes
1 answer

Create a new column based on an index column with error

I am referring to a previous question:- Create a new column based on an index column I've tried few conversions to convert into tibble but still hitting the following error: > Can't use matrix or array for column indexing Need to create the NewCol…
kengfui
  • 1
  • 2
-1
votes
1 answer

cbind function with yearly vectors

for(t in 1921:2017) { nam <- paste("", t, sep = "") assign(nam, window(aCPI_gr, start=c(t,1), end=c(t,12))) } aCPI_gr_y <- cbind(`1921`: `2017`) #doesn't work This loop is generating vectors with CPI data from every month per year. Now i would…
yaennu
  • 85
  • 1
  • 9
-1
votes
1 answer

Error in Dataframe : arguments implying different number of arguments

my data frame had many outliers in each column / variable. I removed them using Boxplot / IQR cut-off for 75% / 25%. I took out each column and removed outliers from them. Therefore, each column has different number of values in it. Now I want to…
Osro_db40
  • 23
  • 9
-1
votes
1 answer

rowr::cbind.fill() changes characters value to numeric

I have two variables date and referencenumber. Both are extracted from a text string, with the use of a regular expression. They both have the class character. When I use the cbind.fill function to combine these variables in an already excising…
Jelmer
  • 351
  • 1
  • 15
-1
votes
1 answer

How to combine a column from a data table to panel data structure

I have been working with a large panel data set. My simple data set look like below. +--------+------+------+-----+-----+--------+ | Time | Firm | Land | Lab | Cap | GL | +--------+------+------+-----+-----+--------+ | Jan-00 | A | 25…
Doo
  • 29
  • 7
-1
votes
1 answer

Plotting data in a list in R

I have a bunch of .csv files that I want to read into a list, then create plots. I've tried the code below, but get an error when trying to cbind. Below is the dput from 2 example files. Each file represents weather data from seperate stations.…
derelict
  • 3,657
  • 3
  • 24
  • 29
-1
votes
1 answer

Shifting Column Selection in Dataframe in R

I have a data frame with 30 columns. My goal is to select 5 columns at a time. Based on a condition, I want to shift my selection in the data frame 5 columns. For example: Original dataframe column selection: Col6 Col7 Col8 Col9 Col10 If…
Nick
  • 833
  • 2
  • 8
  • 11
1 2 3
29
30