Displaying 6 results from an estimated 6 matches for "tateneni".
2010 May 20
3
regex help: splitting strings with no separator
Greetings,
I have a vector of values that are a word followed by a number, e.g., x =
c("Apple12","HP42","Dell91"). The goal is to split this vector into two
vectors such that the first vector contains just the words and the second
contains just the numbers. I cannot use strsplit (or at least I do not know
how) as there is no obvious separator.
I can use sub to
2009 Jul 07
3
Numbering sequences of non-NAs in a vector
Greetings, I have a vector of the form:
[10,8,1,3,0,8,NA,NA,NA,NA,2,1,6,NA,NA,NA,0,5,1,9...] That is, a combination
of sequences of non-missing values and missing values, with each sequence
possibly of a different length.
I'd like to create another vector which will help me pick out the sequences
of non-missing values. For the example above, this would be:
2010 Jan 06
1
Write a blank line to CSV
Greetings and happy new year!
I'm attempting to write a series of tables to a CSV file, and would like to
insert a blank line after each table. To do this, I use:
> write.csv(NULL,"tables.csv",append=T)
which appears to work, except that this warning is thrown:
> Warning message:
> In write.table(NULL, "tables.csv", append = T, col.names = NA, :
> appending
2010 Aug 06
2
stats::reshape question
Hello,
A quick question for my edification. When I run the following (R 2.8.1 on
Microsoft Windows):
> d = data.frame(x1=c(1,2),x2=c(3,4),y1=c(5,6),y2=c(7,8))
> reshape(d,varying=c("y1","x1","y2","x2"),v.names=c("y","x"),dir="long")
I found myself surprised by the results--the column labeled "y" is actually
2010 Dec 02
2
Hmisc label function applied to data frame
Hello,
I'm attempting to create a data frame with correlations between every pair
of variables in a data frame, so that I can then sort by the value of the
correlation coefficient and see which pairs of variables are most strongly
correlated.
The sm2vec function in the corpcor library works very nicely as shown here:
library(Hmisc)
library(corpcor)
# Create example data
x1 = runif(50)
x2 =
2010 Sep 16
2
glm: formula vs character
Hello,
This is a question motivated by curiosity, not a pressing problem. Any
responses are much appreciated! In the following code, function reg1 calls
glm with a formula object while reg2 uses a string. In both cases, glm
works; however, in the second case, the add1 function fails with the
following message: "Error in eval(predvars, data, env) : invalid 'envir'
argument."