similar to: Why does matrix selection behave differently when using which?

Displaying 20 results from an estimated 1000 matches similar to: "Why does matrix selection behave differently when using which?"

2013 Apr 02
3
How to do platform independent system calls?
Dear R experts, I hope everyone has had a happy easter break. Recently my work included writing R function that need to call external tools. I did this using R's system function for example: system( paste( 'tool', '-input', path_to_input, '-output', path_to_output, '-other_switch', some_val ) ) I have two question about this: 1) Is there a way to implement
2005 Jul 07
1
Tables: Invitation to make a collective package
Hi All, I would like to make an invitation to make a collective package with all functions related to TABLES. I know that there are many packages with these functions, the original idea is collect all this functions and to make a single package, because is arduous for the user know all this functions broadcast in many packages. So, I think that the original packages can continue with its
2011 Jul 05
2
Stuck ...can't get sapply and xmlTreeParse working
Can't seem to get the code below working. It gets stuck on line 24 inside the function hm; comments show the line in question. The function hm is called by sapply and is at the bottom of the code. Other stuff above line 24 works correctly including the first couple of lines of the function hm. Should I be using a different apply function or am I doing something wrong with xmlTreeParse ?
2011 May 02
2
INSERT OR UPDATE
I'm trying to insert rows of a data.frame into a database table, or update where the key fields of a record already exist in the table. I've come up with a possible solution below, but would like to hear if anyone has a better solution. # The problem demonstrated: # Create a data.frame with test values library(RODBC) tbl <- data.frame( key1 = rep(1:3, each = 2), key2 =
2011 May 15
1
Need help with text processing / string split
I used screen scraping to extract some information and put it into a table called tbl. Now I want to modify the table a bit so the data can be more useful. Here's the code I used: library(XML) rm(list=ls()) url <- "http://webapp.montcopa.org/sherreal/salelist.asp?saledate=05/25/2011" tbl <-data.frame(readHTMLTable(url))[2:405, c(3,5,6,8,9)] names(tbl) <-
2016 Jun 21
2
Pregunta sobre shinyTable
Hola una pregunta: ¿Alguien ha trabajado con shinyTable? Mi pregunta es si se puede controlar el tamano de una tabla que se muestra por pantalla El tema es el siguiente: Con esta parte de codigo: output$tbl <- renderHtable({ if (is.null(input$tbl)){ #fill table with 0 tbl <-
2012 Mar 13
1
Visualising multiple response contingency tables
Dear R Help Community, I have a question and an answer (based on reading this forum and online research), but I though I should share both since probably there's a much better way to go about my solution. My question is specifically about how to best visualise multiple response contingency tables. What I mean by 'multiple response' is that the total number of responses per row of a
2017 Oct 18
1
Problem with tq_mutate_xy() from the tidyquant package
I was able to reproduce the problem with this self-contained example. Maybe it could be reproduced with an even smaller one ... library(tidyquant) # Loads tidyverse, tidyquant, financial pkgs, xts/zoo library(xts) dtV <- as.Date("2017-01-01") + 1:100 locL <- list( foo=xts(rnorm(100), order.by=dtV), bar=xts(rnorm(100), order.by=dtV) ) fullXts <- do.call(merge,locL) smallXts
2011 May 26
2
What am I doing wrong with sapply ?
Statement 9 using sapply does not seem to give the correct answer (or at least to me). Yet I do what I think is the same thing with statement 11 and I get the answer I'm looking for. 9 : s <-sapply(unlist(v[c(1:length(v))]), max) 11: for(i in 1 :length(v)) v1[i] <- max(unlist(v[i])) Shouldn't I get the same answer ? library(XML) rm(list=ls()) url <-
2012 Nov 26
1
error in plot(table(c('a','a')))
Hi all, there appears to be something strange with the plotting of tables of 1 dimension; if I attempt to make a plot of a table of characters with only 1 value I get an error (Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ). With more than one value I don't get errors, neither with integers (even if only 1 value): tbl.char1 <-
2012 Nov 26
1
error in plot(table(c('a','a')))
Hi all, there appears to be something strange with the plotting of tables of 1 dimension; if I attempt to make a plot of a table of characters with only 1 value I get an error (Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ). With more than one value I don't get errors, neither with integers (even if only 1 value): tbl.char1 <-
2013 Mar 03
1
Ordering Table Columns
cdouglass wrote > Hello all, > > Totally new to this and I'm just doing a frequency distribution analysis > on T-shirt sales by size. I have a .csv with 60 orders. I read in the > data using read.csv. If I look at the summary() or table() of the data it > looks fine, except that the shirt sizes are alphabetical rather than from > S-XXL--so the bar graph loses the shape
2018 Aug 14
1
R CMD check warnings on Windows
Hi all, For the R package bujar, the warnings below were generated on CRAN's Windows systems. The package uses some Fortran subroutines. I would appreciate any advice to eliminate the warnings. By the way, similar warnings were generated to some unrelated R packages as well: https://www.r-project.org/nosvn/R.check/r-oldrel-windows-ix86+x86_64/imputeTS-00check.html. Thanks in advance. Zhu
2011 May 04
1
tryCatch?
I would like to do inserts into a database table, but do updates in the fairly rare cases in which the inserts fail. I thought tryCatch might be the way to do it, but I honestly do not understand the help file for tryCatch at all. I thought something like this might work: for (i in seq(along = tbl$key)) { tryCatch(sqlSave(pg, tbl[i, ], "tbl", append = TRUE, rownames = FALSE),
2003 Dec 04
1
assigning colors to barplot when beside=TRUE
dear list, i am having trouble coloring the bars in a barplot. my data have two groups, which i would like to plot side by side. within each group i want to sort the observations in decreasing order, like a pareto chart. the bar colors would relfect the value of a third variable. below i have generated a reproducible example. the bar heights are a given pig's "gain",
2002 Mar 28
1
extracting non-NA columns from a data frame
I'm clustering using kmeans, and it doesn't accept NA. if NA occurs in a column of the data frame, it occurs in every column, including column 1. they say that a (good) programmer can write FORTRAN in any language, so I came up with this, where tbl is the data frame containing NA - > newtbl<-NULL > for (i in 1:length(tbl)){if (!is.na(tbl[1,i])){ + newtbl<-if
2008 Jun 24
2
spineplot (graphics package): how to control font size?
I cannot modify the font size of the standard text items for the splineplot function found in the standard graphics package. Here is a tiny example, in which I try (but fail) to make the main title large. tbl = read.table ('http://www.ggobi.org/book/data/tips.csv', sep=',', header=T) spineplot (table (tbl$DAY, tbl$SEX), main='TIPS', cex.main=3) None of
2015 Jul 13
2
Conservar el nombre de la variable entre varias funciones
Hola: Con esto del R me da la impresión que avanzo un paso y retrocedo dos! El caso es que tengo una "cascada de funciones", para realizar un análisis descriptivo "automático" en función del tipo de variable. Y en los resultados, en lugar de aparecer el nombre de la variable, aparece el nombre del argumento. Esto ocurre tanto si utilizo o no la función get(). Un ejemplo
2008 Nov 19
1
more efficient small subsets from moderate vectors?
This creates a named vector of length nx, then repeatedly draws a single sample from it. lkup <- function(nx, m=10000L) { tbl <- seq_len(nx) names(tbl) <- as.character(tbl) v <- sample(names(tbl), m, replace=TRUE) system.time(for(k in v) tbl[k], gcFirst=TRUE) } There is an abrupt performance degredation at nx=1000 > lkup(1000) user system elapsed 0.180
2009 Dec 27
2
RGtk2 / gWidgets - addHandlerClicked Problem
In The following code, the table handler is executed twice when the button is pressed (from the 2nd pressing on). I want it to be executed only once. Does someone know, why this happens and how I can change it? library(gWidgets) w <- gwindow() b <- gbutton("press", cont=w) tbl <- gtable(1:10, cont=w) addhandlerclicked(b, handler=function(h, ...){