Displaying 20 results from an estimated 2000 matches similar to: "error in recode.defalt ....object '.data' not found"
2012 Nov 09
5
using lapply with recode
Hello:
Forgive me, this is surely a simple question but I can't figure it out, having consulted the help archives and "Data Manipulation With R" (Spector).
I have a list of 11 data frames with one common variable in each (prov). I'd like to use lapply to go through and recode one particular level of that common variable.
I can get the recode to work, but it only returns the
2011 Jul 29
1
Apostrophes in R Commander in recode
Dear colleagues,
I'm using R64 (2.13) on Mac OS 10.6.8 and I've encountered a problem with the recode function in Rcommander. The application cannot deal with apostrpohes ( ' ) do not. I've got a factor from the 2008 Canada Election study (highest level of schooling) and some of the values include "Bachelor's Degree" , "Master's Degree".
I've
2010 Oct 10
1
Create single vector after looping through multiple data frames with GREP
Hello all,
I changed the subject line of the e-mail, because the question I''m posing now is different than the first one. I hope that this is proper etiquette. However, the original chain is included below.
I've incorporated bits of both Ethan and Brian's code into the script below, but there's one aspect I can't get my head around. I'm totally new to programming
2010 Oct 19
2
separate elements of a character vector
Dear colleagues, this seems like an easy problem, and I found some suggestions which I've incorporated in the help list, but I can't quite get it right.
I want to add a series of years to a second x-axis category label. I generate them with test and test_2 below, format them with some spacing (which is the suggestion I took from the R-list) and concatenate them and then write them with
2012 May 28
1
Rcurl, postForm()
Dear colleagues,
Could I get some assistance using postForm() to scrape the business names and addresses at this website:
http://www.brantford.ca/business/LocalBusinessCommunity/Pages/BusinessDirectorySearch.aspx
I've read through (http://www.omegahat.org/RCurl/RCurlJSS.pdf) and scoured the web for tutorials, but I can't crack it. I'm aware that this is probably a pretty basic
2011 Jul 28
2
cycling from x11 window in RCommander to graphics device window: Mac Os 10.6.8
Dear Colleagues,
I have recently installed R Commander on my Mac OS 10.6.8. I'd like to use it for an undergraduate class this year.
Everything appears to be working fine, except for one thing. I cannot use Command-tab to cycle from the X11 window in which RCommander is running to any other window open in my workspace. This is particularly important because I cannot cycle to the graphics
2012 Aug 20
2
Changing line length in Sweave output works for numeric, but not for character vectors
Hi there: I'm preparing a report in RStudio 0.96.330 on a Mac OS. I'm running R 2.15.0
I understand from Ross Ihaka's document (http://www.stat.auckland.ac.nz/~stat782/downloads/Sweave-customisation.pdf) that you can modify the line length of Sweave output by a call to options(wdith=x).
This works great for me for numeric output, but not for character vectors that I have to print.
2011 Nov 10
2
Listing tables together from random samples from a generated population?
.
HI there,
I'd like to show demonstrate how the chi-squared distribution works, so I've come up with a sample data frame of two categorical variables
y<-data.frame(gender=sample(c('Male', 'Female'), size=100000, replace=TRUE, c(0.5, 0.5)), tea=sample(c('Yes', 'No'), size=100000, replace=TRUE, c(0.5, 0.5)))
And I'd like to create a list of 100
2011 Jan 18
2
Counting dates in arbitrary ranges
Dear Colleagues,
I have a data set that looks as below. I'd like to count the number of dates in a series of arbitrary ranges (breaks) i.e. not pre-defined breaks such as months, quarters or years. table(format()) produces ideally formatted output, but table() does not appear to accept arbitrary ranges.
I also tried converting the dates to numeric and using histogram to try to get the data,
2011 Jan 17
1
Importing multiple text files with lapply.
Hello,
I'm trying to read in 50 text filess with dates as content to create a list of tables.
a is the list of filenames that need to be read in.
The following command returns the following error
mylist<-lapply(a, read.table(header=TRUE, sep="\n"))
Error in read.table(header = TRUE, sep = "\n") :
element 1 is empty;
the part of the args list of
2012 Apr 16
1
grep and XML
Hi all:
I struggle a lot scraping web data. I still haven't got a handle on the XML package.
I'd like to get particular exchange rates from this table:
https://raw.github.com/currencybot/open-exchange-rates/master/latest.json
This is the code that I'm working with:
library(RCurl)
library(XML)
2011 Jul 11
1
grep lines before or after pattern matched?
Dear colleagues,
I have a series of newspaper articles in a text file, downloaded from a text file. They look as follows:
Document 1 of 100
\n
\n
\n
Newspaper Name
\n
\n
Day Date
I have a series of grep scripts that can extract the date and convert it to a date object, but I can't figure out how to grep the newspaper name. There is no field ID attached to those lines. The best I can come
2011 Jan 25
1
subsetting based on joint values of critera
Dear colleagues, I have a dataset that looks as below.
I would like to make a new dataset that excludes the cases which are joint conjunctions of particular state names and years, so Connecticut and 2010, Maryland and 2010 and Vermont and 2010.
I'm trying the following subset code:
newdata<- subset(bpa, (!State=="Connecticut" & year<"2010"))
It appears that
2011 Jul 23
2
sum part of a vector
Dear colleagues, I have a data set that looks roughly like this;
mydat<-data.frame(state=c(rep("Alabama", 5), rep("Delaware", 5), rep("California", 5)), news=runif(15, min=0, max=8), cum.news=rep(0, 15))
For each state, I'd like to cumulatively sum the value of "news" and make that put that value in cum.news.
I'm trying as follows but I get
2011 Apr 22
1
indexing list elements with lapply?
Dear colleagues,
I have a list that looks like what the code below produces. I need a function to go through each list element and work on the second column of each list element (the first column is irrelevant to me...if the proposed function works on the first column as a consequence of a writing something simple, that's fine).
I need to index the second column of each list element to the
2010 Sep 21
2
group means of multi-way table?
hello, can someone tell me how to generate the means for a data frame
that looks like this? My data frame has many more variables, but I
won't bother you with those; these are the one's that I'm interested in.
Needless to say, z is the variable in which I'm interested. I'd like
to find out the mean score of z for NDP managers, Conservative
managers and Liberal managers
2013 Mar 15
2
latex(test, collabel=) returns wrong latex code?
Hello:
I'm working with a 2-dimensional table that looks sort of like test below.
I'm trying to produce latex code that will add dimension names for both the rows and the columns.
In using the following code, latex chokes when I include collabel='Vote' but it's fine without it.
The code below prouces the latex code further below. I'm confused by this, because it looks
2010 Oct 06
2
Converting scraped data
Dear Colleagues,
I used this code to scrape data from the URL conatined within. This
code should be reproducible.
require("XML")
library(XML)
theurl <- "http://www.queensu.ca/cora/_trends/mip_2006.htm"
tables <- readHTMLTable(theurl)
n.rows <- unlist(lapply(tables, function(t) dim(t)[1]))
class(tables)
test<-data.frame(tables, stringsAsFactors=FALSE)
2011 Sep 05
2
htmlParse hangs or crashes
Dear colleagues,
each time I use htmlParse, R crashes or hangs. The url I'd like to parse is included below as is the results of a series of basic commands that describe what I'm experiencing. The results of sessionInfo() are attached at the bottom of the message.
The thing is, htmlTreeParse appears to work just fine, although it doesn't appear to contain the information I need (the
2011 Oct 31
1
Help combining cell labelling and multiple mosaic plots
Dear colleagues
I'm using data that looks like .test and .test1 below to draw two mosaic plots with cell labelling (the row percentages from the tables).
When I take out the pop=FALSE commands in the mosaic commands and comment out the two lines labelling the cells, then the plots are laid out exactly as I'd like: side-by-side.
But I do require the cell labelling and the pop=FALSE