Appending values to a vector - R

0 votes

I am new to R programming and want to append new values to this vector:

num1<-c(1,2,3)

I would want to append the numbers from 4-10 this vector

May 15, 2018 in Data Analytics by DataKing99
• 8,100 points
35 views

1 answer to this question.

0 votes

This is actually quite easy, all you have to do is add this vector along with the new numbers back to the same object:

num1<-c(num1,4,5,6,7,8,9,10)
num1
 [1]  1  2  3  4  5  6  7  8  9 10
answered May 15, 2018 by Bharani
• 4,550 points

Related Questions In Data Analytics

0 votes
1 answer

How to write a custom function which will replace all the missing values in a vector with the mean of values in R?

Consider this vector: a<-c(1,2,3,NA,4,5,NA,NA) Write the function to impute ...READ MORE

answered Jul 4, 2018 in Data Analytics by CodingByHeart77
• 3,680 points
111 views
0 votes
1 answer

How can I delete multiple values from a vector in R?

The %in% operator tells  which elements are ...READ MORE

answered Apr 26, 2018 in Data Analytics by shams
• 3,580 points
89 views
0 votes
1 answer

How to extract every nth element of a vector using R?

m <- 1:50 n<- m[seq(1, length(m), 6)] The above ...READ MORE

answered May 14, 2018 in Data Analytics by zombie
• 3,690 points
3,519 views
0 votes
3 answers

Code snippet to find number of null values in each column in a dataframe in R

colSums(is.na(data_frame_name)) will return you number of nulls ...READ MORE

answered Jul 5 in Data Analytics by sindhu
36 views
0 votes
1 answer

How to count the number of elements with the values in a vector?

You have various options to count the ...READ MORE

answered Apr 12, 2018 in Data Analytics by darklord
• 6,140 points
78 views
0 votes
4 answers

How to remove NA values from a Vector in R?

You can try na.omit() or na.exclude() too. ...READ MORE

answered Jul 31 in Data Analytics by anonymous
• 19,510 points
5,253 views
0 votes
1 answer

Joining 2 vectors into 1 variable - R

A small trick that you can do ...READ MORE

answered Jul 4 in Data Analytics by anonymous
• 19,510 points
15 views
0 votes
1 answer

how to get the count of non zero values in a row

In first part you should solve the ...READ MORE

answered Apr 4, 2018 in Tableau by Atul
• 10,240 points
119 views
+1 vote
2 answers

Custom Function to replace missing values in a vector with the mean of values

Try this. lapply(a,function(x){ifelse(is.na(x),mean(a,na.rm = TRUE) ...READ MORE

answered 3 days ago in Data Analytics by anonymous
63 views
0 votes
1 answer

Converting a string to title case - R

library(tools) toTitleCase("this is sparta") [1] "this is Sparta" READ MORE

answered May 18, 2018 in Data Analytics by Bharani
• 4,550 points
96 views