#Suppose

d=c(1,2,3)

#create a for loop

for (i in 1:3) print(d[i])

produces

[1] 1

[1] 2

[1] 3

How can I assign c1=1, c2=2, c3=3?

I have tried for(i in 1:3) c[i]=d[i] but it don't work :(

Printable View

- September 30th 2011, 03:07 AMnoob mathematicianhow to extract and assign value from a print output in R
#Suppose

d=c(1,2,3)

#create a for loop

for (i in 1:3) print(d[i])

produces

[1] 1

[1] 2

[1] 3

How can I assign c1=1, c2=2, c3=3?

I have tried for(i in 1:3) c[i]=d[i] but it don't work :(