Hi I have a problem with Rstudio and I dont know what to do. Any help will be appreciated. This is the error message:
Error in [.data.frame(dat, , vari) : undefined columns selected
In addition: Warning message:
In if (is.na(var.out)) new.fac = paste(variable, ".r", sep = "") else new.fac = var.out :
the condition has length > 1 and only the first element will be used
Called from: [.data.frame(dat, , vari)
Error during wrapup: unimplemented type (29) in 'eval'
Error: no more error handlers available (recursive errors?); invoking 'abort' restart
Error during wrapup: INTEGER() can only be applied to a 'integer', not a 'unknown type #29'
Error: no more error handlers available (recursive errors?); invoking 'abort' restart
We don't really have enough info to help you out. Could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.
If you've never heard of a reprex before, you might want to start by reading this FAQ:
> getwd()
[1] "C:/Users/Maria del Mar/Documents"
> dir()
[1] "04_conducta_evitacion.dat"
[2] "09_compras.txt"
[3] "10_hora.Rdata"
[4] "11_anorexia.Rdata"
[5] "11_moore.dat"
[6] "79075626_CONTROL1_Datos.txt"
[7] "79075626_Datos_Practica_03.txt"
[8] "79075626_Datos_Practica_P4b.txt"
[9] "79075626_P5a_Datos.txt"
[10] "79075626_P6a_Datos.txt"
[11] "Datas_Manual.zip"
[12] "desktop.ini"
[13] "FM3"
[14] "Mi música"
[15] "Mis imágenes"
[16] "Mis vídeos"
[17] "R"
[18] "Zoom"
> datos=lee.archivo.fnc( "11_moore.dat" , hay.nombres= F, separador = '', decimal='.')
---------------------------------------------------------------------------
*** WARNING ***
Los archivos de texto plano se leen por defecto asumiendo que el archivo
tiene como primera fila los nombres de las variables (hay.nombres=T).
Que los valores con decimales utilizan el caracter coma (decimal=',').
Que los valores perdidos tienen celdilla vacia (miss='') y que el
delimitador de columna es el tabulador (separador='tab'). Modifica
apropiadamente esos argumentos en el caso de que la lectura por derfecto
no fuese adecuada.
Ej: hay.nombres=F, separador=' ', decimal='.', miss=-999
---------------------------------------------------------------------------
*** El archivo 11_moore.dat contiene 46 registros y 3 variables
*** Si la estructura original es de variables x sujetos, incluye en la
*** funcion el argumento traspuesta=T.
V1 V2 V3
1 status.exp conformidad autoritarismo
2 bajo 8 37
3 bajo 4 57
4 bajo 8 65
5 bajo 7 20
6 bajo 10 36
> datos= discretiza.variable.fnc(datos,variable='autoritarismo',ntiles=3,c('A1','A2','A3'))
#--------------------------------------------------------------------------------
# DISCRETIZADO DE VARIABLE CONTINUA
#--------------------------------------------------------------------------------
$tronco.y.hoja.autoritarismo
Error in `[.data.frame`(dat, , vari) : undefined columns selected
In addition: Warning message:
In if (is.na(var.out)) new.fac = paste(variable, ".r", sep = "") else new.fac = var.out :
the condition has length > 1 and only the first element will be used
Called from: `[.data.frame`(dat, , vari)
Error during wrapup: unimplemented type (29) in 'eval'
Error: no more error handlers available (recursive errors?); invoking 'abort' restart
Error during wrapup: INTEGER() can only be applied to a 'integer', not a 'unknown type #29'
Error: no more error handlers available (recursive errors?); invoking 'abort' restart
Browse[1]>
Again, is hard to help you without a reproducible example, the functions you are using are not base R functions and we don't know from what package do they come from or if they are defined by you.
I notice you speak Spanish so maybe this version of the reprex guide would be easier to follow for you.
Please try to follow the guide and provide a proper reprex.
If this is a function from a private package , your professors toolbox, then the ability for an outsider to support you with its use will naturally be limited. more general and widely available tools, are more easily supported because more users are familiar and have experience with them.
That said its common to find documentation provided for packaged functions. In your position I would type
?discretiza.variable.fnc
into the R Studio Console, in the hope that help would appear on the syntax of the function, and perhaps examples provided.
That said. I can guess that the problem is that your data contains 3 columns V1,V2,V3 rather than
status.exp, conformidad, autoritarismo.
in the previous lee.archivo.fnc, what is the meaning of hay.nombres=F ?