country_data = array(c(40000,12000,3,0.5,20000,1300000,2.3,5),c(2,2,2),
dimnames = list(c('US','India'),c('Population','GDP'),c(2001,2023)))
country_data
country_data['India','GDP','2001']
country_data['US','Population','2023']
# to fetch the dimension in country_data array
dimnames(country_data)
#dimnames is having 3 array 1st = 'Rows', 2nd = Coulmn, 3rd = matrix names
#to change the matrix name
dimnames(country_data)[[3]] = c('1997','2022')
country_data
#to change th Rows for array
dimnames(country_data)[[1]] = c('Austraila','Rusia')
country_data
#extract number of rows from array or matrix
nrow(country_data)
nrow(country_data[,,1])
#extract number of columns from array or matrix
ncol(country_data)
ncol(country_data[,,2])
print('')
print('')
print('how to delete columns or rows or matrix from array')
country_data
print('')
print('deleting matrix')
country_data[,,-c(1)]
print('')
country_data[,,-c(2)]
print('')
print('deleting rows')
country_data[-c(1),,]
print('')
country_data[-c(2),,]
print('')
print('Deleting columns')
country_data[,-c(1),]
print('')
country_data[,-c(2),]
To embed this project on your website, copy the following code and paste it into your website's HTML: