similar to: How to write a loop?

Displaying 20 results from an estimated 2000 matches similar to: "How to write a loop?"

2013 Aug 22
1
Interpreting the result of 'cutree' from hclust/heatmap.2
I have the following code that perform hiearchical clustering and plot them in heatmap. __ library(gplots) set.seed(538) # generate data y <- matrix(rnorm(50), 10, 5, dimnames=list(paste("g", 1:10, sep=""), paste("t", 1:5, sep=""))) # the actual data is much larger that the above # perform hiearchical clustering and plot heatmap test <- heatmap.2(y)
2006 Feb 24
3
Sorting alphanumerically
I'm trying to sort a DATAFRAME by a column "ID" that contains alphanumeric data. Specifically,"ID" contains integers all preceeded by the character "g" as in: g1, g6, g3, g19, g100, g2, g39 I am using the following code: DATAFRAME=DATAFRAME[order(DATAFRAME1$ID),] and was hoping it would sort the dataframe by ID in the following manner g1, g2, g3, g6, g19,
2005 May 30
3
sapply following using by with a list of factors
Background: OS: Linux Mandrake 10.1 release: R 2.0.0 editor: GNU Emacs 21.3.2 front-end: ESS 5.2.3 --------------------------------- Colleagues I am having some trouble extracting results from the function by, used to average variables in a data.frame first by one factor (depth) and then by a second factor (station). The real data.frame is quite large > dim(data.2001) [1] 32049 11 Here is a
2009 Aug 27
2
Fw: PROBLEM - - COMPARING AND COMBINING two DATASETS
Dear Sirs, ? At the outset I sincerely apologize for reproducing my query to you. I also thank all of you for the solution you had provided. It has worked on the actual data I am working with. ? However, there is this peculiar problem which I had realized only after I had obtained my results. ? e.g. in the example I had attached ? A?<-?c(2, 2, 1, 3, 7, 3, 3, 1,?14, 7, 31) B?<-
2017 Feb 06
1
memdisk load failure on HP DL360g9
On Thu, Feb 2, 2017 at 1:26 PM, Ady Ady via Syslinux <syslinux at zytor.com> wrote: > > > Hi all, > > > > I have observed a problem where, under legacy BIOS booting mode on the > > DL360g9, memdisk fails to execute. The same mechanism works fine on the > > DL360g8. The system displays the below on the console and ceases to > > respond and must be
2010 Jul 15
1
Error using the mi package
I'm trying to impute data using the mi package, but after running through almost the entire first round of imputations (which takes quite a while), it throws this error (I'll include the whole output prior to the error for context). Does anyone know what is causing it, or how I can fix it? More specifically, how can I tell what is throwing the error so I know what to fix? Is
2009 Aug 27
2
Comparing and adding two data series
Dear R helpers   I have two series A and B as given below -   A <- c(2, 2, 1, 3, 7, 3, 3, 1, 14, 7, 31) B <- c(0.0728,0.9538,4.0140,0.0020,2.5593,0.1620,2.513,0.3798, .0033,0.2282, 0.1614)   I need to calculate the total in dataset B corresponding to the numbers in dataset A i.e. for no 1 in A, I need the total as 4.0140+0.3798 (as 1 is repeated twice) for no 2, I need the total as
2009 Jun 01
1
installing sn package
Hi r-users, I want to use the sn package but I got the following message: > install.packages(repos=NULL,pkgs="c:\\Tinn-R\\sn_0.4-12.zip") Warning: package 'sn' is in use and will not be installed updating HTML package descriptions I did tried to do it a few times but it gives the same message.  ________________________________ From:
2012 Jun 06
0
randomForest Species Distribution Modelling
Hi, I appologise if this is a rudimentary question and long winded but I just wanted to let ye know where I'm comming from. I'm new to R and I'm trying to use the 'randomForest' package to classify and predict. The Error message that is troubling me is: > pr<-predict(predictors,rf1, ext=ext) Error in x[...] <- m : NAs are not allowed in subscripted assignments In
2003 May 21
2
Answer not detected?
I have this in extensions.conf: exten => 1,1,Dial,Zap/g9/4439568899/|24 exten => 1,2,VoiceMail(u8004) and this happens: -- Playing 'js-joe-trvm' -- Executing Dial("Zap/2-1", "Zap/g9/4439568899/|24") in new stack -- Called g9/4439568899/ -- Zap/1-1 is ringing -- Zap/1-1 is ringing -- Nobody picked up in 24000 ms -- Hungup
2012 Jul 12
1
cpu leveling on opensource xen on sles
We currently run xen on sles11sp1 and sles11sp2. Our hardware is HP Compaq DL360''s. We originally started with G6''s, but now we''ve grown and have G7''s and G8''s in the mix. We don''t do a lot of live migrations but is convenient to be able to at times. Is there any type of cpu leveling that can be done so live migrations will work with servers
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 Apr 12
1
APC 1500 USB problem
Hello, We have two APC Back-UPS RS 1500 USB stuff, and i've got a bit of a problem with it and NUT. The usbdevs output: addr 2: Back-UPS RS 1500 FW:8.g8 .I USB FW:g8, American Power Conversion addr 3: Back-UPS RS 1500 FW:8.g8 .I USB FW:g8, American Power Conversion (UPS1 and UPS2) I've configured our NUT system to monitor the UPSes, and it went very fine till the time had arrived for a
2013 Feb 07
4
help with creating new variables using a loop
Hi there, I've got a set of 10 numeric variables called Mood1 to Mood10 in a dataset called mood. I'm trying to create a set of 10 new variables called m1 to m10 so that m1=Mood1*1, m2=Mood2*2, etc to m10=Mood10*10 Trawling through the internet, I eventually tried the following code: for (i in 1:10){ assign(x=paste0("mood$m",i),
2010 Dec 06
3
[plyr] Question regarding ddply: use of .(as.name(varname)) and varname in ddply function
Dear R-Helpers: I am using trying to use *ddply* to extract min and max of a particular column in a data.frame. I am using two different forms of the function: ## var_name_to_split is a string -- something like "var1" which is the name of a column in data.frame ddply( df, .(as.name(var_name_to_split)), function(x) c(min(x[ , 3] , max(x[ , 3]))) ## fails with an error - case 1 ddply(
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
2005 Aug 13
1
How to change the names in tone pitch column
Hi, I have a column (V4) in a midi event list which includes tone pitch names, i.e. "A4, E4, C#4, A3...": > compo[1:10,] V1 V2 V3 V4 V5 V6 V7 1 1 1 0 A4 96 2 0 2 1 1 0 E4 96 2 0 3 1 1 0 C#4 96 2 0 4 1 1 0 A3 96 2 0 5 1 3 0 B4 96 1 0 6 1 3 0 E4 96 1 0 7 1 3 0 B3 96 1 0 8 1 3 0 G#3 96 1 0 9 1 4 0 C#5 96 1 0 10
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
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 ...
2005 Dec 04
1
Back-UPS RS6000
Hi all, I have an APCC Back-UPS XS 1000 (it's a USB device) that I'm using with nut 2.0.2 that came with Fedora Core 4. It reports itself like this: Back-UPS RS 1000 FW:7.g8 .D USB FW:g8 in the nut web status page, which seems a tad messy. It otherwise works fine, except I don't get any information on the input and output voltages. I'm using the hidups driver. My