Forums | OpenR

OpenR: R & Statistics /
questions about '下标出界'


Zhongzheng Mao's profile picture
Posts: 8

18 March 2022, 12:15 PM

I use 3 to 6 columns in penguins.csv to perform cca, but it just shows this

> penguin <- read.csv('penguins.csv')
> penguin2<-scale(penguin[,3:6])
> x<-penguin2[,3:4]
> y<-penguin2[,5:6]
Error in penguin2[, 5:6] : 下标出界

I do not know why this error happens as it can run successfully in windows (I am a Mac user).

Edits to this post:
Peng Zhao's profile picture
Posts: 128

18 March 2022, 2:27 PM

I don't think it can run successfully in Windows. Could you double-check it in Windows?

As penguin2 <- scale(penguin[,3:6]), penguin2 is a data frame with 4 columns. Then penguin2[,5:6] makes no sense.

2 results