similar to: Warning message about closing a connection XXXX

Displaying 20 results from an estimated 10000 matches similar to: "Warning message about closing a connection XXXX"

2012 Jan 19
2
Reading in tab (and space) delimited data within a script XXXX
Hello everyone, I use Bob Muenchen's approach for reading in "in-stream" (to use SAS parlance) delimited data within a script. This works great: mystring <- "id,workshop,gender,q1,q2,q3,q4 1,1,f,1,1,5,1 2,2,f,2,1,4,1 3,1,f,2,2,4,3 4,2, ,3,1, ,3 5,1,m,4,5,2,4 6,2,m,5,4,5,5 7,1,m,5,3,4,4 8,2,m,4,5,5,5" mydata <- read.table( textConnection(mystring),
2009 Jul 11
3
Reading data entered within an R program
Dear R-helpers, I know of two ways to reading data within an R program, using textConnection and stdin (demo program below). I've Googled about and looked in several books for comparisons of the two approaches but haven't found anything. Are there any particular advantages or disadvantages to these two approaches? If you were teaching R beginners, which would you present? Thanks, Bob
2006 Dec 15
1
Switching labels on a factor
Hi All, I'm perplexed by the way the unclass function displays a factor whose labels have been swapped with the relevel function. I realize it won't affect any results and that the relevel did nothing useful in this particular case. I'm just doing it to learn ways to manipulate factors. The display of unclass leaves me feeling that the relevel had failed. I've checked three books
2006 Dec 18
1
Applying variable labels across a data frame
Hi All, I'm working on a class example that demonstrates one way to deal with factors and their labels. I create a function called myLabeler and apply it with lapply. It works on the whole data frame when I subscript it as in lapply( myQFvars[ ,myQFnames ], myLabeler ) but does not work if I leave the [] subscripts off. I would appreciate it if anyone could tell me why. The program below
2006 Nov 25
3
Multiple Conditional Tranformations
Greetings, I'm learning R and I'm stuck on a basic concept: how to specify a logical condition once and then perform multiple transformations under that condition. The program below is simplified to demonstrate the goal. Its results are exactly what I want, but I would like to check the logical state of gender only once and create both (or any number of) scores at once.
2011 Aug 24
3
Importing data from MS EXCEL (.xls) to R XXXX
Hello everyone, What is the simplest, most RELIABLE way to import data from MS EXCEL (.xls) format to R? In the past I have used the read.xls() function from the xlsReadWrite package, however, I have been wrestling with it all afternoon long with no success. I continue to receive the following error message: > {widge<-read.xls("F:\\Classes\\Z1.Data\\stat.3010\\WidgeOne.xls", +
2012 Mar 02
3
Memory issue. XXXX
Hi everyone, Any ideas on troubleshooting this memory issue: > d1<-read.csv("arrears.csv") Error: cannot allocate vector of size 77.3 Mb In addition: Warning messages: 1: In class(data) <- "data.frame" : Reached total allocation of 1535Mb: see help(memory.size) 2: In class(data) <- "data.frame" : Reached total allocation of 1535Mb: see
2011 Aug 27
2
Placing a column name in a variable XXXX
Hi everyone, How does one place an object name (in this case a vector name) into another object (while essentially masking the values of the first object? For example: > JOBSAT<-rnorm(40) > > CI<-function(x,alpha){ + result<-cbind(x,mean=mean(x),alpha) + print(result) + } > CI(JOBSAT,.05) I want this to return: Variable mean alpha JOBSTAT 0.02844131 0.05
2011 Nov 28
1
2 Y-AXIS labels on the same (left-hand side) Y-AXIS XXXX
Hello everyone, Is it possible to specify a 2 line y-axis label on the same lef-hand side y-axis? I am using the \n regular expression, but only the 2nd line appears (I assume the 1st line is printed off the page...) plot(PRE_SHB,R1, main="Figure 1.1: Scatterplot of Residualized Post Score", xlab = "Pre Score", ylab = "Residualized Post Score \n (Adjusted for Age
2012 Jan 17
3
Using !is.na() in a HAVING clause in sqldf() XXXX
Hi everyone, I have the following: sqldf("select Premie,count(tpounds) N,avg(tpounds) Avg_Weight, stddev_samp(tpounds) StdDev from children group by Premie having !is.na(Premie)") sqldf() does not like the !is.na(Premie) specification. How does one exclude a "missing" group in an aggregated query using sqldf()? Thanks! Dan [[alternative HTML version deleted]]
2013 Mar 25
3
Obtaining the internal integer codes of a factor XXXX
Hi everyone, I understand the process of obtaining the internal integer codes for the raw values of a factor (using as.numeric() as below), but what is the best way to obtain these codes for the levels() of a factor (since the as.numeric() results don't really make clear which code maps to which level)?
2012 Jan 04
3
Using a mathematical expression in sapply() XXXX
Hello everyone, I have the following call to sapply() and error message. Is the most efficient way to deal with this to make sum(!is.na(x)) a function in a separate line prior to this call? If not, please advise. N.Valid=sapply(x,sum(!is.na(x))) Error in match.fun(FUN) : 'sum(!is.na(x))' is not a function, character or symbol Thanks! Dan [[alternative HTML version deleted]]
2012 Mar 07
2
Remove a word from a character vector value XXXX
Hi everyone, What is the easiest way to remove the word Average and strip leading and trailing blanks from the character vector (d5.Region) below? .nrow.d5. d5.Region 1 1 Central Average 2 2 Coastal Average 3 3 East Average 4 4 Metro East Average 5 5 Metro North Average 6 6 Metro South Average 7
2012 Jan 24
2
Writing a function to return column position XXXX
Hello everyone, I am writing my own function to return the column index of all variables (these are currently character vectors) in a data frame that contain a dollar sign($). A small piece of the data look like this: can_sta can_zip ind_ite_con ind_uni_con AL 36106 $251,895.80 $22,874.43 AL 35802 $141,373.60 $7,100.00 AL 35201 $273,208.50 $18,193.66 AR 72404 $186,918.00 $25,391.00 AR
2011 Sep 01
2
Including only a subset of the levels of a factor XXXX
Hello everyone, I have the following factor: levels(pp_income) [1] "" "1" "2" "3" "4" "5" "6" "7" [9] "8" "9" "Renter" I want to subset so that only values 1:9 are included. I have the following: > income<-pp_income[pp_income %in%
2009 Feb 12
3
getting all pairwise combinations of elements in a character string
I'm able to do this as follows, but am wondering if anyone knows a simpler way which still avoids explicit loops? > (mystring <- letters[1:5]) [1] "a" "b" "c" "d" "e" > unlist(sapply(mystring[-length(mystring)], + function(x) paste(x,mystring[(grep(x,mystring)+1):length(mystring)],sep=""))) a1 a2 a3
2011 Dec 30
2
Applyiing mode() or class() to each column of a data.frame XXXX
Hi everyone, I am attempting to use the apply() function to obtain the mode and class of each column in a data frame, however, I am encountering unexpected results. I have the following example data: v13<-1:6 v14<-c(1,2,3,3,NA,1) v15<-c("Good","Bad",NA,"Good","Bad","Bad")
2007 May 28
2
[LLVMdev] Problem in llvm gcc back-end
HI, While I testing some code, I found some problem on Union handling. I've wrte following test code, and it has union assignment. The code's output is from pointerToUnion: chars mystring, length 64 from original: chars mystring, length 8000 It's caused by second char member(charlength) of LongestMember. For union assignment, llvm-backend seems generates assigning each member of
2008 Sep 22
2
adding layers in ggplot2 (data and code included)
Here is some sample data: mydata <- read.table(textConnection("Est Group Tri 0 0 4.639644 1 0 4.579189 2 0 4.590714 0 1 4.443696 1 1 4.588243 2 1 4.650505 0 2 4.296608 1 2 4.826036 2 2 4.765386"),header=TRUE); closeAllConnections(); I can form two plots,
2007 Nov 20
3
How to test views with Nested Resources and Partials
Hi everyone, I am relatively new to rspec and I am running into a wall in testing my views. I have a RESTful resource Contracts with a nested resource of Line_items. I am trying to figure out how to test the "edit" form of the Line_items. What complicates this is the nested routing and how to account for it, and that there is a partial form (_form.haml) that both the edit.haml and