similar to: Why my code does not draw? how to fix it? plz....

Displaying 20 results from an estimated 600 matches similar to: "Why my code does not draw? how to fix it? plz...."

2012 Oct 26
3
wanna create all points.....
Plz help me ;(( I lost 7 hours for thinking and doing this code ;( I need to create points.....20 points(dots). All these dots have to be in one graph... when i run this code....it gives me only one dote..... number<- (0,2,3,4,5,6,8) for (i in seq(1:20)) {rsidpVector=rsidp(i) mean(rsidpVector) plot (length(rsidpVector), mean(rsidpVector), ylab="sample mean", xlab= "sample
2012 Oct 25
3
How generate random numbers from given vector???
I wanna generate random numbers from a vector... for example number<-c(0,1,3,4,5,6,8) so rsidp<-function(x){ i=0 for (i in seq(1:x)) {y<-sample(number,x, replace=T)} return(y) } so all random numbers have to be from vector "number"; so if I type rsidp(5)..... it has to give me 5 random numbers except 2,7,9 (because they are not in the vector "numbers"). help
2012 Oct 22
5
Help plz to fix it
I have an array of probabilities....it is p. So if user types x=1 then probability is p1=1/10. If user types x=2 it means that p2= p1+p2 if user types x=3 it means that p3=p1+p2+p3....and so on. So i created a code..... but it doesnt work properly. Help me plz to fix it) Thank u in advance. psidp=function(x){ p<-(1/10 2/5 2/5 2/5 2/5 1/10 1/10 1/10 1/10 1/10) i==0; if (x!=0){ for
2012 Oct 21
3
Help me please to code....
User has to type (input) x. After input....code has to check X with statement if There is a statement IF. If X=0 then Y=5/2 else =7; How to code it please. I tried but my code does not work ;( I wanna see how it looks like( thank u in advance( -- View this message in context: http://r.789695.n4.nabble.com/Help-me-please-to-code-tp4646932.html Sent from the R help mailing list archive at
2012 Nov 18
1
How to fix it?
Gives a mistake that "probability" is not found x<- runif(1,0,1) y<-x^5+x^8+(cos(x))^3 yrandom<- runif(10,0,3) if (y<yrandom) {probabibility=y/yrandom} area=probability*3 -- View this message in context: http://r.789695.n4.nabble.com/How-to-fix-it-tp4649955.html Sent from the R help mailing list archive at Nabble.com.
2012 Nov 18
1
Decimal places
I am a beginner in programmin in general and R specifically. I would like to generate a set of random numbers in a normal distribution but to limit the decimal places in these numbers to only 2. I have been using x1 <- runif(1,0,1) to generate my numbers. Can I add something to it to enable me to only get results rounded off to 6 decimal places? -- View this message in context:
2008 May 26
1
To draw observation [m, n] from 20 data frames named frame1, ... , frame20
Hi all, I have 20 data frames, named frame1, ... , frame20. Each data frame has the dimension 20x5. I need to build a function that calls out the observation in Row 1, Col 2 from all 20 data frames and places it in a vector of length 20. I have tried the following code: vect <- rep(0,20) for(i in 1:20){ vect[i] <- paste("frame",i,"[1,2]",sep="") } The
2009 Feb 25
1
Place independent labels between values on x-axis
I conducted a frequency averaging procedure which left me with the data frame below (Bin is an artifact of a cut() procedure and can be either as.character or as.factor): Bin Freq 1 (-180,-160] 7.904032 2 (-160,-140] 5.547901 3 (-140,-120] 4.522542 4 (-120,-100] 4.784184 5 (-100,-80] 4.490083 6 (-80,-60] 4.754268 7 (-60,-40] 5.597407 8 (-40,-20] 5.964031 9
2011 Feb 04
3
shade between two curves
Is there a function that can shade the region between two arbitrary curves? For example, how can I fill in the area between these two plotted curves? > x <- 1:10 > y <- x + rnorm(10) > z <- x + 10 + rnorm(10) > plot(x, y, type = "l", ylim = c(0,20)) > lines(x, z) I would appreciate any help. David
2006 Aug 01
2
Extracting a row number from a matrix
Hi all, I have a matrix with each column containing a large number of integers (0 and above). in each column beyond a certain row (say row 120 in column 1, row 134 in column 2, 142 in column 3...) there are only 0's. I want to find, for each column the row number of the last row which contains a positive integer beyond which there are 10 or more 0's. so in the following example (single
2011 Mar 25
2
error in bargraph.CI {sciplot}
Hi to all, Does anybody knows why this is giving an error? data(ToothGrowth) # Two-way design with options bargraph.CI(dose, len, group = supp, data = ToothGrowth, xlab = "Dose", ylab = "Growth", cex.lab = 1.5, x.leg = 1, col = "black", angle = 45, cex.names = 1.25, density = c(0,20), legend = TRUE) Error in dn.call[[1]] :
2005 May 31
2
simple predict question
Excuse the simple question... I'm not sure what I'm doing wrong with predict, but let me use this example: Suppose I do: dat<-matrix(c(0,0,10,20),2,byrow=T) lm1<-lm(dat[,2]~dat[,1]) Suppose I want to generate the linearly-interpolated y-values between the point (0,0) and (0,20) at every unit interval. I thought I just do: predict(lm1, data.frame(seq(0,10,1))) to get
2011 Jan 02
1
Please, need help with a plot
Please, I wonder if someone knows how to add the less than or equal to symbol in the plot generated by the code below: var1<-c('age <= 3','age <= 7','age <= 10','age <= 11','age <= 20','age <= 25','age <= 30','age <= 45','age <= 50','age < 55','age >= 55')
2007 Dec 04
2
Multiple stacked barplots on the same graph?
Dear R-Users, I would like to know whether it is possible to draw several stacked barplots (i.e. side by side on the same sheet)... my data look like : Cond1 Cond1' Cond2 Cond2' Compartment 1 11,81 2,05 12,49 0,70 Compartment 2 10,51 1,98 13,56 0,85 Compartment 3 1,95 0,63 2,81 0,22 Compartment 4 2,08 0,17
2012 Jun 13
3
How to plot linear, cubic and quadratic fitting curve in a figure?
Hi R experts, Could you please help me to fit a linear, cubic and quadratic curve in a figure? I was trying to show all these three fitting curves with different colour in one figure. I spent substantial time to figure it out, but I could not. I have given here a example and what I did for linear, but no idea for cubic and quadratic fitting curve > dput(test) structure(list(sp = c(4L, 5L,
2005 Jul 26
5
Plot zooming i.e. changing ylim according to xlim
Dear R-gurus, I would like to zoom in a plot, e.g. I select a region on the x-axis and then I would like the ranges on the y-axis to change accordingly. Is it possible to do this with existing functions, or do I have to invent some data selection before plotting? See below a short example, where I select ylim with trial and error, which I want to avoid. Cheers, Henrik Andersson
2008 Jun 10
3
fitting periodic 'sine wave' model
I have been attempting to estimate the periodic contribution of an effect to some data but have not been able to fit a sine wave within R. It would be nice to start by being able to fit a sine wave with an amplitude and frequency. x<-seq(0,20,by=0.5) y<-2*sin(2*pi*.5*x) #amplitude =2, frequency=0.5 # This failed to converge r<-nls(y ~ A*sin(2*pi*F*x), start=list(A = 1, F = 1),
2010 Jan 02
4
caculate the frequencies of the Amino Acids
may some one please help me to sort this out, i am trying to writ a R code for calculating the frequencies of the amino acids in 9 different sequences, i want the code to read the sequence from external text file, i used the following code to do so: x<-read.table("sequence.txt",header=FALSE) then i defined an array for 20 amino acids as following:
2009 Sep 13
1
Manage an unknown and variable number of data frames
Hi, In the code below I create a small data.frame (dat) and then cut it into different groups using CutList. The lists in CutList allow to me choose whatever columns I want from dat and allow me to cut it into any number of groups by changing the lists. It seems to work OK but when I'm done I have a variable number of data frames what I need to do further operations on and I don't know
2003 Jul 26
1
bug plotting dates?
Hello R-experts! I am using R Version 1.7.1 (2003-06-16) on a Debian Linux box and I have discovered an odd result when plotting data involving dates. Please try this minimal example: a = seq(ISOdate(2000,1,1), ISOdate(2001,1,1), "months") b = 1:13 plot(a,b, col="red") What I get is a plot that looks as expected except the x-axis is mostly red. Can anyone reproduce this