similar to: Finding the name "vector"

Displaying 20 results from an estimated 30000 matches similar to: "Finding the name "vector""

2011 Apr 06
4
problem with all/all.equal
Hi! In a function, I may have an instance in which all elements are equal. > x <- rep(1,5) > > x [1] 1 1 1 1 1 > identical(x) Error in .Internal(identical(x, y, num.eq, single.NA, attrib.as.set)) : 'y' is missing > all.equal(x) Error in is.expression(x) : 'x' is missing > I don't care what particular value it is, I just want to know if they are all
2011 Mar 13
4
readMat - how to retrieve the variables
Hello I have a matlab MAT file that contains one single variable: a. The structure of a is as follows: a.river1.flow (flow values) a.river1.date_flow (date) a.river1.precip (precipitation values) a.river1.date_precip a.river2.flow a.river2.date_flow a.river2.precip a.river2.date_precip I have used readMat to load the variable a in R, however I have no idea how readMat translates a. I managed
2010 Oct 10
2
How to add a new column to a matrix?
Hi - I am a beginner to the R language. I have written the following matrix: Z.mat=matrix(c(2,2,2,1,1,1,3,2,1,6,5,4,9,1,1,2,3,2), nrow=6) I would like to add a 4th column consisting of: 6, 9, 8, 15, 16, 17 I would also like to name each column a, b, c, d as well. Thanks! [[alternative HTML version deleted]]
2010 Sep 14
5
Problem with cat()
Dear all, I have a problem with the cat() function. Let say I have following: fn1 <- function(n = 5){ mat <- matrix(rnorm(5*5), 5, 5) cat(as.character(mat)) return(n) } However when I run above function I get this: > fn1() -0.601930631438248 -1.16950049447942 0.469257329394626 -1.39766868242906 -1.02580943892082 1.4067931110327 -1.07245318857022 -0.0205043699310245 0.234628727206755
2010 Jul 11
2
simple apply syntax
I know this is a simple question, but I have yet to master the apply statements. Any help would be appreciated. I have a column of probabilities and sample sizes, I would like to create a column of binomial random variables using those corresponding probabilities. Eg. mat = as.matrix(cbind(p=runif(10,0,1), n=rep(1:5))) p n [1,] 0.5093493 1 [2,] 0.4947375 2 [3,]
2011 Apr 12
2
a question on the use of 'solve'
Dear R users, I am in trouble using the function solve(matrix) in a loop. When it happens that I have a singular matrix, I get an error message saying so and the loop stops. My question is if there in any way to keep on going in the loop. Thank you in advance, Laura *---------------------------------------------------------* Laura Antolini, PhD Department of
2011 May 06
2
editor: not possible to change the variable name
Hi again everybody I have I new problem concerning the editor of R. It is possible to add a new variable column, but they all have the name "var1".I read somewhere that it should be possible to change the variable name by clicking on it, but that doesn't work. Is that a bug or how is it possible to change the variable header? Many thanks Matthias -- View this message in
2010 Nov 02
5
Question about ggplot2
Dear All, I am trying to graph a simple scatter plot where the x axis is year and the y axis is a percentage (percentage of infant death). Instead of plotting the raw data, I want to plot summary statistics such as mean and median. Here is the problem: the value range of y is between 0 and 1, but since infant death is a rare event, the mean and median is very low (something like 5%), which shows
2010 Oct 08
5
saving object function
Ok so if I have a function: functest<-function(x){ a<-x+1 b<-x+2 c<-x+3 paste(a) paste(b) paste(c) } Now I know I can do cat(), or return() on one of them but if I was to run the function with any number, how could I create objects to save so I could do, I am wondering if I have more than one object within my function. functest$a
2011 Aug 22
2
Two-levels labels on x-axis?
Hi, I would like to draw a stacked bar chart with four bars (say "a", "b", "c", "d") . Two bars belong to group A and the two others to group B. Therefore, I would like to have, on the x-axis, a label for each bar and an additional label for each group, positioned underneath. To give an idea, the x-axis labels should look like this: |a|b|c|d| | A | B | Do
2011 Jun 21
5
omitting columns from a data frame
Dear R People: I have a data frame, xm1, which has 12 rows and 4 columns. If I put is xm1[,-4], I get all rows, and columns 1 - 3, which is as it should be. Now, is there a way to use the names of the columns to omit them, please? Thanks so much in advance! Sincerely, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown
2010 Nov 30
3
repeat write.table with the same code many times
Dear all, I am using R version 2.9.2 in Windows. I would like to output the results of a function I have written to a .txt file. I know that I can do this by using the code write.table(boothd(10),"boothd10.txt",sep="\t",append=TRUE) etc. However, I would like to bootstrap my function 'boothd' several times and get each vector of results as a new line in my text
2010 Nov 20
10
An empty grey diagram
Hi folks, Win7 64bit R 1.12.0 I run following command on R:- > ToothGrowth > attach(ToothGrowth) > plot(dose,len) > matrics=lm(len~dose) > abline(metrics) Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) : plot.new has not been called yet Only a grey diagram is displayed without content > plot(abline(metrics)) Error in int_abline(a = a, b = b, h = h, v
2010 Jul 22
5
choosing a random sample by precentage
hi all i have found the follwoing way to choose a random sample by sample size (200): ten_per_T2000 <- F_T2000_All[sample(nrow(F_T2000_All), 200), ] but i wondered if there is a way to choose a sample size by precentage (10% etc..) thx ethan
2011 Jul 16
4
Z-test
Hi, please could you recommend a R package that computes a 2 sample z-test ? thanks, Bogdan [[alternative HTML version deleted]]
2011 Nov 14
3
max & min values within dataframe
dear R-team I need to find the min, max values for each patient from dataset and keep the output of it as a dataframe with the following columns - Patient nr - Region (remains same per patient) - Min score - Max score Patient Region Score Time 1 1 X 19 28 2 1 X 20 126 3 1 X 22 100 4 1 X 25 191 5 2 Y 12 1
2011 Mar 09
2
switch and factors
Dear list, Reading the help page for ?switch didn't give me more than a hint at what's going on here, x = 5 y = 2 foo <- function(a="x"){ switch(a, "x" = x, "y" = y) } foo(factor('x', levels=c('y', 'x'))) # 2 It seems that switch, when given a factor, uses the numeric codes rather than the string
2010 Jul 16
4
how to comment off sections
Hello, Is there an way to easy comment of sections of code? I was thinking something along the lines of \dontrun{ codeline 1 .... codeline k } but that could be used in regular script files. When I am still working on a script, I often want to being using what is done, but I would like the parts I am still working on not to be run when I use source() on the file. I can set everything off
2010 Aug 04
2
by group testing
Hello, I have a data set which is similar to the following data mice <- rep(letters[1:4],10) outcome <- sample(c(0,1),length(mice),replace=T) group <- c(rep("A",length(mice)/2),rep("B",length(mice)/2)) my.data <- data.frame(mice,outcome,group) my.sort.data <- my.data[order(my.data[,1]),] I would like to test wether there is a different between group A and B
2010 Sep 07
5
how to you output a vector to a column in excel?
What is the syntax for this? If you have: vector = c(1,2,3,4), how would you output this to column A of an excel spreadsheet? -- View this message in context: http://r.789695.n4.nabble.com/how-to-you-output-a-vector-to-a-column-in-excel-tp2530470p2530470.html Sent from the R help mailing list archive at Nabble.com.