Answers for "convert first row to header in r"

R
0

make the first row as header in r

dat <- dat[-1,]
Posted by: Guest on June-21-2020
0

convert first row to header in r

header.true <- function(df) {
  names(df) <- as.character(unlist(df[1,]))
  df[-1,]
}
Posted by: Guest on June-21-2020
0

make the first row as header in r

names(dat) <- dat[1,]
Posted by: Guest on June-21-2020
0

make the first row as header in r

names(dat) <- as.matrix(dat[1, ])
dat <- dat[-1, ]
dat[] <- lapply(dat, function(x) type.convert(as.character(x)))
dat
##     Zip CuCurrent PaCurrent PoCurrent      Contact Ext          Fax email Status
## 1 74136         0         1         0 918-491-6998   0 918-491-6659     0      1
## 2 30329         1         0         0 404-321-5711   0            0     0      1
## 3 74136         1         0         0 918-523-2516   0 918-523-2522     0      1
## 4 80203         0         1         0 303-864-1919   0            0     0      1
## 5 80120         1         0         0 345-098-8890 456            0     0      1
Posted by: Guest on June-21-2020

Code answers related to "convert first row to header in r"

Browse Popular Code Answers by Language