[R-es] ayuda con dos sencillos problemas.

Marcuzzi, Javier Rubén javier.ruben.marcuzzi en gmail.com
Mie Ene 2 16:25:21 CET 2013


Estimado Victor

Voy a responder solo una parte, porque yo tenía problemas hasta que lo
entendí.

Si, en letras es conveniente informar al sistema que "as.character",
esto no es complicado. Pero "as.factor"???

Con números es más fácil, supongamos: datos x
<-c(1,2,3,4,3,4,6,8,7,5,9,10,12)
y ...no importa.
En realidad los números son los meses, en este caso son factores.
as.factor(x).

Vectores o listas, ..., se puede pasar de uno a otro, ¿entonces...?, en
la práctica son formas diferentes de tener al información en términos
informáticos, lógicamente para cada cosa hay una forma más adecuada de
acuerdo a lo siguiente o anterior, viendo varios ejemplos se comprende,
y esta claro que luego cada persona puede escribir en R de la forma que
le resulta más práctico. El único problema es que los datos al ingresar
a una función deben estar de acuerdo a los requerimientos de la función.

R se aprende probando y escribiendo nuevas alternativas, cometiendo
errores y buscando nuevas formas. Lógicamente la parte estadística debe
"venir" de otro lado.

Javier Marcuzzi

El mié, 02-01-2013 a las 19:04 +0100, Víctor Macía escribió:
> Hola gente. Me presento, me llamo Vctor y soy bastante novato en R. Me piden hacer dos sencillos problemas pero como no tengo mucha idea no s por dnde tirar ni mirar informacin para hacerlos.
> 
> Os explico,
> 
> 1.- el primero es definir las caractersticas de dos tipos de datos: o 
> bien lists y vectors o bien character y factors. Decir sus ventajas y 
> desventajas y poner una serie de ejemplos. He visto algo por internet 
> pero la informacin es bastante escasa y poco clara (sobre todo en 
> castellano). Os copio lo que me piden en el enunciado:
> 
> Either: Describe the differences between the R list and vector (i.e. 1-dimensional array) data types. Outline
> the advantages and disadvantages of both data types, and give examples of where each might be appropriately
> used.
> Or: Describe the differences between the R character and factor data types. Outline the advantages and
> disadvantages of both data types, and give examples of where each might be appropriately used.
> Max 2000 words.
> 
> 2.-
>  el segundo es de programacin propiamente dicha. Me dan un listado de 
> datos de una votacin en Londres y tengo que hacer dos diferentes 
> funciones: una para dibujar crculos en cada barrio proporcionales a los
>  votos del partido ganador, y otra para manejar la leyenda. Tambin os copio el enunciado:
> 
> 1. In essay form, describe the functionality of the code you have written, providing an overview of the
> code, the features of R exploited in the code and also also emphasising the reasons for choosing the
> techniques you have used, the individual R functions that you have written: max 2000 words.
> 2. Provide documentation of each function you have written (in a similar style to the R help system).
> 3. Provide a listing of the code you have written, making full use of #-style comments in the code.
> 4. Provide a demonstration of the code being used, by showing one or more examples.
> 
> Write a function to draw a proportional circles map for a given variable, and SpatialPolygonsDataFrame
> 
> You can make use of the file londonvotes.RData in the assignment folder - this contains a number of numeric
> variables: Majority, Electorate, Candidate.Votes, Total.constituency.votes, and others.
> Note that there is also a legend on this map. Create another function, that, given a location to draw the
> legend, the values to show on the legend and the variable being mapped, will add the legend to the map.
> 
> Si me pudierais echar una mano os lo agradecera muy mucho. 
>  		 	   		  
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-help-es mailing list
> R-help-es en r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es



Más información sobre la lista de distribución R-help-es