similar to: help with creating new variables using a loop

Displaying 20 results from an estimated 800 matches similar to: "help with creating new variables using a loop"

2013 Feb 08
1
help with double looping
hi there, I have a dataframe in the shape vA1, vA2,..., vA11, vB1, vB2,..., VB11,......., VP1, VP2,...., VP11 (so 16 times a sequence of 11 variables) I am trying to build a double loop so that i can apply the function (i-1)*v(i) to the first 10 variables, then the same for the next 10 variables, etc... 16 times. I have tried the following with no luck: iscores<-list() for (j in
2009 Jun 11
3
Matrix manipulation
Hello everyone, I have a couple of fairly simple questions (I hope) the answers to which I cannot find through the documentation at the moment. 1. I would like to delete the a row from a matrix if a certain elimination criterion is met. I am familiar with x <- x[-7,] (to remove row 7, for example). Are there any other means of removing an entire row? 2. Is there a single command that
2009 Apr 22
4
read.table or read.csv without row index?
Hello all, Probably my concepts about the data.frame and matrix and array in R are not clear, I need some clarification to help me understand them better. >M <- read.table("test1.csv",sep=",",row.names=NULL,header=T) gives me: M as M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 1 9 11 14 15 18 20 20 20 20 20 2 3 4 8 9 11 12 14 15 15 15 3 4 5 8 8 9 9 9 9 9 9 4 4
2009 Jun 11
2
More basic question
I have encountered a more fundamental problem in my data set. I''m using read.csv, and all the data are imported as character. How do I do a string comparison in a line like this: M10[ !sapply(1:10, function(x)666 %in% M10[x,]), ] Alternately, how do I change the class type on a column in a data frame from character to numeric? Thank you very much. Payam [[alternative HTML version
2007 Mar 16
2
Discriminating between experiments with xyplot (lattice)
Hi, suppose I have data from 3 experiments which show conversion as a function of time for different boundary conditions, e.g. pressure, temperature. I want to plot all experiments as conversion over time grouped according to the temperature. However, since I have more than one experiment performed at the same temperature (but different pressures) I end up figuring out which curve belongs
2006 Feb 22
8
filtering "tags" via checkboxes - HABTM
First post/newbie post... bear with me. What I''m trying to achive (music site): A system containing tracks and moods with a HABTM relationship. I''ve got all that set up and functioning in the admin environment - i.e. admins can apply a variety of moods to a particular track via a series of checkboxes. Join table works just fine. I''m currently stuck on allowing
2008 Dec 26
3
lm() with same formula but different column/factor combinations in data frame
Hi, I am trying to find an efficient way of applying a linear regression model to different factor combinations in a data frame. I want to obtain the output with minimal or no use of loops if possible. Please let me know if this query is unclear. Thanks, Murtaza
2006 Dec 06
1
Problem with puppetd --listen
Hello all, I have a little problem with the --listen option. Id like my client servers to update only when I run puppetrun on the puppetmaster server. So far, I tried: puppetd --listen --server mymasterserver -v (on the client server) Then: puppetrun --host myclientserver The updates runs ok... but the client check for updates again every 30 mins or so and I dont want him to do so. I tried:
2006 Dec 11
1
How to deal with log and puppetrun?
Hello, Now that I can run my client with the --silent and --no-client option, Id like to centralize the logs on my puppet server and not on my puppet clients. The problem is that so far I havent found an option to tell puppetrun to get the logs back on my server. Is that possible to do such a thing with puppetrun? (running on v.0.18.4) Thanks in advance. -- Jean-Christophe Lacaze Ministry
2011 Aug 13
1
Own R function doubt
Hi to all the people again, I was writting a simply function in R, and wish to collect the results in a excel file. The work goes as follows, Ciervos<-function(K1, K0, A, R,M,Pi,Hembras) {B<-(K1-K0)/A T1<-(R*Pi*Hembras-M*Pi+B)/(Pi-M*Pi+R*Pi*Hembras) P1<-Pi-B R1<-P1*Hembras*R M1<-P1*M T2<-(R1-M1+B)/(P1-M1+R1) P2<-P1-B R2<-P2*Hembras*R M2<-P2*M
2009 Dec 08
6
conditionally merging adjacent rows in a data frame
Hi, I have a data frame and want to merge adjacent rows if some condition is met. There's an obvious solution using a loop but it is prohibitively slow because my data frame is large. Is there an efficient canonical solution for that? > head(d) rt dur tid mood roi x 55 5523 200 4 subj 9 5 56 5523 52 4 subj 7 31 57 5523 209 4 subj 4 9 58 5523 188 4 subj 4 7
2012 Nov 07
1
[LLVMdev] using large structures in registers/returns
I can't find a lot of information about using structures directly as parameters, returns, and in registers. Is this fully supported on all platforms? Does it always convert to creating a hidden parameter when too large? For example (assume very.large is too big to fit in the target machine registers): define %very.large @get_struct() { %m1 = insertvalue %very.large undef, i32 10, 0 ...
2018 May 22
0
How to average values from grid cells with coordinates
Hi Jim, Thanks. It works. I now have more complex problems. If at each blackcell, there are two variables such as pop and mood. For each variable, there are daily records in one year, so 365 records for pop and 365 records for mood. The averaged values for the redcells should be daily records too. What kind of format do you recommend for this problem? Right now, I just get the latitudes and
2018 May 20
1
How to average values from grid cells with coordinates
Hi lily, It's not too hard to do it using dataframes. Getting the indexing right is usually that hardest part: # these values are the centers of the black cells lat<-rep(28:38,11) lon<-rep(98:108,each=11) pop<-sample(80:200,121) # just use the data.frame function blackcells<-data.frame(lat=lat,lon=lon,pop=pop) plot(0,type="n",xlim=c(97.5,108.5),ylim=c(27.5,38.5),
2001 Jun 20
1
vorbis tag for general music type?
Hi, I am wondering if vorbis has a standard tag for general music type. I don't mean pop, jazz, etc., but something more in line with describing the mood of the mucic. I am thinking of games which have a soundtrack in vorbis format which could use the user's own repository of .ogg files during gameplay, and use the tag to choose appropriate music for that part of the game. For
2009 May 27
1
How to write a loop?
Dear R helpers,   Following is a R script I am using to run the Fast Fourier Transform. The csv files has 10 columns with titles m1, m2, m3 .....m10.     When I use the following commands, I am getting the required results. The probelm is if there are 100 columns, it is not wise to define 100 commands as fk <- ONS$mk and so on. Thus, I need some guidance to write the loop for the STEP A and
2007 Sep 13
4
SSH contribution?
List, Whilst I'm in the mood for contributing stuff, here's another little howto I wrote on securing SSH that has proved popular in the past: http://forums.pcper.com/showthread.php?t=433216 If you feel it is suitable and you would like me to contribute it to the CentOS wiki, just set up a page in the appropriate area and I'll be happy to add it. Regards, Ned
2012 Dec 19
1
confirming a formula for use with lmer
Hello, I recently began using R and the lme4 package to carry out linear mixed effects analyses. I am interested in the effects of variables 'prime','time', and 'mood' on 'reaction_time' while taking into account the random effect 'subjects.' I've read through documentation on lme4 and came up with the following formula for use with lmer:
2009 Oct 16
2
Matrixes as data
Hola! I am working on a problem where data points are (square) matrices. Is there a way to make a "vector" of matrices, such that it can be stored in a data.frame? Can that be done with S3? or do I have to learn S4 objects & methods? Kjetil
2010 Apr 06
1
median of two groups
Dear all, What is the right test to test whether the median of two groups are statistically significant? Is it the wilcox.test, mood.test or the ks.test? In the text book I have got there is explanation for the Wilcoxon (Mann Whitney) test which tests ob the two variable are from the same population and also ks.test! Regards, Cheba [[alternative HTML version deleted]]