Write a R program to assign NULL to a given list element.
l = list(1, 2, 3, 4, 5) print("Original list:") print(l) print("Set 2nd and 3rd elements to NULL") l[2] = list(NULL) l[3] = list(NULL) print(l)
Sample Output:
[1] "Original list:" [[1]] [1] 1 [[2]] [1] 2 [[3]] [1] 3 [[4]] [1] 4 [[5]] [1] 5 [1] "Set 2nd and 3rd elements to NULL" [[1]] [1] 1 [[2]] NULL [[3]] NULL [[4]] [1] 4 [[5]] [1] 5
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer