Skip to content

Instantly share code, notes, and snippets.

@spceaza
Created November 16, 2020 23:29
Show Gist options
  • Save spceaza/b12469674830588e607ba28feab019ea to your computer and use it in GitHub Desktop.
Save spceaza/b12469674830588e607ba28feab019ea to your computer and use it in GitHub Desktop.
Scripts varios
data_table = read.csv2( "ruta/del/archivo/" )
raw_data = unname( unlist( data_table ) )
raw_data = raw_data[which( !is.na( raw_data ) )]
View( data_table )
max_x = max( raw_data )
min_x = min( raw_data )
x_values = unique( raw_data )
x_values = sort( x_values )
y_data = list()
for( i in x_values )
{
y_data[[as.character( i )]] = 0
}
for( current_col in 1:ncol( data_table ) )
{
current_data = data_table[, current_col]
current_data = current_data[which( !is.na( current_data ) )]
for( i in x_values )
{
if( i >= max( current_data ) )
{
y_data[[as.character( i )]] = y_data[[as.character( i )]] + 1
}
}
}
new_y_data = vector()
for( i in x_values )
{
new_y_data = c( new_y_data, y_data[[as.character( i )]] )
}
plot( x_values, new_y_data, xlab = )
write.csv2( data.frame( x_values, new_y_data ), file = "Resumen.csv" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment