Search
 
SCRIPT & CODE EXAMPLE
 

R

r set dataframe column names

R> X <- data.frame(bad=1:3, worse=rnorm(3))
R> X
  bad     worse
1   1 -2.440467
2   2  1.320113
3   3 -0.306639
R> colnames(X) <- c("good", "better")
R> X
  good    better
1    1 -2.440467
2    2  1.320113
3    3 -0.306639
Comment

create a dataframe with column names in r

# This works well if you need an empty dataframe with n known columns
df <- data.frame(matrix(ncol = 3, nrow = 0))
x <- c("name", "age", "gender")
colnames(df) <- x
Comment

r set dataframe column names

R> colnames(X)[2] <- "superduper"
Comment

PREVIOUS NEXT
Code Example
R :: r - change column name 
R :: chi square critical value in r 
R :: turn matrix into dataframe r 
R :: custom function in r 
R :: how to do logistic regression in r 
R :: switch in r 
R :: null count in r 
R :: ggplot_regression_line 
R :: r variables 
R :: R remove commas 
R :: change all columns type in R 
R :: get matrix row name r 
R :: moving average in r 
R :: create list in r 
R :: convert int to character R 
R :: print percentage in r 
R :: run regression for certain groups in r 
R :: convert country code to country name in r 
R :: r code mutate 
R :: Now to find the r2 score 
R :: find sys date in R 
R :: how to rename variables in r 
R :: how to remove null values in r 
Rust :: rust field is never read remove warning 
Rust :: rust lang print in hex 
Rust :: actix web 
Rust :: rust•armanriazi•thread•unsafe 
Rust :: regex in rust 
Rust :: rust•armanriazi•error•[E0382]: use of moved value: `counter` value moved into closure here, in previous iteration of loop 
Rust :: armanriazi•rust•error•error[E0382]: borrow of moved value: `val` ... thread 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =