2021-01-04

Cómo insertar una imagen en comentario de una celda en Excel

Title

Problema

Queremos insertar una imagen en el comentario de una celda en Excel

Solución

  1. Seleccionamo una celda, clic con el botón derecho e insertamos un comentario.
  2. Clic con el botón derecho en el borde del comentario y luego en Formato de comentario.
  3. En la pestaña Colores y líneas, clic en el desplegable color y selecciona Efectos de relleno.
  4. En la pestaña imagen, clic en Seleccionar Imagen.
  5. Seleccionamos la imagen, insertar, y aceptar.
  6. Ajustamos el tamaño de la imagen arrastrando los bordes del comentario.
  7. Ocultamos el comentario si solamente queremos que aparezca al pasar el cursor por encima.

Entradas relacionadas

2021-01-01

Cómo crear una serie temporal con intervalos de 30 minutos

Title

Problema

Queremos crear una serie temporal de intervalos de 30 minutos.

Ejemplo

[1] "2017-01-01 00:00:00 UTC"
[2] "2017-01-01 00:30:00 UTC"
[3] "2017-01-01 01:00:00 UTC"
[4] "2017-01-01 01:30:00 UTC"
[5] "2017-01-01 02:00:00 UTC"
[6] "2017-01-01 02:30:00 UTC"

Solución

Usamos la función seq y especificando los minutos en el argumento by, así como el uso horario "UTC". Tecleamos ?seq.POSIXt para obtener más detalles sobre el argumento que podemos especificar como cadena sde texto:

A character string, containing one of "sec", "min", "hour", "day", "DSTday", "week", "month", "quarter" or "year". This can optionally be preceded by a (positive or negative) integer and a space, or followed by "s".

seq(as.POSIXct("2017-01-01", tz = "UTC"),
    as.POSIXct("2017-01-02", tz = "UTC"),
    by = "30 min")

Referencias

2020-12-23

How to create a time series by 30 minute intervals

Title

Problem

We want to create a time series by 30 minute intervals.

Example

[1] "2017-01-01 00:00:00 UTC"
[2] "2017-01-01 00:30:00 UTC"
[3] "2017-01-01 01:00:00 UTC"
[4] "2017-01-01 01:30:00 UTC"
[5] "2017-01-01 02:00:00 UTC"
[6] "2017-01-01 02:30:00 UTC"

Solution

We use the function seq and specify minutes in the by argument, and pass the time zone "UTC". Type ?seq.POSIXt for more details about the by argument specified as a character string:

A character string, containing one of "sec", "min", "hour", "day", "DSTday", "week", "month", "quarter" or "year". This can optionally be preceded by a (positive or negative) integer and a space, or followed by "s".

seq(as.POSIXct("2017-01-01", tz = "UTC"),
    as.POSIXct("2017-01-02", tz = "UTC"),
    by = "30 min")

References

2020-12-21

How to create a symmetric matrix in R

Title

Problem

We want to create a symmetric matrix based on the following example.

Example

  V1 V2 V3 V4 V5
1  0  2  3  4  5
2  0  0  6  8 10
3  0  0  0 12 15
4  0  0  0  0 20
5  0  0  0  0  0
df <- structure(list(V1 = c(0L, 0L, 0L, 0L, 0L), V2 = c(2L, 0L, 0L, 
0L, 0L), V3 = c(3L, 6L, 0L, 0L, 0L), V4 = c(4L, 8L, 12L, 0L, 
0L), V5 = c(5L, 10L, 15L, 20L, 0L)), .Names = c("V1", "V2", "V3", 
"V4", "V5"), class = "data.frame", row.names = c("1", "2", "3", 
"4", "5"))

Solution

  • Adding the transpose of the matrix.
  • df + t(df)
  • Function lower.tri
  • We assign to the lower triangle of the matrix the transpose of the lower triangle.

    df[lower.tri(df)] <- t(df)[lower.tri(df)]
      V1 V2 V3 V4 V5
    1  0  2  3  4  5
    2  2  0  6  8 10
    3  3  6  0 12 15
    4  4  8 12  0 20
    5  5 10 15 20  0

    Using upper.tri would not create a symmetrical matrix.

    df[lower.tri(df)] <- df[upper.tri(df)]
      V1 V2 V3 V4 V5
    1  0  2  3  4  5
    2  2  0  6  8 10
    3  3  8  0 12 15
    4  6 12 10  0 20
    5  4  5 15 20  0
    

References

2020-12-18

How to change the spacing between the legend and the panel in ggplot2

Title

Problema

We want to increase the spacing between the legend and the panel in ggplot2.

library(ggplot2)
xy <- data.frame(x = 1:10, y = 10:1, type = rep(LETTERS[1:2], each=5))
plot <- ggplot(data = xy) +
        geom_point(aes(x = x, y = y, colo r= type))

Solution

We use the argument legend.box.margin to add 20 points to the left.

plot <- plot + theme(legend.box.margin = margin(0, 0, 0, 20))

References

2020-12-17

Cómo eliminar todos los comentarios en Excel

Title

Problema

Queremos borrar todos los comentarios en Excel. Veremos tres alternativas, en la última usaremos VBA

Solución

  • Opción 1
    1. En la pestaña Revisar clic en Mostrar todos los comentarios
    2. Press Ctrl+E para seleccionar todos los comentarios
    3. Clic en Eliminar
  • Opción 2
    1. Presionamos F5 o Ctrl + I para abrir el cuadro de diálogo Ir a, clic en Especial
    2. Todos los comentarios serán seleccionados
    3. Clic con el botón derecho para abrir el menú contextual y clic en Eliminar comentario
  • Opción 3 - VBA
    1. Borra todos los comentarios de la hoja activa
    2. Sub Borra_Comentarios_de_la_Hoja()
       Cells.ClearComments
      End Sub
      
    3. Borra todos los comentarios del libro de Excel
    4. Sub Borra_todos_los_Comentarios()
          Dim ws As Worksheet
      
          For Each ws In Worksheets
              ws.UsedRange.ClearComments
          Next
      
      End Sub
      

2020-12-14

How to remove all comments in Excel

Title

Problem

We want to delete all comments in Excel. We will see three alternative, the last one using VBA.

Solution

  • Option 1
    1. On the Review tab click on Show all comments
    2. Press Ctrl+A to select all comments
    3. Click on Delete
  • Option 2
    1. Press F5 or Ctrl + G to open Go To dialog box, click on Special and then OK
    2. All comments will be selected
    3. Right click to open context menu and click on Delete Comment
  • Option 3 - VBA
    1. Delete all comments from active sheet
    2. Sub Delete_Comments_from_Sheet()
       Cells.ClearComments
      End Sub
      
    3. Delete all comments from the workbook
    4. Sub Delete_All_Comments()
          Dim ws As Worksheet
      
          For Each ws In Worksheets
              ws.UsedRange.ClearComments
          Next
      
      End Sub
      
Nube de datos