Erro: Abrindo o cache (E: o tipo 'sudo' não é conhecido na linha 1 na lista de fontes /etc/apt/sources.list.d/r-cran.list

Erro: Abrindo o cache (E: o tipo 'sudo' não é conhecido na linha 1 na lista de fontes /etc/apt/sources.list.d/r-cran.list

Estou tentando instalar o R. Tentei as instruções da melhor resposta emuma postagem anterior, sem sucesso. Estou usando o Ubuntu 16.04.6 LTS de 64 bits.

Eu tentei o método, mas minha janela do terminal parecia não fazer nada, embora quando tentei fechar a janela ele dissesse que havia processos em execução. Eu tentei algumas vezes. E agora tenho uma mensagem de erro na bandeja cinza fina no topo:

An error occurred, please run the package manager from the right-click menu or apt-get in a terminal to see what is wrong. 

A mensagem de erro foi:

Error: Opening the cache (E:type 'sudo' is not known on line 1 in source list /etc/apt/sources.list.d/r-cran.list,   
E:The list of sources could not be read.)

This usually means that your installed packages have unmet dependencies.

Iniciar o gerenciador de pacotes (através da notificação) não adiantou nada, recebi esta mensagem (imagem em anexo):

E: Type 'sudo' is not known on line 1 in source list/etc/apt
sources.list.d/r-cran.list  
E: The list of sources could not be read. Go to the repository dialogue to correct the problem.  
E:_cache->open()failed, please report. 

Não sei como ir ao repositório, nem como denunciar. Como faço para corrigir esse problema?

Eu também tentei as instruções emesse linktambém, copiar o código-fonte e colar em um terminal, o que provavelmente não é como fazer isso, mas não sei como acessar o /etc/apt/sources.listarquivo.

@heynnema quando executei o código, ele diz cat: /etc/apt/sources.list.d/r-cran.list: Esse arquivo ou diretório não existe

@heynnema a correção não funcionou aqui é a saída do terminal:

(gedit:2641): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files

** (gedit:2641): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-spell-enabled not supported

** (gedit:2641): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported

** (gedit:2641): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-spell-enabled not supported

** (gedit:2641): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported

** (gedit:2641): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-position not supported
helwalaura@Galactica:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
Executing: /tmp/tmp.L1dGqRuvRD/gpg.1.sh --keyserver
keyserver.ubuntu.com
--recv-keys
E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg: requesting key E084DAB9 from hkp server keyserver.ubuntu.com
gpg: key E084DAB9: public key "Michael Rutter <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
helwalaura@Galactica:~$ sudo apt-get update
E: Type 'sudo' is not known on line 1 in source list /etc/apt/sources.list.d/r-cran.list
E: The list of sources could not be read.
helwalaura@Galactica:~$ 

@heynemma aqui está o resultado decat /etc/apt/sources.list.d/r-cran.list

helwalaura@Galactica:~$ cat /etc/apt/sources.list.d/r-cran.list

sudo tee /etc/apt/sources.list.d/r-cran.list
sudo cat <<EOF | sudo tee /etc/apt/sources.list.d/r-cran.list
deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/

@heynnema quando apaguei as outras 2 linhas de código, isso apareceu na janela do terminal:

(gedit:3157): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files

** (gedit:3157): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-spell-enabled not supported

** (gedit:3157): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported

** (gedit:3157): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-position not supported

Responder1

Para tentar juntar as peças, começaremos do início... isso deve ajudar você a começar... use copiar/colar com as linhas a seguir, pois algumas delas são muito longas...

Nota: Alguns/todos esses pacotes "R" estão nos repositórios do Ubuntu 19.10.

Em terminal...

sudo -H gedit /etc/apt/sources.list.d/r-cran.list

Adicione isto como a única linha no arquivo ...

deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/

Salve o arquivo e saia do gedit.

Em terminal... copie/cole um comando de cada vez em terminal... o primeiro comando é longo...

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo apt-get update
sudo apt-get install r-base r-base-dev

Fonte:Como instalar R no Ubuntu 16.04 Xenial?

Fonte:https://cran.r-project.org/bin/linux/ubuntu/README.html

Atualização nº 1:

Sobras... mas soluções fáceis...

sudo -H gedit /etc/apt/sources.list

Vá para geditpreferências e habilite a numeração de linha.

Vá até o final do arquivo (linha 52) e você provavelmente encontrará uma linha como esta...

deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/

Exclua essa linha. Salve o arquivo e saia gedit.

sudo apt-get update
sudo apt-get install r-base r-base-dev

E devemos terminar!

informação relacionada