similar to: first occurrence of a value?

Displaying 20 results from an estimated 900 matches similar to: "first occurrence of a value?"

2017 Oct 05
3
dealing with a messy dataset
dear Jim, Thanks for your reply and your proposition. I forgot to provide the header of the dataframe, here it is: ================================================================================ Byte-by-byte Description of file: lvg_table2.dat -------------------------------------------------------------------------------- Bytes Format Units Label Explanations
2017 Oct 05
0
dealing with a messy dataset
You should be able to use that header information to create the correct parameters to the read_fwf function to read in the data. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Thu, Oct 5, 2017 at 11:02 AM, jean-philippe <jeanphilippe.fontaine at gssi.infn.it> wrote: > dear Jim, > > Thanks
2010 Apr 30
1
re.findall equivalent?
Hi, The regular expression (grep) below does not behave at all like the equivalent in Python. Also, I would be happy if somebody could tell me what the R equivalent for Python's re.findall is. The regex filters out any numbers not enclosed by square brackets, including fractions (with either comma or dot as the separator) and percentages. How should the R code below be modified so it does the
2017 Oct 05
0
dealing with a messy dataset
It looks like fixed width. I just used the last position of each field to get the size and used the 'readr' package; > input <- "And XVIII 000214.5+450520 0.69 17 9 0.00 -8.7 26.8 6.44 6.78 < 6.65 -44 0.5 MESSIER031 0.6 1.54 + PAndAS-03 000356.4+405319 0.10 17 0.00 -3.6 27.8 4.38 2.8 MESSIER031
2017 Oct 05
1
dealing with a messy dataset
dear Jim, Yes I fixed the problem. Thanks again all of you for your contribution! This worked : start <- c(1, 20, 35, 41, 44, 48, 53, 59, 64, 70, 76, 78, 83, 88, + 93, 114, 122, 127) data1<-read_fwf("lvg_table2.txt",skip=70, fwf_widths(diff(start))) Well now I know how to deal with fixed-width files :) Cheers Jean-Philippe On 05/10/2017 18:42, jim
2010 Aug 24
2
chisq.test on samples of different lengths
Hello, I am trying to see whether there has been a significant difference in whether people experienced damages from wildlife in two different years. I therefore have two columns: year 1: yes no no no yes yes no year 2: no yes no yes I wanted to do a chisq.test, but if I enter it this way: chisq.test(year1, year2) I get the error saying the columns are two different lengths. So then I tried
2008 Dec 10
2
how to merge panel data stored by variable?
Hi, I have two datasets stored in tab-separated format in the following way file1: country year1 year2 Germany var1 var1 Hungary var1 var1 file2: country year1 year2 Germany var2 var2 Hungary var2 var2 I can easily read in these files, but how can I merge them as a panel dataset? Thanks, Viktor
2011 Jul 27
2
for loop help
I am having a hard time putting the below into a loop, where it pulls out ppt from all he stations I have versus having to go through and hard code the data to the specific stations. I tried stnID <- stnid[which(duplicated(stnid)==FALSE)] for(i in 1:length(stnID)) { ppt[i] <- ppt[which(stnid==[i])] } but it doesn't like to use the which function inside a for loop? Any idea's here is
2017 Oct 05
4
dealing with a messy dataset
dear R-users, I am facing a quite regular and basic problem when it comes to dealing with datasets, but I cannot find any satisfying answer so far. I have a messy dataset of galaxies like that : And XVIII 000214.5+450520 0.69 17 9 0.00 -8.7 26.8 6.44 6.78 < 6.65 -44 0.5 MESSIER031 0.6 1.54 PAndAS-03 000356.4+405319 0.10 17 0.00 -3.6 27.8 4.38
2010 Jul 22
1
check menu button (tcltk)
Hi,   I am making a mock user interface in tcltk and I would like to add a 'check menu button' such as shown here: http://zetcode.com/tutorials/pygtktutorial/images/checkmenuitem.png   Does anybody know how to do this? I am quite new to R. Cheers!! Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All right, but apart from the sanitation, the medicine,
2010 Nov 23
2
Help with grouped barplot
Given the data structure below, how can I create a bar plot for the values of disc for each area grouped by year? bar <-structure(list(year = c(2003, 2003, 2003, 2003, 2003, 2003, 2003, 2007, 2007, 2007, 2007, 2007, 2007, 2007), area = structure(c(6L, 4L, 1L, 2L, 3L, 5L, 7L, 6L, 4L, 1L, 2L, 3L, 5L, 7L), .Label = c("AK", "ID", "MT", "NW",
2010 Apr 29
1
UpdateLinks = FALSE
Hi,   I'm reading 100s of excel files and many of them contain links to external files (I hate that, but that aside). Every time such a file is opened, a menu pops up asking if I want to update the links. I never want to update the links. I used the macro recorder to see what code would be needed to suppress that message, but to no avail (I tried more variations, but one attempt is shown
2010 Jan 30
2
drawing a line that shifts from solid to broken
I am graphing longitudinal data from three time points. I'd like to draw a solid line from point 1 to point 2, and then a dashed line from point 2 to point 3. It works if I do it in two steps: > first.vector <- c(mean(year1$variable1), mean(year2$variable1)) > second.vector <- c(NA, mean(year2$variable1), mean(year3$variable1)) > plot(first.vector, type="b",
2006 Dec 14
1
legend/plotmath/substitute problem
Dear R Experts, I am trying to produce a legend for a series of plots which are generated in a loop. The legend is supposed to look like this: 2000: gamma=1.8 where gamma is replaced by the greek letter and both the year and the value of gamma are stored in variables. Everything works fine as long as I have only one data series: year = 2001 g = 1.9 plot(1) legend('top',
2011 May 26
2
NaN, Inf to NA
Hi, I want to recode all Inf and NaN values to NA, but I;m surprised to see the result of the following code. Could anybody enlighten me about this? > df <- data.frame(a=c(NA, NaN, Inf, 1:3)) > df[is.infinite(df) | is.nan(df)] <- NA > df a 1 NA 2 NaN 3 Inf 4 1 5 2 6 3 > Thanks! Cheers!! Albert-Jan
2011 May 26
2
NaN, Inf to NA
Hi, I want to recode all Inf and NaN values to NA, but I;m surprised to see the result of the following code. Could anybody enlighten me about this? > df <- data.frame(a=c(NA, NaN, Inf, 1:3)) > df[is.infinite(df) | is.nan(df)] <- NA > df a 1 NA 2 NaN 3 Inf 4 1 5 2 6 3 > Thanks! Cheers!! Albert-Jan
2012 Jun 24
2
Defining multiple variables in a loop
Good day, For lack of a better solution (or perhaps I am ignorant to something more elegant), I have been bootstrapping panel data by hand so to speak and I would like to know if there is a way to define multiple variables in a loop using the loop variable. I found a post (here: https://stat.ethz.ch/pipermail/r-help/2002-October/026305.html ) that discussed naming multiple variables but it
2013 Apr 18
1
Arranging two different types of ggplot2 plots with axes lined up
Hi all, I want to arrange two ggplot2 plots on the same page with their x-axes lined up - even though one is a boxplot and the other is a line plot. Is there a simple way to do this? I know I could do this using facetting if they were both the same type of plot (for example, if they were both boxplots), but I haven't been able to figure it out for two different types of plots. Below is my
2007 Jun 29
1
Assign name to a name
I would like to know how I can assign a name to a name. I have a dataset that has different years in it. I am writing scripts using R and I would like to give a month a generic name and then use the generic name to do different analysis. The reason for the generic name would be so that I only have to change one thing if I wanted to change the year. For example. Year1 = 1999 datayear <-
2011 May 03
1
Rodbc quesion: how to reliably determine the data type?
Hello, How can I tell RODBC to scan all the records of an xls file to determine the data type? If the first n records happen to be empty Rodbc assumes a character, and any numbers are made <NA>. And if, for instance, the first n records contain numbers, and later they also contain characters, those characters become NA. Cheers!! Albert-Jan