similar to: resampling from string when it runs across multiple lines

Displaying 20 results from an estimated 20000 matches similar to: "resampling from string when it runs across multiple lines"

2008 Mar 30
2
problem with white space
Hi, I need to resample characters from a dataset that consists of an extremely long string that is written over hundreds of thousands of lines, each of length 50 characters. I am currently doing this by first inserting a space after each character in the dataset and then using the following commands: y <- as.matrix(read.table("data.txt"), stringsAsFactors=FALSE) bstrap <-
2006 Sep 22
2
A simple resampling problem
Dear UseRs I would like to show my students how to use "resampling" to solve the following simple problem: If a family has two children of which one is a boy, what is the probability that the other child is also a boy. The answer is (obviously) 1/3, and can be show easily using the usual methods. But I would like to get the students to think of resampling, by doing the following:
2009 Nov 15
2
resampling problem counting number of means above a specific value
I am trying to modify some code from Good 2005. I am trying to resample the mean of 8 values and then count how many times the resampled mean is greater than 10. But my count of means above 10 is coming out as zero, which I know isn't correct. I would appreciate it if someone could look at the code below and tell me what I am doing wrong. Many thanks, Graham > LL<-
2008 May 06
2
Concatenate a vector into a string, only using distinct component
I'm trying to use combine c('a','b','c','a','c') into 'a, b, c', the order does not matter. paste(c('a','b','c','a','c'), collapse=', ') yields 'a, b, c, a, c'. Any idea? -- Regards, Anh Tran [[alternative HTML version deleted]]
2005 Oct 07
2
finding missing lines...
Take this as an example: > a=data.frame(col1=c(1,2,3,4,5), col2=c ("my","beloved","daughter","son","wife")) > b=data.frame(col1=c(1,2,4), col2=c("my","beloved","son")) > a col1 col2 1 1 my 2 2 beloved 3 3 daughter 4 4 son 5 5 wife > b col1 col2 1 1 my 2
2006 Jun 06
2
about string
Hello sir: There are 2 questions about string. 1 How to calculate the width of a string? e.g string "abc"'s width is 3; 2 How can I get the "substring" in such kind of condition: "f:\\JPCS_signal.txt" "f:\\PC1_signal.txt" "f:\\PC2_signal.txt" What I wanna get is "JPCS" "PC1" "PC2".How can I achieve them by R
2005 Oct 20
2
String manipulation
R-help, I have a data frame which contains a character string column that is something like; II11 II18 II23 III1 III13 III16 III19 III2 III7 IV10 IV11 IV12 IX16 IX4 V12 V18 V2 V20 V23 V4 VII14 VII18 VII21 VII26 VII28 VII33 VII4 VII48 VII5 .... .... .... I want to apply a function (e.g mean) by grouping according to the roman part of the string, i.e, by I by V by VII ... ... and so on. I have
2005 Feb 21
2
character occurence within a string
Hello, I'm looking for a function that counts the occurences of a given character within a string. f('|','ab|c|d') => 2 More precisely, I need to complete a vector of strings to ensure that all elements have the same count of a "separator": a|b|c a |a|b|c|d => a|b|c|| a|||| |a|b|c|d I guess that scan makes use of an internal function that would do
2006 Oct 18
2
multiline string continuation
Dear R experts, I wonder how can one input a string variable in multiple lines in a R script. I've seen solution to the command line continuation in the non-string situation (just continute at the new line). However, that doesn't work for strings because the new line character, "\n", is included in the resultant string. For example, if I type the following in a script:
2004 Jul 19
5
converting character strings to eval
Hi there fellow R-users, I'm stuck on this seemingly trivial problem. All I want to coerce a character string into a command. For example: x<-rnorm(20) y<-rnorm(20) str<-"lm(y~x)" I want to evaluate the "str" command. I have tried eval(as.expression(str)) But it doesn't seem to work. I am aware of the call command, but for reasons I won't go
2006 May 12
3
Maximum likelihood estimate of bivariate vonmises-weibulldistribution
Thanks Dimitris!!! That's much clearer now. Still have a lot of work to do this weekend to understand every bit but your code will prove very useful. Cheers, Aziz -----Original Message----- From: Dimitrios Rizopoulos [mailto:Dimitris.Rizopoulos at med.kuleuven.be] Sent: May 12, 2006 4:35 PM To: Chaouch, Aziz Subject: RE: [R] Maximum likelihood estimate of bivariate
2008 Apr 09
4
apply lm() for all the columns of a matrix
Hi all, My question is not really urgent. I can write a loop and solve the problem. But I know that I'll be in a similar situation many more times so it would be useful to find out the answer Is there a fast way to perform linear fit to all the columns of a matrix? (or in the one dimension of a multi-dimensional array.) I'm talking about many single linear fits, not about a multiple fit.
2006 Jun 04
2
slanted ends of horizontal lines for certain line widths
Hello, if I plot a horizontal line, e.g., plot(c(1,2),c(1,1),xlim=c(0,3),lwd=2,type="l") or plot(c(1,2),c(1,1),xlim=c(0,3),lwd=4,type="l") then the left end (1st example) or both ends (2nd example) of the lines are not rectangular but slanted on the graphical display (screen). That behavour first occurred when I was trying to plot a stepfun, e.g., y <-
2004 Sep 29
3
R: string connections
hi all i have a simple question: lets assume that i can enter a variable (a) equal to some value, say 100. obviously a could be any value. i would like to create a plot with a main heading as hi all "some writing" + a how would own create a string by combining a string with a numeric variable? hope the question is not too confusing. e.g. say a=5 then i want something like
2005 Sep 25
2
getting variable length numerical gradient
Hi all. I have a numerical function f(x), with x being a vector of generic size (say k=4), and I wanna take the numerically computed gradient, using deriv or numericDeriv (or something else). My difficulties here are that in deriv and numericDeric the function is passed as an expression, and one have to pass the list of variables involved as a char vector... So, it's a pure R programming
2005 Jan 26
2
string evaluation
Hello, I would like to be able to compose an expression using some of the arguments I give to a function, that is assuming I have a list such as: my.list<-list(A=1:3,B=c("Brave", "new", "world")) and a function printComponent<-function(component){ if (component=="A"||component=="B"){
2006 Mar 02
2
'...' passed to both plot() and legend()
Dear R-devels, I'd like to create a plot method for a class of objects that passes the '...' argument to both plot() and legend(), e.g., x <- list(data = rnorm(1000)) class(x) <- "foo" plot.foo <- function(x, legend = FALSE, cx = "topright", cy = NULL, ...){ dx <- sort(x$data) plot(dx, dnorm(dx), type = "l", ...) if (legend)
2006 Jun 16
3
Vector Manipulation
I have a vector that has 1,974 elements and each element is one of the following (B, F, N, Y). How do I recreate that vector accept in the place of N put 0 and in the place of B, F or Y put a 1? Thanks, Jacob [[alternative HTML version deleted]]
2005 Oct 25
8
Can anyone please tell me how to strip the white spaces from a character vector?
for example: > a$tic[1:10] [1] "AIR " "ABCB " "ABXA " "ACMR " "ADCT " "ADEX " [7] "ABM " "AFCE " "AG " "ATG " Can anyone please tell me how to strip the white spaces from a$tic? Thanks, Roger [[alternative HTML version deleted]]
2005 May 19
2
plot question
hi all: xlim and ylim are used to define the interval limits of a plot. I'm interested in the scale of values between this limits. suppose xlim=c(0,10) we can have e.g. 0 5 10 0 2 4 6 8 10 0 1 2 3 4 5 6 7 8 9 10 which is the parameter that allows me to modify this? thanks in advance alexandre