所以这是我的代码:
Gap <- read.xls(file.choose(), header=TRUE)
head(Gap)
tail(Gap)
attach(Gap)
summary(Gap$TotalPop)
summary(Gap$ChildMor)
#Median Child Mortality is 16.9 0-5 Child Deaths per 1,000 born
summary(Gap$GDP)
#Median GDP per capita in $PPP ()inflation adjusted) is $11,750
options(scipen=999)
print.table (c(Gap$GDP) * (Gap$TotalPop), Gap$Region)
我需要做的是在输出中打印出2列,一个GDP * TotalPop和一个国家名称(&#34; Region&#34;)。问题在于,出于某种原因,R正在读取我的地区名称(字母)为数字1-144而不是实际名称?
答案 0 :(得分:1)
你可以做到
product <- Gap$GDP * Gap$TotalPop
country <- Gap$Region
print(paste(c(product, country))