Issue when importing dataset: `Error in scan(…): line 1 did not have 145 elements`

This error is pretty self-explanatory. There seem to be data missing in the first line of your data file (or second line, as the case may be since you’re using header = TRUE). Here’s a mini example: ## Create a small dataset to play with cat(“V1 V2\nFirst 1 2\nSecond 2\nThird 3 8\n”, file=”test.txt”) R automatically … Read more

read.csv warning ‘EOF within quoted string’ prevents complete reading of file

You need to disable quoting. cit <- read.csv(“citations.CSV”, quote = “”, row.names = NULL, stringsAsFactors = FALSE) str(cit) ## ‘data.frame’: 112543 obs. of 13 variables: ## $ row.names : chr “10.2307/675394” “10.2307/30007362” “10.2307/4254931” “10.2307/20537934” … ## $ id : chr “10.2307/675394\t” “10.2307/30007362\t” “10.2307/4254931\t” “10.2307/20537934\t” … ## $ doi : chr “Archaeological Inference and Inductive Confirmation\t” … Read more

Specify custom Date format for colClasses argument in read.table/read.csv

You can write your own function that accepts a string and converts it to a Date using the format you want, then use the setAs to set it as an as method. Then you can use your function as part of the colClasses. Try: setAs(“character”,”myDate”, function(from) as.Date(from, format=”%d/%m/%Y”) ) tmp <- c(“1, 15/08/2008”, “2, 23/05/2010”) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)