我儿子的名字是...... 6
The name of my son is..... 6
我有一个非常简单的问题,我无法解释。我有这个玩具数据集:
> df3
name height team fun_index title age desc Y
1 Andrea 195 Lazio 97 6 33 eccellente 1
2 Paja 165 Fiorentina 87 6 31 deciso 1
3 Roro 190 Lazio 65 6 28 strano 0
4 Gioele 70 Lazio 100 0 2 simpatico 1
5 Cacio 170 Juventus 81 3 33 duro 0
6 Edola 171 Lazio 72 5 32 svampito 1
7 Salami 175 Inter 75 3 30 doppiopasso 1
8 Braugo 180 Inter 79 5 32 gjn 0
9 Benna 158 Juventus 80 6 28 esaurito 0
10 Riggio 182 Lazio 92 5 31 certezza 1
11 Giordano 185 Roma 79 5 29 buono 1
如果我想 select 与第 4 行相关的名称,我会这样做:
> df3$name[4]
[1] Gioele
Levels: Andrea Benna Braugo Cacio Edola Gioele Giordano Paja Riggio Roro Salami
我使用两种方法打印这些信息:
> paste("The name of my son is ",df3$name[4],".")
[1] "The name of my son is Gioele ."
> cat("The name of my son is ",df3$name[4],".")
The name of my son is 6 .
函数 cat()
出了点问题,但我不知道是什么。
它是一个 factor
class,将其转换为 character
应该可以工作
cat("The name of my son is ", as.character(df3$name[4]),".")
#The name of my son is Gioele .>
我有一个非常简单的问题,我无法解释。我有这个玩具数据集:
> df3
name height team fun_index title age desc Y
1 Andrea 195 Lazio 97 6 33 eccellente 1
2 Paja 165 Fiorentina 87 6 31 deciso 1
3 Roro 190 Lazio 65 6 28 strano 0
4 Gioele 70 Lazio 100 0 2 simpatico 1
5 Cacio 170 Juventus 81 3 33 duro 0
6 Edola 171 Lazio 72 5 32 svampito 1
7 Salami 175 Inter 75 3 30 doppiopasso 1
8 Braugo 180 Inter 79 5 32 gjn 0
9 Benna 158 Juventus 80 6 28 esaurito 0
10 Riggio 182 Lazio 92 5 31 certezza 1
11 Giordano 185 Roma 79 5 29 buono 1
如果我想 select 与第 4 行相关的名称,我会这样做:
> df3$name[4]
[1] Gioele
Levels: Andrea Benna Braugo Cacio Edola Gioele Giordano Paja Riggio Roro Salami
我使用两种方法打印这些信息:
> paste("The name of my son is ",df3$name[4],".")
[1] "The name of my son is Gioele ."
> cat("The name of my son is ",df3$name[4],".")
The name of my son is 6 .
函数 cat()
出了点问题,但我不知道是什么。
它是一个 factor
class,将其转换为 character
应该可以工作
cat("The name of my son is ", as.character(df3$name[4]),".")
#The name of my son is Gioele .>