similar to: Help with vector gymnastics

Displaying 20 results from an estimated 4000 matches similar to: "Help with vector gymnastics"

2007 Aug 08
1
Binary Search
Hi! R is an amazing piece of software and with so many libraries it can do almost anything... but I was very surprised that a standard "binary search" function seems not to exist. I can find other much more highly-complex search routines (optimize, uniroot, nlm) in the standard no-extra-packages-loaded version of R, but not this simple alternative. I searched and found an
2007 Aug 31
2
Problem of vocabulary : retrieve element of a list of a list
Hi, I read the posts for 2 hours and ?list and tried many comninations but I haven't found the answer to this basic question. So I decided to post my question even if it is a silly one ... What is the instruction to retrieve, for example, the "D" of the first list ? Thanks in advance, Ptit Bleu. > x<-list(LETTERS[1:5], LETTERS[10:20]) > x [[1]] [1] "A"
2007 Aug 19
2
Does anyone else think this might be worth a warning?!?
Hi, I was *very* surprised by this little trick for new players: mean() only considers its first argument! > mean(1,1,2) [1] 1 > mean(2,1,1) [1] 2 I found this very different behaviour to max(): > max(1,1,2) [1] 2 > max(2,1,1) [1] 2 Perhaps this is the wrong list to ask, but does anyone else think this a little on the interesting side? Is it not possible to detect a
2007 Jul 25
1
how to use "replace" for efficiency
Hi I think I have been struggling to use replace correctly, I usually work my way around this using a loop, but I think this is in fact inefficient. I have a dataset with runoff from three plots and associated rainfall. However either the datarecording was sloppy, or the rainfall very patchy. So I am trying to remove data from my dataset for which the runoff is larger than the rainfall on the
2007 Aug 14
3
diffusing GIS data in maps
Hi- I am trying to find a way to diffuse GIS data on a European map. I have a dataset consisting of particular locations scattered across Europe, along with magnitude and value information. I can plot these as discrete points with something like the following: "geocode" is a dataframe with four columns: LAT; LONG; MAGNITUDE;VALUE. library(maps) library(mapdata)
2009 Mar 29
1
Lattice question.
Hi. I am trying to do histograms in lattice, and I want to get both counts and percents in the same plot. To try to be clearer --- there are 3 levels to my factor; I'd like to get a 2 x 3 array of plots where the top row consist of histograms by counts and the bottom consists of (the corresponding) histograms by percent. I tried the following: # Demo. library(lattice) set.seed(42) XX <-
2007 Jul 26
3
substituting dots in the names of the columns (sub, gsub, regexpr)
Dear R users, I have the following two problems, related to the function sub, grep, regexpr and similia. The header of the file(s) I have to import is like this. c("y (m)", "BD (g/cm3)", "PR (Mpa)", "Ks (m/s)", "SP g./g.", "P (m3/m3)", "theta1 (g/g)", "theta2 (g/g)", "AWC (g/g)") To get rid of spaces and
2008 Oct 19
3
pairs plots in R
Hi, is there a way to take a data frame with 100+ columns and large data set to do efficient exploratory analysis in R with pairs? I find using pairs on the whole matrix is slow and the resulting matrix is tiny. Also the variable of interest for me is a binary var Y or N . Is there an efficient way to graphically view many variable relationships that does not look teeny ? I could do
2003 Sep 22
1
Managing a list with a list
OK. Another amateur question. I have a list with attributes on pine trees, like the stem's location, a logical value set to T if it's alive, some parameters for growth, diameter, etc. The tree list has another list in it which is a new data type for me. I want to make a new list that retains all the live trees. That is where Living == T. Here's the summary of the list: >
2009 Oct 22
1
loop vs. apply(): strange behavior with data frame?
Hi everybody, I noticed a strange behavior when using loops versus apply() on a data frame. The example below "explicitly" computes a distance matrix given a dataset. When the dataset is a matrix, everything works fine. But when the dataset is a data.frame, the dist.for function written using nested loops will take a lot longer than the dist.apply ######## USING FOR ####### dist.for
2005 Nov 28
1
terms.object documentation bug? (PR#8353)
Full_Name: simon wood Version: 2.2.0 (and lower) OS: linux/windows Submission from: (NULL) (86.135.153.59) I think that the documentation for the `specials' attribute of a `terms.object' is not quite right: specials: If the 'specials' argument was given to 'terms.formula' there is a 'specials' attribute, a list of vectors indicating the terms
2010 Nov 15
1
Aggregate on identical link attributes
Hello R community, I need to do some aggregation based on the test data below. The below code works ok, but when its applied to my real data which includes over 9,000 records the process runs for over an hour. I know there is a more efficient way of doing this. I want to Sum the below data's volumes where FNODE and TNODE match, i.e. FNODE=1 and TNODE =20 -> Volume=100 ,
2006 Apr 28
2
entries that match a regexp
Hi all, I am trying to filter the element of a df that start with "TF", like this: alfa = c(123221,"TF13124",41243,"TF1234",32414,"TF13124","TF14333",2134123,"TF1234") beta =
2013 Jan 09
1
deparse substitute
Hi, I'm writing a function that needs the input names (as characterstrings) as part of the output. With deparse(substitute( ) ) that works fine, until I replace all zeros with 0.001 (log is calculated at some time): tf <- function(input) { input[input==0] <- 0.001 ; deparse(substitute(input)) } myguess <- 42 tf(myguess) # not "myguess", but "42" Now when
2009 Nov 17
2
Just what is puppet doing here?
What is puppet doing here? Nov 17 00:02:01 gumby yum: Installed: tf-starterkit-tfel0-1.0-1.tf.noarch Nov 17 00:02:01 gumby puppetd[720]: (//Node[gumby.fr.xxx.com]/Starterkit::Setup[tfel0]/Package[tf-starterkit-tfel0]/ensure) created Nov 17 00:02:07 gumby yum: Installed: tf-jboss-server-4.2.3.GA-1.tf.noarch Nov 17 00:02:07 gumby puppetd[720]:
2018 May 01
1
possible internal (un)tar bug
>>>>> Martin Maechler <maechler at stat.math.ethz.ch> >>>>> on Tue, 1 May 2018 16:14:43 +0200 writes: >>>>> G?bor Cs?rdi <csardi.gabor at gmail.com> >>>>> on Tue, 1 May 2018 12:05:32 +0000 writes: >> This is a not too old R-devel on Linux, it already fails >> in R 3.4.4, and on macOS as well.
2005 Aug 03
1
abline and linearity over groups
Dear R users, please can you help me understand the behaviour of abline using function lm. I'm trying to learn linearity over groups. So I make three groups with 10 values each: test=data.frame(cbind( l=c(rnorm(10,0,30),rnorm(10,100,30),rnorm(10,200,30)), t = c(rep(0,10), rep(1,10), rep(2,10)) )) when I do: plot(test$l~test$t) abline(lm(test$l~test$t)) the abline is a straight line
2020 Apr 29
2
[Posible SPAM] Re: Stopwords: Topic modelling con LDA
Hola, Acabo de calcular tf-idf y me surge una duda. ¿Habría un valor de idf o tf-idf que se considerara como umbral para establecer que una palabra es muy común o no? Los valores de idf en mis datos van entre 0 y 3.78 y los de tf-idf ente 0 y 0.07. Un saludo El Mar, 28 de Abril de 2020, 12:53, Carlos Ortega escribió: > Hola, > Yo de primeras los quitaría para qué otros topics aparecen.
2015 Feb 22
2
[LLVMdev] Resolving an opaque type in llvm-assembly
According to the Assembly language reference: "In LLVM, opaque types can eventually be resolved to any type (not just a structure type)." But the only way I can think of to do so is to give it a type name, then later redeclare the name. But that gives an error: %TO = type opaque %TF = type i32 ( %TO* ) %TO = type %TF gives: $ llvm-as types1.ll llvm-as: types1.ll:3:1: error:
2008 Jul 22
1
xyplot help
I have a question about xyplot. Suppose I want to plot say a response variable y vs a predictor x within groups defined by a variable called z. And suppose I have another variable v=1,2 with two levels. I would use the following command to get a "spaghetti plot" with two panels defined by v. xyplot(y~x|v,groups=z,type="l") My question is that on top of the panels, the title of