Posts by Molx • 2,659 points
66 posts
-
3
votes1
answer1121
viewsA: Can a macro create another macro?
I’m not a VBA expert, but I think I was able to solve your problem using the available code here. Before testing, two settings need to be made: In the VBA project, add the reference Microsoft Visual…
-
5
votes1
answer122
viewsA: Comparison of two matrices with different sizes
Some ways to be doing that (I still think there’s some smarter): a[!apply(a, 1, function(arow) any(apply(b, 1, function(brow) all(brow==arow)))),] In this case, each row of the matrix a will be…
-
4
votes3
answers7816
viewsA: Separate contents from one column in other columns
You were very close to the solution. If instead of the reshape use the reshape2, using the same function (switching the argument split for pattern), you come close to what you would like: > file…
-
2
votes2
answers2923
viewsA: Comparing contents of a Column
You can do this more than one way in R. The simplest way would be to use the %in% to check which of your values are not in the list of values you want to remove. For example: > todos <- 1:10…
-
1
votes2
answers486
viewsA: Problems with css, menu does not work
You have put the opacity (transparency) of <li> as 0. Change to 1 or remove that part of CSS. ul > li { opacity:0; }…
-
4
votes2
answers274
viewsA: Is there a hash structure in R?
As explained in @Guilhermeduarte’s own reply, there is no essentially hash structure native to R, but there is one package that implements it. It is important to note, however, that this package is…
-
2
votes2
answers1739
viewsA: In R, sort a data frame by column and by groups
You can use order() with more than one condition, placing the columns in priority order: df <- read.table(text="v1 v2 grupo 1 5 1 4 1 1 1 2 1 5 7 2 4 2 2 1 9 2", header=TRUE) df[order(df$grupo,…
-
1
votes2
answers485
viewsA: How to maintain indentation and line breaks when saving a text file via javascript
According to a comment by the author himself of the script you linked: Translation: Line breaks are still there but are formatted in style Unix, not Windows style. Unix uses only the character…
javascriptanswered Molx 2,659 -
5
votes1
answer717
viewsA: Internet Explorer does not recognize CSS classes that work properly in other browsers
IE can’t handle CSS errors as well as other browsers. In your code, two keys } are missing from the items @media, so that styles after this error are not read correctly. This can happen for other…
-
3
votes2
answers1551
viewsA: How to group data by an id in R
You can do in base with the function aggregate: df <- data.frame(id=c(1, 1, 2, 2, 3, 3), x=c(2, 3, 3, 3, 3, 3)) aggregate(x~id, df, FUN=mean) # id x #1 1 2.5 #2 2 3.0 #3 3 3.0 With dplyr (a very…
-
3
votes2
answers1241
viewsA: How to do sequence in R?
If what you want is a way to make the sequence more dynamic, you can use the following: n=8 names <- rep(1:n, n)+rep(0:(n-1), each=n) #[1] 1 2 3 4 5 6 7 8 2 3 4 5 6 7 8 9 3 4 5 6 7 8 #[23] 9 10 4…
-
2
votes1
answer321
viewsA: Spatial analysis in R: how to implement a polygon with splancs?
Leila, I found three problems in your code: You defined the variable with the name loc23, but then calls his name loc.m23 You called the function coordinates of coodinates, without the letter r.…
-
2
votes1
answer1187
viewsA: How to delete axis title in graphics in R?
You can place the x-axis label as empty using xlab="" inside plot. If you want to remove the space left, you have to change the parameter mar: par(mar=c(3, 4, 4, 2)) #A ordem é: embaixo, esquerda,…
-
0
votes3
answers2375
viewsA: Grab part of the text that is between tags of a string
An option using regex: Imports System.Text.RegularExpressions Module VBModule Sub Main() Dim str As String = "Meu nome é <nome> Nickolas Carlos<nome>" Dim pad As New…
-
3
votes1
answer656
viewsA: Error non-numeric argument to Mathematical Function
Some comments: Your code indicates that a non-numeric value has been passed to exp() because you didn’t have the output you wanted from the function int(). You must use integrate(funcao,s,t)$value…
-
4
votes1
answer2746
viewsA: How to create a function in R
Before responding, a few considerations: I recommend not using variables with accents, you may have problem with encoding. You can calculate the average with the function mean(), or as I will show…