similar to: R-code help for filtering with for loop

Displaying 20 results from an estimated 300 matches similar to: "R-code help for filtering with for loop"

2001 Aug 02
1
Package GSS for interpolation in more than 2D?
Dear all, There has been some time since I asked about interpolation in higher (>2) dimensions, and I must admit I failed to write a function to do this myself the last time, but eventually ended up doing it in MATLAB. I tried to translate the MATLAB code, but MATLAB code is so much more opaque than R (S) code, so I failed that too, mainly because I could only get one MATLAB session, I would
2012 Oct 04
1
data structure for plsr
I am having a similar problem understanding the data structure of the "yarn" dataset described in the "[R] data structure for plsr" posts. I have spectroscopic data I'd like to run through a PLSR and have read the tutorial series, but still do not understand the data format required for the code to process my data. My current data structure consists of a .csv file read into
2003 Oct 16
1
princomp with more coloumns than rows: why not?
As of R 1.7.0, princomp no longer accept matrices with more coloumns than rows. I'm curious: Why was this decision made? I work a lot with data where more coloumns than rows is more of a rule than an exception (for instance spectroscopic data). To me, princomp have two advantages above prcomp: 1) It has a predict method, and 2) it has a biplot method. A biplot method shouldn't be too
2011 Feb 08
2
Extrcat selected rows from a list
Hi, I have two lists 1) List1- 30,000 rows and 104 columns 2) List2- a list of 14000 selected rownames  from List 1 Now, I want to extract all the 104 columns of List1  matching with the 14000 selected rownames from List2.  Psedocode will be something like this: match rownames(List2) with rownames(List1) extract selected matched 104 coloumns from (List1) strore in-> List3 So the
2008 Jun 10
4
Hello
Hello, I am facing a problem in drawing heat map using R. I have a 70X3 matrix and I want to draw a heat map with 1 coloumn on X axis another on Y axis and want to show the value of 3rd coloumn using heat colours. Could you please help me with this . Thank you . Regards, Sumit [[alternative HTML version deleted]]
2005 Mar 25
2
tapply and NA value
Hi, I'm writing for a little help. I have a dataframe with same NA value and I'd like to obtain the means of the value of a coloumn grouped by the levels of a factor coloumn of the datframe. I'm using the function "tapply" but I see that if only a NA value is present the result is NA. There is an option to have the correct result or I must use an other function? Thanks of
2011 Mar 20
2
Why unique(sample) decreases the performance ?
Hi, I' am interested in differences between sample's result when samples consist of full elements and consist of only distinct elements. When sample consist of full elements it take about 120 sec., but when consist of only distinct elements it take about 4.5 or 5 times more sec. I expected that opposite of this result, because unique(sample) has less elements than full sample. Code as
2011 Jan 17
1
Problem about for loop
Hi everyones, my function like; e <- rnorm(n=50, mean=0, sd=sqrt(0.5625)) x0 <- c(rep(1,50)) x1 <- rnorm(n=50,mean=2,sd=1) x2 <- rnorm(n=50,mean=2,sd=1) x3 <- rnorm(n=50,mean=2,sd=1) x4 <- rnorm(n=50,mean=2,sd=1) y <- 1+ 2*x1+4*x2+3*x3+2*x4+e x2[1] = 10 #influential observarion y[1] = 10 #influential observarion data.x <- matrix(c(x0,x1,x2,x3,x4),ncol=5) data.y
2004 Dec 10
1
bar charts
Hi, I'd like plot a bar graphic of a array. I'd like to have the values of the single columns as juxtaposed bars (like in "barplot" with beside=TRUE) and I'd like to have the values of the single columns expressed like percentage of the sum of the coloumn. In this way all the bars are composed by the sum of the percentage of the values of a coloumn (with different colors)
2006 Jun 16
1
Assignemt problem ,,,,,,,,,,,,,,,
  Hello list, i have a very simple question about matrix assignment. i did like this. res<-1:30 dim(res)<-c(5,6) ind<-1:6 now i want to assign the value of this variable ind to first coloumn in matrix res. like res[,1]<-ind but this code is giving error , Actualy i have a for loop and value of ind variable is changing every time ,,total 6 times,,i want to assign every vlaue
2005 Nov 18
1
pr[in]comp: predict single observation when data has colnames (PR#8324)
To my knowledge, this has not been reported previously, and doesn't seem to have been changed in R-devel or R-patched. If M is a matrix with coloumn names, and mod <- prcomp(M) # or princomp then predicting a single observation (row) with predict() gives the error Error in scale.default(newdata, object$center, object$scale) : length of 'center' must equal the number of
2011 Jun 07
3
Classifying boolean values
Hi to all, I'm new to this forum and new to R. I have to build a tree classifier that has boolean values as response. When I build the tree with: echoknn.tree <- tree(class ~ ., data=echoknn.train) where "class" is a coloumn of my dataset (echoknn.train) of boolean values, the result is a tree where leaf nodes are numbers in the range [0,1]; but this isn't the result that I
2009 Apr 29
3
mode(x) <- "double"
Hi, I need your help!! I imported a big coloumn vector from a txt file but it results as mode :"list" I want to change it in numeric otherwise I can't do my analysis. This is what i get: mode (data) <- "double" Error in eval(expr, envir, enclos) : (list) object cannot be coerced to type 'double' > Thanks a lot!!! Alessandra -- View this message in
2010 Jun 24
4
Simple qqplot question
I am a beginner in R, so please don't step on me if this is too simple. I have two data sets datax and datay for which I created a qqplot qqplot(datax,datay) but now I want a line that indicates the perfect match so that I can see how much the plot diverts from the ideal. This ideal however is not normal, so I think qqnorm and qqline cannot be applied. Perhaps you can help? Ralf
2000 May 25
4
Needed: Understading runif() output :-)
Dear all, I have been trying to understand what runif() is telling me. I am generating lots of numbers (billions and billions (wow, I''ve dreamed about saying that for many years... :-) ), for a distribution that has the following quantile function: 1 / (2 * sqrt(1 - p)) (that is, the distribution has a lower cutoff) As you can imagine, this has rather heavy upper tail. I was
2020 Jun 26
4
Quedarse con las muestras de una BD que están presentes otra, basado en dos variables
Buenas tardes, quedarme con las muestras de una BD (data) que están presentes en otra (datax), cuando se tiene una variable que nunca se repite (Key) es fácil: data <- subset(data,data$Key %in% datax$Key). Mi problema es cuando la exclusividad viene dada por dos variables. P.e., las coordenadas de un mapa: lon y lat. ¿Como puedo quedarme con las muestras de una df cuya lon y lat son iguales a
2007 Mar 20
1
Symbol and Ellipsis problems
Hi Everyone, When I have a load of functions which have various arguments passed via the ellipsis argument it keeps on assigning them as symbol making them unusable to the function. My current work around involves using do.call but this is rather cumbersome. Does anyone know why it suddenly changes the types to symbol and if there is a way to get the actual data pointed to by the symbol? (I
2005 Sep 16
2
help required on read.table
Hi all i am facing a peculiar problem for data input using read.table which i never faced previously. i have a data file by name abnew.txt with two coloumns data as depicted below. A B 420 422 314 321 the txt file is created using the excel save as option. i issued the statement as > a <- read.table("abnew.txt", header=TRUE) > a X.??S 1 NA 2 2 3 2
2006 Jul 31
4
question about dataframe ("sensory") in PLS package
Dear all, I am trying to my dataframe for the PLS analysis using the PLS package. However I have some trouble generating the correct dataframe. The main problem is how to use one name to represent several columns in the dataframe. The example dataframe in PLS package is called "sensory". I cannot directly read the data file since it's a binary file. If I use
2007 Oct 29
5
problem in starting xend
problem in starting xend I tried to install xen, but got some errors when starting xend. as I logged in and tried to start xend (/etc/init.d/xend start). I just got six-seven dot (.) printed out, then it stops. I looked more closely and found that xend could not start. then I looked at /var/log/xend-debug.log. here is the last few lines: ^^^    Exception starting Xend: no element found: