I tried to save screen text to a file by using the sink() function. The file was created but without any data inside it.What did I do wrong? Here my toy code:
sink("sink3.txt")
df <- read.table(text = " color birds wolfs
red 9 7
red 8 4
red 2 8
red 2 3
black 8 3
black 1 2
black 7 16
black 1 5
black 17 7
black 8 7
black 2 7
green 20 3
green 6 3
green 1 1
green 3 11
green 30 1 ",header = TRUE)
lm<-lm(birds ~ color + wolfs , data = df)
summary(lm)
sink()