similar to: Character manipulation using "strsplit" & vectorization

Displaying 20 results from an estimated 10000 matches similar to: "Character manipulation using "strsplit" & vectorization"

2010 Jan 18
3
Using the output of strsplit
I successfully combined my data frames, and am now on my next hurdle. I had combined the data and quarter, and used tapply to count the entries for each unique date/quarter pair. ar= tapply(ewrgnd$gw, list(ewrgnd$dq), sum) #for each date/quarter combination sums the gw (which are all 1) dq=row.names(ar) spl=strsplit(dq) But I need to split them back into the separate date and quarter. So I used
2009 Jul 03
2
mapping states with colors
Hi folks, I'm just learning how to use maps. As an initial foray, I'm mapping the states that have "duty to retreat" (blue) and "stand your ground" (red) self-defense standards. Here is my extremely naive script: dtr <- c('alabama', 'arizona', 'conneticut', 'delaware', 'dist of columbia' , 'hawaii',
2012 Nov 03
1
Logical vector-based extraction
Hello, The most part of the program works except that the following logical variable does not get created although the second logical variable-based extraction works. I don't understand what I am doing wrong here. state_pflt200 <- df$p_fatal <200 df[state_pflt200, c("state.name","p_fatal")] I would appreciate receiving your help. Thanks, Pradip Muhuri
2012 Sep 12
1
Plotting US States: Issue with filled colors cycling
I'm having issues when trying to do a filled State plot using the maps() package. It seems that the color values aren't being plotted correctly, and I'm not sure why... I've started debugging it, but I'm stuck. I've attached the code that I've got so far. The for loop plots states 1:i. What I'm noticing is that the colors are correct until after Michigan gets
2013 Jan 08
2
Applying a user-defined function
Hello List, My goal is to apply a user-defined function on several columns of a data frame. When testing the code on a reproducible example below, I get the following error message. > #now Write a new function using the above cut ()/quantile function to apply on different columns of the data frame > > CutQuintiles <- function(x) { + cut (test1$x,quantile (test1$x,
2012 Dec 31
3
cut ()
Hello List, My goal is to create a 5 category variable (p1_st_data$ob_mrj_cat), based on the p1_st_data$obt_mrj_p variable, using the following code for 50 States and District of Columbia (N=51). p1_st_data$ob_mrj_cat <- cut (p1_st_data$obt_mrj_p, quantile (p1_st_data$obt_mrj_p, (0:5/5), include.lowest=TRUE)) The issue is that, for Utah, I am getting an <NA> instead of (42,48.7] in
2006 Jul 08
6
Trying to create pulldown select menu for US State form fiel
I noticed there is a country_select. Is there anything like us_state_select maybe? More specifically - I''m wondering if I manually have to populate an array with all the U.S. state abbreviations so users can select which state they live in while entering their mailing address. -- Posted via http://www.ruby-forum.com/.
2009 Nov 02
4
Incremental ReadLines
I've been trying to figure out how to read in a large file for a few days now, and after extensive research I'm still not sure what to do. I have a large comma delimited text file that contains 59 fields in each record. There is also a header every 121 records This function works well for smallish records getcsv=function(fname){ ff=file(description = fname) x <- readLines(ff)
2008 Aug 02
0
thematic maps, missing data, gmap
Running R version 2.6.1 under Gentoo Linux, I'm trying to produce a thematic map of the USA using the gmap package and its function USALevelPlot. The variable whose levels are to be plotted is observed for 49 states but missing for one (Delaware). I would like to produce a map in which the states for which data exist are shaded and Delaware is represented only by an outline. In contrast
2015 Jun 21
2
Trying to re-install ZFS drivers
What should have been a routine upgrade to ZFS 0.6.4.1-1.el6.x86_64 somehow failed, and now I've lost access to a 2T raidz2 array. I've tried removing all zfs and related packages (spl*), then starting fresh. For reasons that have have nothing to do with this problem (I don't think), I'm still booted to kernel 2.6.32-431.29.2.el6.x86_64, and there are no other kernels installed.
2004 Feb 19
1
piece wise application of functions
Dear all, After struggling for some time with *apply() and eva() without success, I decided to ask for help. I have 3 lists labeled with, each contains 3 different interpolation functions with identical names: > names(missgp0) [1] "spl.1mb" "spl.2mb" "spl.5mb" > > names(missgp1) [1] "spl.1mb" "spl.2mb" "spl.5mb" > >
2007 Aug 30
1
Barplot2 using for loop, how to adjust margins?
Hi R-users, I inted to make multiple plots using for loop. The question is how can I adjust the left hand side margin of the plot according to the names.arg argument in barplot2. In every plot I have different annotations in the y axis and they vary in length. Now when I have fixed margins opar <- par(mar=c(3,15,0,2)... I get the same margins in all of the plots. That leaves lots of white
2008 Jul 03
2
How do I paste double quotes arround a character string?
Hi R Community: I've got a character string that looks like: New Mexico How to I create the new character string that looks like: "New Mexico" That is, it is the original string (New Mexico) with double quotes infront and behind it? Thanks, Phil Smith
2002 Nov 25
2
Pspline smoothing
Dear all, I'm trying to use the Pspline add-on package to fit a quintic spline (norder =3), but I keep running into a Singularity error. > traj.spl <- smooth.Pspline(time, x, norder=3 ) Error in smooth.Pspline(time, x, norder = 3) : Singularity error in solving equations > Playing around with the other parameters produces an "unused arguments" error: > traj.spl
2005 Jul 20
2
.spl files
I am not certain that this is the right place to post this, but maybe some kind soul can point me in the right direction if not. And I apologize if this is the wrong spot...The reason I posted here is that I recall running across a syslinux changlog that said "..added support for reading .spl..." files. I want to customize the suse boot up splash screens (for a CD install). I have been
2006 Jul 31
0
Choropleths maps of the USA states (PR#9111)
Dear Colegues: I have tried to reach Ray Brownrigg, Ray.Brownrigg at mcs.vuw.ac.nz but my mails have turned back with the following comment did not reach the following recipient(s): Brownrigg at mcs.vuw.ac.nz on Mon, 31 Jul 2006 12:52:39 +0100 There is no such account in the address =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
2006 Feb 11
0
hclust(stats) merge matrix interpretation
Hi, We are trying to interpret the clusters generated by hclust method of R "stats" package. The problem here is when i get the hc$order then there is some order, while exporting to file that order is lost. Here is the example code and their results: > hc <- hclust(dist(USArrests), "ave") > plot(hc) > hc$label [1] "Alabama" "Alaska"
2008 Aug 03
0
gmaps, projection, inset
Running R version 2.6.1 under Gentoo Linux, I'm trying to produce a thematic map of the USA using the gmaps package. The result thus far has two problems from my point of view. First, the projection (Miller cylindrical?) elongates southern states and flattens northern ones unattractively. I'd prefer Albers conic projection or something similar. Second, the inset for Alaska is placed
2010 Apr 02
4
Derivative of a smooth function
Dear All, I've been?searching for?appropriate codes to compute the rate of change and the curvature?of ?nonparametric regression model whish was denoted by a smooth function?but?unfortunately?don't manage to?do?it. I presume that such characteristics from a smooth curve can be determined by the first and second derivative operators. The following are the example of fitting a
2011 Sep 02
2
conditional replacement of character strings in vectors
Hello, I have a dataframe that looks like this: a b NA Honduras China NA NA Sudan Japan NA NA Mexico NA Mexico I would like to replace the NA values in column b with the non-NA values in column a. I have tried a number of techniques, (if, ifelse) but I must have the logic wrong. Thanks -- Josh [[alternative HTML version deleted]]